| | |
| | | import com.google.gson.JsonSerializer;
|
| | | import com.yeshi.fanli.dto.user.UserInviteLevelEnum;
|
| | | import com.yeshi.fanli.entity.accept.AcceptData;
|
| | | import com.yeshi.fanli.entity.bus.user.ForbiddenUserIdentifyCode;
|
| | | import com.yeshi.fanli.entity.bus.user.SMSHistory;
|
| | | import com.yeshi.fanli.entity.bus.user.ThreeSale;
|
| | | import com.yeshi.fanli.entity.bus.user.UserInfo;
|
| | | import com.yeshi.fanli.entity.bus.user.UserInfoExtra;
|
| | | import com.yeshi.fanli.entity.bus.user.UserInviteValidNum;
|
| | | import com.yeshi.fanli.entity.bus.user.ForbiddenUserIdentifyCode.ForbiddenUserIdentifyCodeTypeEnum;
|
| | | import com.yeshi.fanli.entity.bus.user.vip.TearcherInfo;
|
| | | import com.yeshi.fanli.entity.bus.user.vip.UserLevelEnum;
|
| | | import com.yeshi.fanli.entity.bus.user.vip.UserVIPInfo;
|
| | |
| | | import com.yeshi.fanli.util.StringUtil;
|
| | | import com.yeshi.fanli.util.ThreadUtil;
|
| | | import com.yeshi.fanli.util.TimeUtil;
|
| | | import com.yeshi.fanli.util.VersionUtil;
|
| | | import com.yeshi.fanli.util.account.UserUtil;
|
| | | import com.yeshi.fanli.util.annotation.RequestSerializableByKey;
|
| | | import com.yeshi.fanli.util.user.UserLevelUtil;
|
| | |
| | | object.put("code", errorCode);
|
| | | object.put("data", data);
|
| | | out.print(object.toString());
|
| | | } else if (errorCode == 102) { // 需要绑定微信号
|
| | | JSONObject data = new JSONObject();
|
| | | data.put("key", e.getMsg());
|
| | | JSONObject object = new JSONObject();
|
| | | object.put("code", errorCode);
|
| | | object.put("data", data);
|
| | | out.print(object.toString());
|
| | | } else {
|
| | | out.print(JsonUtil.loadFalseResult(e.getCode(), e.getMsg()));
|
| | | try {
|
| | |
| | | }
|
| | | }
|
| | |
|
| | | |
| | |
|
| | | /**
|
| | | * 绑定微信V2.1.3 电话号码 登录
|
| | | * |
| | | * @param acceptData
|
| | | * @param vcode
|
| | | * @param phone
|
| | | * @param out
|
| | | */
|
| | | @RequestSerializableByKey(key = "'bindWXLogin-'+#code")
|
| | | @RequestMapping(value = "bindWXLogin")
|
| | | public void bindWXLogin(AcceptData acceptData, Long uid, String code, String key, HttpServletRequest request,
|
| | | PrintWriter out) {
|
| | | BusinessSystem system = businessSystemService.getBusinessSystemCache(acceptData.getPlatform(),
|
| | | acceptData.getPackages());
|
| | | if (system == null) {
|
| | | out.print(JsonUtil.loadFalseResult("系统不存在"));
|
| | | return;
|
| | | }
|
| | |
|
| | | if (StringUtil.isNullOrEmpty(code)) {
|
| | | out.print(JsonUtil.loadFalseResult("请上传code"));
|
| | | return;
|
| | | }
|
| | |
|
| | | if (StringUtil.isNullOrEmpty(key)) {
|
| | | out.print(JsonUtil.loadFalseResult("key值不能为空"));
|
| | | return;
|
| | | }
|
| | |
|
| | | try {
|
| | | UserInfo userInfo = userAccountService.bindWXToLogin(request, acceptData, code, system.getAppid(), key);
|
| | | JSONObject data = new JSONObject();
|
| | | data.put("userInfo", UserUtil.filterForClientUser(userInfo));
|
| | | out.print(JsonUtil.loadTrueResult(data));
|
| | | } catch (UserAccountException e) {
|
| | | out.print(JsonUtil.loadFalseResult(e.getCode(), e.getMsg()));
|
| | | }
|
| | |
|
| | | }
|
| | |
|
| | | |
| | | |
| | | /**
|
| | | * 绑定电话号码 V2.0.1 微信登录
|
| | | *
|
| | |
| | | JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(data));
|
| | | }
|
| | |
|
| | | |
| | | /**
|
| | | * 账户注销
|
| | | * @param acceptData
|
| | | * @param callback
|
| | | * @param uid
|
| | | * @param out
|
| | | */
|
| | | @RequestMapping("accountRemove")
|
| | | public void accountRemove(AcceptData acceptData, String callback, Long uid, String vcode, PrintWriter out) {
|
| | | if (uid == null) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("用户未登录"));
|
| | | return;
|
| | | }
|
| | | |
| | | if (StringUtil.isNullOrEmpty(vcode)) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("请输入验证码"));
|
| | | return;
|
| | | }
|
| | | |
| | | UserInfo userInfo = userInfoService.selectByPKey(uid);
|
| | | if (userInfo == null) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("用户不存在"));
|
| | | return;
|
| | | }
|
| | | |
| | | if (userInfo.getState() == UserInfo.STATE_FORBIDDEN) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult(Constant.CODE_FORBIDDEN_USER, Constant.FORBIDDEN_USER_REASON_DESC));
|
| | | return;
|
| | | }
|
| | |
|
| | | if (userInfo.getState() == UserInfo.STATE_DELETE || userInfo.getState() == UserInfo.STATE_DELETE_OUT_OF_DATE) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult(Constant.CODE_FORBIDDEN_USER, "帐户已被注销,请重新登录"));
|
| | | return;
|
| | | }
|
| | | |
| | | String phone = userInfo.getPhone();
|
| | | if (StringUtil.isNullOrEmpty(phone)) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("未绑定有效电话号码"));
|
| | | return;
|
| | | }
|
| | | |
| | | if (!Constant.IS_TEST) {
|
| | | String oldVcode = redisManager.getSMSVCode(phone, SMSHistory.TYPE_REMVOE);
|
| | | if (StringUtil.isNullOrEmpty(oldVcode) || !oldVcode.equalsIgnoreCase(vcode)) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("验证码错误,重新输入"));
|
| | | return;
|
| | | } |
| | | redisManager.clearSMSVCode(phone, SMSHistory.TYPE_REMVOE);
|
| | | }
|
| | | |
| | | UserInfo user = new UserInfo(uid);
|
| | | user.setState(UserInfo.STATE_DELETE);
|
| | | user.setStateDesc("用户主动注销账户");
|
| | | userInfoService.updateByPrimaryKeySelective(user);
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult("注销成功"));
|
| | | }
|
| | | |
| | | }
|