Commit 1ad4663c authored by lee_mingzhu's avatar lee_mingzhu

add wechat config

parent cae1bf87
...@@ -54,7 +54,7 @@ public interface Constants { ...@@ -54,7 +54,7 @@ public interface Constants {
} }
interface WeChat { interface WeChat {
String APP_ID = "wxcdf6077af8127559"; String APP_ID = "wx0a7c0bce0c3ac523";
String REDIRECT_URL = "http://wechattest.xyqb.com/webchat/receiveCode"; String REDIRECT_URL = "http://wechattest.xyqb.com/webchat/receiveCode";
String SCOPE = "snsapi_userinfo"; String SCOPE = "snsapi_userinfo";
} }
......
...@@ -449,15 +449,14 @@ public class UserController implements IBaseController { ...@@ -449,15 +449,14 @@ public class UserController implements IBaseController {
public JsonResult associateWithWechat(String openId, String phoneNo) { public JsonResult associateWithWechat(String openId, String phoneNo) {
User user = getCurrentUser(); User user = getCurrentUser();
Long userId = user.getId(); Long userId = user.getId();
User xyqbUser = userService.findByPhoneInDb(phoneNo);
WechatUserInfo wechatUserInfo = wechatService.findWechatUserInfoByPhoneNo(phoneNo); WechatUserInfo wechatUserInfo = wechatService.findWechatUserInfoByPhoneNo(phoneNo);
if (wechatUserInfo != null) { if (wechatUserInfo != null) {
return JsonResult.buildErrorStateResult("该手机号已绑定其他微信号码", null); return JsonResult.buildErrorStateResult("该手机号已绑定其他微信号码", null);
} }
if(xyqbUser != null && xyqbUser.getPhoneNo() != wechatUserInfo.getPhoneNo()) { WechatUserInfo userInfo = wechatService.findWechatUserInfoFromDb(openId);
if(!user.getPhoneNo().equals(phoneNo)) {
return JsonResult.buildErrorStateResult("该手机号已绑定其他微信号码", null); return JsonResult.buildErrorStateResult("该手机号已绑定其他微信号码", null);
} }
WechatUserInfo userInfo = wechatService.findWechatUserInfoFromDb(openId);
//限制微信用户和xyqb用户为一对一的关系 //限制微信用户和xyqb用户为一对一的关系
if (userInfo != null) { if (userInfo != null) {
userInfo.setUserId(userId); userInfo.setUserId(userId);
......
...@@ -32,7 +32,7 @@ public class RequestFilter implements Filter { ...@@ -32,7 +32,7 @@ public class RequestFilter implements Filter {
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", "/user/associate_wechat",
"/jr58/**","/app/login","/app/login_super", "/wechat/**", "/config/**","/api/**","/user/exists_token", "platform/api/page/return_url" "/jr58/**","/app/login","/app/login_super", "/wechat/**", "/config/**","/api/**","/user/exists_token", "platform/api/page/return_url", "MP_verify_AWiagUn4kZiwmTt0.txt"
}; };
private static final String UNAUTH_RESULT = JSONObject.toJSONString(JsonResult.buildErrorStateResult("登录失败", null)); private static final String UNAUTH_RESULT = JSONObject.toJSONString(JsonResult.buildErrorStateResult("登录失败", 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