| | |
| | | import com.yeshi.makemoney.app.entity.user.WXUserInfo; |
| | | import com.yeshi.makemoney.app.entity.vip.UserVIPInfo; |
| | | import com.yeshi.makemoney.app.exception.user.LoginException; |
| | | import com.yeshi.makemoney.app.exception.user.UserAccountException; |
| | | import com.yeshi.makemoney.app.service.inter.goldcorn.GoldCornGetRecordService; |
| | | import com.yeshi.makemoney.app.service.inter.money.UserMoneyService; |
| | | import com.yeshi.makemoney.app.service.inter.team.TeamInviteRelationService; |
| | |
| | | return JsonUtil.loadFalseResult("信息不完整"); |
| | | } |
| | | loginInfo.setSystem(acceptData.getSystem()); |
| | | return login(loginInfo, acceptData); |
| | | } |
| | | |
| | | |
| | | @ResponseBody |
| | | @RequestMapping("loginWX") |
| | | public String loginWX(AcceptData acceptData, String code, HttpServletRequest request) { |
| | | LoginInfoDTO loginInfo = new LoginInfoDTO(); |
| | | loginInfo.setIpInfo(IPUtil.getRemotIP(request) + ":" + request.getRemotePort()); |
| | | loginInfo.setLoginType(UserLoginRecord.TYPE_LOGIN_WX); |
| | | if (StringUtil.isNullOrEmpty(code)) { |
| | | return JsonUtil.loadFalseResult("信息不完整"); |
| | | } |
| | | loginInfo.setWxCode(code); |
| | | loginInfo.setSystem(acceptData.getSystem()); |
| | | return login(loginInfo, acceptData); |
| | | } |
| | | |
| | | private String login(LoginInfoDTO loginInfo, AcceptData acceptData) { |
| | | try { |
| | | UserInfo userInfo = userAccountService.login(loginInfo); |
| | | ThreadUtil.run(new Runnable() { |
| | |
| | | } catch (LoginException e) { |
| | | return JsonUtil.loadFalseResult(e.getMessage()); |
| | | } |
| | | |
| | | } |
| | | |
| | | private String outUserInfoForLogin(UserInfo userInfo) { |
| | |
| | | } |
| | | return JsonUtil.loadTrueResult(JsonUtil.getSimpleGson().toJson(vo)); |
| | | } |
| | | |
| | | |
| | | @UserLogin(uid = "#uid") |
| | | @ResponseBody |
| | | @RequestMapping("bindWX") |
| | | public String bindWX(AcceptData acceptData, Long uid, String code) { |
| | | |
| | | try { |
| | | userAccountService.bindWX(uid, code); |
| | | } catch (UserAccountException e) { |
| | | e.printStackTrace(); |
| | | return JsonUtil.loadFalseResult(e.getMsg()); |
| | | } |
| | | |
| | | return JsonUtil.loadTrueResult(""); |
| | | } |
| | | |
| | | @UserLogin(uid = "#uid") |
| | | @ResponseBody |
| | | @RequestMapping("bindPhone") |
| | | public String bindPhone(AcceptData acceptData, Long uid, String phone, String vcode, String token) { |
| | | |
| | | try { |
| | | userAccountService.bindPhone(uid, phone, vcode, token); |
| | | } catch (UserAccountException e) { |
| | | e.printStackTrace(); |
| | | return JsonUtil.loadFalseResult(e.getMsg()); |
| | | } |
| | | |
| | | return JsonUtil.loadTrueResult(""); |
| | | } |
| | | |
| | | |
| | | @UserLogin(uid = "#uid") |
| | | @ResponseBody |
| | |
| | | return JsonUtil.loadFalseResult(ApiCodeConstant.CODE_FAIL_USER_DELETE, "用户已被删除"); |
| | | } |
| | | |
| | | UserInfoVO vo = UserInfoVO.create(user, userExtraInfoService.get(uid), wxUserInfoService.selectByUid(uid)); |
| | | |
| | | UserInfoVO vo = UserInfoVO.create(user, userExtraInfoService.get(uid), user.getWxUser() == null ? null : wxUserInfoService.get(user.getWxUser().getId())); |
| | | |
| | | return JsonUtil.loadTrueResult(vo); |
| | | } |