admin
2022-04-26 36681e15e12aaa9135f69260472de65303cdcba3
app/src/main/java/com/yeshi/makemoney/app/controller/client/api/UserController.java
@@ -7,6 +7,7 @@
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;
@@ -102,6 +103,25 @@
            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() {
@@ -120,7 +140,6 @@
        } catch (LoginException e) {
            return JsonUtil.loadFalseResult(e.getMessage());
        }
    }
    private String outUserInfoForLogin(UserInfo userInfo) {
@@ -134,6 +153,38 @@
        }
        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
@@ -195,7 +246,8 @@
            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);
    }