吴学文
2019-11-23 be26b0e1702b6a3f53d781953a9107fccf1d51a5
AppFrontService/src/main/java/com/java110/app/controller/WxLoginController.java
@@ -23,6 +23,7 @@
 * 微信小程序登录处理类
 */
@RestController
@RequestMapping(path = "/app")
public class WxLoginController extends BaseController {
    private final static Logger logger = LoggerFactory.getLogger(WxLoginController.class);
@@ -33,21 +34,22 @@
    /**
     * 微信登录接口
     *
     * @param wxLoginInfo
     * @param postInfo
     * @param request
     */
    @RequestMapping(path = "/loginWx", method = RequestMethod.POST)
    public ResponseEntity<String> loginWx(@RequestBody WxLoginInfo wxLoginInfo, HttpServletRequest request) {
    public ResponseEntity<String> loginWx(@RequestBody String postInfo, HttpServletRequest request) {
        ResponseEntity<String> responseEntity = null;
        String code = wxLoginInfo.getCode();
        UserInfo userInfo = wxLoginInfo.getUserInfo();
        JSONObject postObj = JSONObject.parseObject(postInfo);
        String code = JSONObject.parseObject(postInfo).getString("code");
        JSONObject userInfo = postObj.getJSONObject("userInfo");
        if (code == null || userInfo == null) {
            logger.error("code is null");
            responseEntity = new ResponseEntity<>("code is null", HttpStatus.BAD_REQUEST);
            return responseEntity;
        }
        String sessionKey = null;
        String openId = null;
        /*String sessionKey = null;
        String openId = null;*/
//        try {
//            /*WxMaJscode2SessionResult result = this.wxMaService.getUserService().getSessionInfo(code);
//            sessionKey = result.getSessionKey();
@@ -57,9 +59,11 @@
//            e.printStackTrace();
//        }
        IPageData pd = PageData.newInstance().builder("","", JSONObject.toJSONString(wxLoginInfo),"","","","");
        IPageData pd = PageData.newInstance().builder("", "", postInfo,
                "", "", "", "",
                request.getHeader("APP_ID"));
       return wxLoginSMOImpl.doLogin(pd);
        return wxLoginSMOImpl.doLogin(pd);
        //login first
        /*User user = userService.queryByOpenid(openId);