自动登录

pull/1/head
wqy 2 years ago
parent 50bcc9e479
commit bbb4a001e2

@ -51,6 +51,20 @@ public class WechatController2 {
@GetMapping("/no-auth/wechat/getSessionId") @GetMapping("/no-auth/wechat/getSessionId")
public AjaxResult getSessionId(String code) { public AjaxResult getSessionId(String code) {
JSONObject object = memberWechatService.getSessionId(code);
if (object != null) {
String openId = object.getString("openid");
String sessionId = object.getString("session_key");
Map map = new HashMap();
map.put("openId", openId);
map.put("sessionId", sessionId);
return AjaxResult.successData(Base64Utils.encodeToString(JSON.toJSONString(map).getBytes()));
}
return AjaxResult.success(null);
}
@GetMapping("/no-auth/wechat/getSessionId2")
public AjaxResult getSessionId2(String code) {
JSONObject object = memberWechatService.getSessionId(code); JSONObject object = memberWechatService.getSessionId(code);
if (object != null) { if (object != null) {
String openId = object.getString("openid"); String openId = object.getString("openid");

Loading…
Cancel
Save