OwnerAppLoginController.java 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. package com.java110.app.controller;
  2. import com.alibaba.fastjson.JSONObject;
  3. import com.java110.app.smo.ownerLogin.IOwnerAppLoginSMO;
  4. import com.java110.app.smo.propertyLogin.impl.wxLogin.IPropertyAppLoginSMO;
  5. import com.java110.core.base.controller.BaseController;
  6. import com.java110.core.context.IPageData;
  7. import com.java110.core.context.PageData;
  8. import com.java110.utils.constant.CommonConstant;
  9. import org.slf4j.Logger;
  10. import org.slf4j.LoggerFactory;
  11. import org.springframework.beans.factory.annotation.Autowired;
  12. import org.springframework.http.ResponseEntity;
  13. import org.springframework.web.bind.annotation.RequestBody;
  14. import org.springframework.web.bind.annotation.RequestMapping;
  15. import org.springframework.web.bind.annotation.RequestMethod;
  16. import org.springframework.web.bind.annotation.RestController;
  17. import javax.servlet.http.HttpServletRequest;
  18. /**
  19. * 微信小程序登录处理类
  20. */
  21. @RestController
  22. @RequestMapping(path = "/app")
  23. public class OwnerAppLoginController extends BaseController {
  24. private final static Logger logger = LoggerFactory.getLogger(OwnerAppLoginController.class);
  25. @Autowired
  26. private IOwnerAppLoginSMO ownerAppLoginSMOImpl;
  27. /**
  28. * 微信登录接口
  29. *
  30. * @param postInfo
  31. * @param request
  32. */
  33. @RequestMapping(path = "/loginOwner", method = RequestMethod.POST)
  34. public ResponseEntity<String> loginOwner(@RequestBody String postInfo, HttpServletRequest request) {
  35. /*IPageData pd = (IPageData) request.getAttribute(CommonConstant.CONTEXT_PAGE_DATA);*/
  36. IPageData pd = PageData.newInstance().builder("", "", "", postInfo,
  37. "login", "", "", "",
  38. request.getHeader("APP_ID"));
  39. ResponseEntity<String> responseEntity = ownerAppLoginSMOImpl.doLogin(pd);
  40. JSONObject outParam = JSONObject.parseObject(responseEntity.getBody());
  41. pd.setToken(outParam.getString("token"));
  42. request.setAttribute(CommonConstant.CONTEXT_PAGE_DATA,pd);
  43. return responseEntity;
  44. }
  45. }