|
|
@ -139,12 +139,14 @@ public class ComponentVerifyTicketServiceImpl implements ComponentVerifyTicketSe |
|
|
|
break; |
|
|
|
case ModuleConstant.AUTHORIZED: //授权成功
|
|
|
|
// 更改customer_mp 授权信息,appId,并绑定
|
|
|
|
String authAppId = result.get(ModuleConstant.APP_ID); |
|
|
|
// String authAppId = result.get(ModuleConstant.APP_ID);
|
|
|
|
String authCode = result.get(ModuleConstant.AUTHORIZATION_CODE_HUMP); |
|
|
|
log.info("=============================="+authCode); |
|
|
|
AuthCodeResultDTO authCodeResultDTO = authCodeDao.selectCustomerIdByAuthCode(authCode); |
|
|
|
String clientType = authCodeResultDTO.getClientType(); |
|
|
|
String customerId = authCodeResultDTO.getCustomerId(); |
|
|
|
Map<String, Object> authorizerRefreshToken = redisThird.getAuthorizerRefreshToken(customerId + ThirdRedisKeyConstant.COLON + clientType); |
|
|
|
String authAppId = authorizerRefreshToken.get("authorizerAppid").toString(); |
|
|
|
this.updateCustomerMpAppIdAndCreateOpenPlatform(customerId,authAppId,clientType); |
|
|
|
// this.authInfoByAuthCode(authCode, customerId,clientType);
|
|
|
|
authCodeDao.updateAppId(customerId,clientType,authAppId); |
|
|
@ -501,14 +503,14 @@ public class ComponentVerifyTicketServiceImpl implements ComponentVerifyTicketSe |
|
|
|
Integer authCount = customerMpDao.selectAuthCount(customerId); |
|
|
|
String openPlatformId = null; |
|
|
|
Map<String, Object> authorizerRefreshToken = redisThird.getAuthorizerRefreshToken(customerId + ThirdRedisKeyConstant.COLON + clientType); |
|
|
|
AuthorizationInfoResultDTO authorizationInfo = this.mapToEntity(authorizerRefreshToken, AuthorizationInfoResultDTO.class); |
|
|
|
String authorizerAccessToken = authorizerRefreshToken.get("authorizerAccessToken").toString(); |
|
|
|
if (authCount==NumConstant.ZERO){ |
|
|
|
log.info("未查询到该客户授权信息,先创建开放平台账号,再绑定"); |
|
|
|
//没有任何一个小程序/公众号授权,【先创建,再绑定】
|
|
|
|
JSONObject jsonObject = new JSONObject(); |
|
|
|
jsonObject.put(ModuleConstant.APP_ID,authAppId); |
|
|
|
jsonObject.put(ModuleConstant.LOW_APP_ID,authAppId); |
|
|
|
// 此处的 access_token 为 【authorizer_access_token】
|
|
|
|
String data = HttpClientManager.getInstance().sendPostByJSON(WxMaCodeConstant.API_CREATE_OPEN + authorizationInfo.getAuthorizer_access_token(), JSON.toJSONString(jsonObject)).getData(); |
|
|
|
String data = HttpClientManager.getInstance().sendPostByJSON(WxMaCodeConstant.API_CREATE_OPEN + authorizerAccessToken, JSON.toJSONString(jsonObject)).getData(); |
|
|
|
Map<String,String> map = JSON.parseObject(data, Map.class); |
|
|
|
CreateOpenResultDTO createOpen = new CreateOpenResultDTO(); |
|
|
|
createOpen.setErrCode(Integer.valueOf(map.get(ModuleConstant.ERR_CODE))); |
|
|
|