|
|
|
@ -26,6 +26,7 @@ public class MiniAppService {
|
|
|
|
|
MiniUserMapper miniUserMapper;
|
|
|
|
|
|
|
|
|
|
public MiniUser decryptUserInfo(String userId, String encryptedData, String iv, String signature, String rawData) {
|
|
|
|
|
System.out.println("-------------decryptUserInfo");
|
|
|
|
|
//todo sessionKeyId 查出 sessionKey
|
|
|
|
|
String sessionKey = getSessionKey(userId);
|
|
|
|
|
|
|
|
|
@ -69,13 +70,16 @@ public class MiniAppService {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public JSONObject isNewUser(String code) {
|
|
|
|
|
|
|
|
|
|
JSONObject jsonObject = new JSONObject();
|
|
|
|
|
try {
|
|
|
|
|
System.out.println("-------------isNewUser");
|
|
|
|
|
WxMaJscode2SessionResult sessionInfo = null;
|
|
|
|
|
try {
|
|
|
|
|
sessionInfo = wxService.getUserService().getSessionInfo(code);
|
|
|
|
|
} catch (WxErrorException e) {
|
|
|
|
|
throw new RuntimeException("获取openid失败", e);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
String sessionKey = sessionInfo.getSessionKey();
|
|
|
|
|
String openid = sessionInfo.getOpenid();
|
|
|
|
|
String unionid = sessionInfo.getUnionid();
|
|
|
|
@ -85,7 +89,7 @@ public class MiniAppService {
|
|
|
|
|
List<MiniUser> miniUsers = miniUserMapper.selectByMap(columnMap);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
JSONObject jsonObject = new JSONObject();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(miniUsers.size()==0){
|
|
|
|
|
MiniUser miniUser = new MiniUser();
|
|
|
|
@ -107,12 +111,15 @@ public class MiniAppService {
|
|
|
|
|
jsonObject.put("userId",miniUser.getId());
|
|
|
|
|
jsonObject.put("openId",openid);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}catch (Exception e){
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
}
|
|
|
|
|
return jsonObject;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public MiniUser decryptPhoneNumber(String userId,String encryptedData ,String ivStr,String signature,String rawData) {
|
|
|
|
|
|
|
|
|
|
System.out.println("-------------decryptPhoneNumber");
|
|
|
|
|
//todo sessionKeyId 查出 sessionKey
|
|
|
|
|
String sessionKey = getSessionKey(userId);
|
|
|
|
|
|
|
|
|
|