+18
-18
@@ -226,6 +226,24 @@ public class UserController {
|
||||
String pass = StringUtils.trimToNull(model.getPass());
|
||||
String weiXinId = CookieUtils.getCookieValue(request,"we_chat_open_id");
|
||||
|
||||
if(StringUtils.isBlank(weiXinId) && StringUtils.isNotBlank(model.getSid())){
|
||||
System.out.println("小程序code:"+model.getCode());
|
||||
System.out.println("小程序AppId:"+model.getAppId());
|
||||
System.out.println("小程序AppSecret:"+model.getAppSecret());
|
||||
System.out.println("sid:"+model.getSid());
|
||||
XcxKey sessionValue = getSessionValue(model.getCode(), null, model.getAppId(), model.getAppSecret());
|
||||
if(sessionValue!=null){
|
||||
weiXinId = sessionValue.getOpenId();
|
||||
}
|
||||
if(weiXinId == null) {
|
||||
weiXinId = CookieUtils.getCookieValue(request,"we_chat_open_id");
|
||||
}
|
||||
if(weiXinId != null && !weiXinId.equals("")){
|
||||
CookieUtils.setCookie("we_chat_open_id", weiXinId, "/", 60 * 60 * 24 *7, response);
|
||||
}
|
||||
System.out.println("[sid]小程序微信OPEN_ID:" + weiXinId);
|
||||
}
|
||||
|
||||
if(StringUtils.isBlank(weiXinId) && StringUtils.isNotBlank(model.getCode())){
|
||||
System.out.println("小程序code:"+model.getCode());
|
||||
System.out.println("小程序AppId:"+model.getAppId());
|
||||
@@ -244,24 +262,6 @@ public class UserController {
|
||||
}
|
||||
System.out.println("小程序微信OPEN_ID:" + weiXinId);
|
||||
}
|
||||
|
||||
if(StringUtils.isBlank(weiXinId) && StringUtils.isNotBlank(model.getSid())){
|
||||
System.out.println("小程序code:"+model.getCode());
|
||||
System.out.println("小程序AppId:"+model.getAppId());
|
||||
System.out.println("小程序AppSecret:"+model.getAppSecret());
|
||||
System.out.println("sid:"+model.getSid());
|
||||
XcxKey sessionValue = getSessionValue(model.getCode(), null, model.getAppId(), model.getAppSecret());
|
||||
if(sessionValue!=null){
|
||||
weiXinId = sessionValue.getOpenId();
|
||||
}
|
||||
if(weiXinId == null) {
|
||||
weiXinId = CookieUtils.getCookieValue(request,"we_chat_open_id");
|
||||
}
|
||||
if(weiXinId != null && !weiXinId.equals("")){
|
||||
CookieUtils.setCookie("we_chat_open_id", weiXinId, "/", 60 * 60 * 24 *7, response);
|
||||
}
|
||||
System.out.println("[sid]小程序微信OPEN_ID:" + weiXinId);
|
||||
}
|
||||
//测试时可以先去掉
|
||||
if (StringUtils.isBlank(username) || StringUtils.isBlank(pass) || StringUtils.isBlank(weiXinId)){
|
||||
resultModel.setMsg(Message.PARAM_NOT_NULL);
|
||||
|
||||
Reference in New Issue
Block a user