|
|
|
@ -1,5 +1,6 @@
|
|
|
|
|
package com.jingcheng.template.service.impl;
|
|
|
|
|
|
|
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
|
|
import com.jingcheng.template.mapper.*;
|
|
|
|
|
import com.jingcheng.template.model.*;
|
|
|
|
@ -9,6 +10,7 @@ import org.apache.commons.lang3.StringUtils;
|
|
|
|
|
import org.apache.shiro.SecurityUtils;
|
|
|
|
|
import org.apache.shiro.subject.Subject;
|
|
|
|
|
import org.slf4j.Logger;
|
|
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
|
|
|
@ -20,6 +22,12 @@ import javax.servlet.http.HttpServletRequest;
|
|
|
|
|
public class UsersServiceImpl extends BaseServiceImpl<UsersMapper, Users> implements UsersService<Users> {
|
|
|
|
|
@Resource
|
|
|
|
|
UsersMapper usersMapper;
|
|
|
|
|
@Value("${weixin.accessTokenUrl}")
|
|
|
|
|
private String accessTokenUrl;
|
|
|
|
|
@Value("${weixin.appId}")
|
|
|
|
|
private String appId;
|
|
|
|
|
@Value("${weixin.appSecret}")
|
|
|
|
|
private String appSecret;
|
|
|
|
|
|
|
|
|
|
Logger logger = LogUtils.getBussinessLogger();
|
|
|
|
|
public Users selectByUserNoOrOpenId(String key) {
|
|
|
|
@ -102,6 +110,17 @@ public class UsersServiceImpl extends BaseServiceImpl<UsersMapper, Users> implem
|
|
|
|
|
return ajaxResult;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public AjaxResult registWxUser(String code) {
|
|
|
|
|
AjaxResult ajaxResult = new AjaxResult();
|
|
|
|
|
String getAccessTokenUrl = accessTokenUrl + appId + "&secret=" + appSecret +
|
|
|
|
|
"&code=" + code + "&grant_type=authorization_code";
|
|
|
|
|
String accessTokenResult = HttpRequestUtils.sendGet(getAccessTokenUrl);
|
|
|
|
|
String openId = JSON.parseObject(accessTokenResult).getString("openid");
|
|
|
|
|
String accessToken = JSON.parseObject(accessTokenResult).getString("access_token");
|
|
|
|
|
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|