Commit d3836a8d authored by zhouqian's avatar zhouqian

OK

parent e605ec55
...@@ -446,22 +446,30 @@ public class UserController implements IBaseController { ...@@ -446,22 +446,30 @@ public class UserController implements IBaseController {
} }
@RequestMapping("/associate_wechat") @RequestMapping("/associate_wechat")
public JsonResult associateWithWechat(String openId, String phoneNo) { public JsonResult associateWithWechat(String openId) {
User user = getCurrentUser(); User user = getCurrentUser();
Long userId = user.getId(); Long userId = user.getId();
WechatUserInfo wechatUserInfo = wechatService.findWechatUserInfoByPhoneNo(phoneNo);
if (wechatUserInfo != null) {
return JsonResult.buildErrorStateResult("该手机号已绑定其他微信号码", null);
}
WechatUserInfo userInfo = wechatService.findWechatUserInfoFromDb(openId); WechatUserInfo userInfo = wechatService.findWechatUserInfoFromDb(openId);
if(!user.getPhoneNo().equals(phoneNo)) {
return JsonResult.buildErrorStateResult("该手机号已绑定其他微信号码", null); // 已经绑定过了
if (userInfo != null && StringUtils.isNotEmpty(userInfo.getPhoneNo())) {
return JsonResult.buildSuccessResult(null, null);
}
// 前置绑定微信出错
if (userInfo == null) {
return JsonResult.buildSuccessResult(null, null);
} }
//限制微信用户和xyqb用户为一对一的关系 // 未绑定信用钱包用户
if (userInfo != null) { if (userInfo.getUserId() == null) {
userInfo.setUserId(userId); userInfo.setUserId(userId);
userInfo.setPhoneNo(phoneNo); userInfo.setPhoneNo(user.getPhoneNo());
try {
wechatService.saveWechatUserInfo(userInfo); wechatService.saveWechatUserInfo(userInfo);
} catch (Exception ex) {
// 不做绑定
JsonResult.buildErrorStateResult("该手机号已绑定其他微信号码", null);
}
return JsonResult.buildSuccessResult(null, null);
} }
return JsonResult.buildSuccessResult(null, null); return JsonResult.buildSuccessResult(null, null);
} }
......
...@@ -31,7 +31,7 @@ public class RequestFilter implements Filter { ...@@ -31,7 +31,7 @@ public class RequestFilter implements Filter {
private AntPathMatcher matcher = new AntPathMatcher(); private AntPathMatcher matcher = new AntPathMatcher();
private static final String [] ALLOWED_PATTERNS = { private static final String [] ALLOWED_PATTERNS = {
"/innerapi/**", "/user/exist","/user/register","/user/login","/user/register/fast", "/innerapi/**", "/user/exist","/user/register","/user/login","/user/register/fast",
"/user/login/fast", "/user/reset_password","/user/exist_check", "/user/associate_wechat", "/user/login/fast", "/user/reset_password","/user/exist_check",
"/jr58/**","/app/login","/app/login_super", "/wechat/**", "/config/**","/api/**","/user/exists_token", "/jr58/**","/app/login","/app/login_super", "/wechat/**", "/config/**","/api/**","/user/exists_token",
"/platform/api/page/return_url", "/MP_verify_AWiagUn4kZiwmTt0.txt" "/platform/api/page/return_url", "/MP_verify_AWiagUn4kZiwmTt0.txt"
}; };
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment