| | |
| | | import cn.binarywang.wx.miniapp.api.WxMaUserService; |
| | | import cn.binarywang.wx.miniapp.bean.WxMaJscode2SessionResult; |
| | | import cn.binarywang.wx.miniapp.bean.WxMaPhoneNumberInfo; |
| | | import cn.hutool.core.util.RandomUtil; |
| | | import cn.hutool.http.HttpRequest; |
| | | import com.alibaba.fastjson2.JSONObject; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | |
| | | } |
| | | if (session != null && StringUtils.isNotBlank(session.getOpenid())) { |
| | | String openid = session.getOpenid(); |
| | | // String sessionKey = session.getSessionKey(); |
| | | /*String sessionKey = session.getSessionKey(); |
| | | // 加密明文及初始向量转义 |
| | | // encryptedData = URLEncoder.encode(encryptedData, "UTF-8").replace("%3D", "=").replace("%2F", "/"); |
| | | // ivStr = URLEncoder.encode(ivStr, "UTF-8").replace("%3D", "=").replace("%2F", "/"); |
| | | // // 获取用户信息 |
| | | // String result = WxAesUtils.decryptData(WxAesUtils.getUrlDecoderString(encryptedData), |
| | | // sessionKey, |
| | | // WxAesUtils.getUrlDecoderString(ivStr)); |
| | | // JSONObject userJson = JSONObject.parseObject(result); |
| | | encryptedData = URLEncoder.encode(encryptedData, "UTF-8").replace("%3D", "=").replace("%2F", "/"); |
| | | ivStr = URLEncoder.encode(ivStr, "UTF-8").replace("%3D", "=").replace("%2F", "/"); |
| | | // 获取用户信息 |
| | | String result = WxAesUtils.decryptData(WxAesUtils.getUrlDecoderString(encryptedData), |
| | | sessionKey, |
| | | WxAesUtils.getUrlDecoderString(ivStr)); |
| | | JSONObject userJson = JSONObject.parseObject(result);*/ |
| | | // 封装项目用户信息 |
| | | if (null != phoneNoInfo) { |
| | | String phoneNumber = phoneNoInfo.getPhoneNumber(); |
| | |
| | | .eq(User::getIsDelete, 0).one(); |
| | | if (null == user) { |
| | | user = new User(); |
| | | user.setUserNo(String.format(Constants.USER_NO_PRE, RandomUtil.randomNumbers(Constants.EIGHT))); |
| | | user.setUserNo(String.format(Constants.USER_NO_PRE, StringUtils.getCharAndNum(Constants.SIX))); |
| | | user.setPhone(phoneNumber); |
| | | user.setState(Constants.ONE); |
| | | user.setOpenId(openid); |