|
|
@@ -1,9 +1,9 @@
|
|
|
package com.izouma.awesomeadmin.service.impl;
|
|
|
|
|
|
-import cn.binarywang.wx.miniapp.api.WxMaService;
|
|
|
import cn.binarywang.wx.miniapp.bean.WxMaJscode2SessionResult;
|
|
|
import cn.binarywang.wx.miniapp.bean.WxMaUserInfo;
|
|
|
import com.izouma.awesomeadmin.constant.AppConstant;
|
|
|
+import com.izouma.awesomeadmin.container.WeixinConfig;
|
|
|
import com.izouma.awesomeadmin.dao.*;
|
|
|
import com.izouma.awesomeadmin.dto.Page;
|
|
|
import com.izouma.awesomeadmin.dto.Result;
|
|
|
@@ -65,8 +65,7 @@ public class UserInfoServiceImpl implements UserInfoService {
|
|
|
private RecommenderLogMapper recommenderLogMapper;
|
|
|
|
|
|
|
|
|
- @Autowired(required = false)
|
|
|
- private WxMaService wxMaService;
|
|
|
+ private WeixinConfig weixinConfig;
|
|
|
|
|
|
@Override
|
|
|
public List<UserInfo> getUserInfoList(UserInfo record) {
|
|
|
@@ -603,7 +602,7 @@ public class UserInfoServiceImpl implements UserInfoService {
|
|
|
@Override
|
|
|
public UserInfo loginMiniApp(String code) {
|
|
|
try {
|
|
|
- WxMaJscode2SessionResult result = wxMaService.jsCode2SessionInfo(code);
|
|
|
+ WxMaJscode2SessionResult result = weixinConfig.wxMaService().jsCode2SessionInfo(code);
|
|
|
String openId = result.getOpenid();
|
|
|
String sessionKey = result.getSessionKey();
|
|
|
|
|
|
@@ -636,12 +635,12 @@ public class UserInfoServiceImpl implements UserInfoService {
|
|
|
public Result getMiniAppUserInfo(String sessionKey, String rawData, String signature,
|
|
|
String encryptedData, String iv) {
|
|
|
// 用户信息校验
|
|
|
- if (!wxMaService.getUserService().checkUserInfo(sessionKey, rawData, signature)) {
|
|
|
+ if (!weixinConfig.wxMaService().getUserService().checkUserInfo(sessionKey, rawData, signature)) {
|
|
|
return new Result(false, "获取用户信息失败");
|
|
|
}
|
|
|
|
|
|
// 解密用户信息
|
|
|
- WxMaUserInfo wxUserInfo = wxMaService.getUserService().getUserInfo(sessionKey, encryptedData, iv);
|
|
|
+ WxMaUserInfo wxUserInfo = weixinConfig.wxMaService().getUserService().getUserInfo(sessionKey, encryptedData, iv);
|
|
|
|
|
|
UserInfo userInfo = new UserInfo();
|
|
|
userInfo.setOpenId(wxUserInfo.getOpenId());
|