Commit a9c9363c authored by 技术部-任文超's avatar 技术部-任文超

优化代码,防止Duplicate entry 'user_id' for key 'uni_idx_user_id'

parent 3e0a3634
......@@ -42,6 +42,7 @@ import java.io.UnsupportedEncodingException;
import java.nio.charset.Charset;
import java.util.HashMap;
import java.util.Map;
import java.util.Objects;
/**
* Http服务接口:用户注册、登录、重置密码
......@@ -465,12 +466,10 @@ public class UserController implements IBaseController {
WechatUserInfo userInfo = wechatService.findWechatUserInfoFromDb(openId);
LOGGER.info("微信关联openId,user:[{}],openId:[{}],wechatUserInfo:[{}]",user,openId,userInfo);
// 已经绑定过了
if (userInfo != null && StringUtils.isNotEmpty(userInfo.getPhoneNo())) {
return JsonResult.buildSuccessResult(null, null);
if (Objects.isNull(userInfo) && !Objects.isNull(userId)) {
userInfo = wechatService.queryOpenIdByUserId(userId);
}
// 前置绑定微信出错
if (userInfo == null) {
if (userInfo == null || StringUtils.isNotEmpty(userInfo.getPhoneNo())) {
return JsonResult.buildSuccessResult(null, null);
}
// 未绑定信用钱包用户
......
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