@ -1,6 +1,7 @@
package com.ms.api.spi.callback ;
package com.ms.api.spi.callback ;
import com.alibaba.fastjson.JSON ;
import com.alibaba.fastjson.JSON ;
import com.alibaba.fastjson.JSONObject ;
import com.doudian.open.api.token_create.TokenCreateRequest ;
import com.doudian.open.api.token_create.TokenCreateRequest ;
import com.doudian.open.api.token_create.TokenCreateResponse ;
import com.doudian.open.api.token_create.TokenCreateResponse ;
import com.doudian.open.api.token_create.data.TokenCreateData ;
import com.doudian.open.api.token_create.data.TokenCreateData ;
@ -45,24 +46,24 @@ public class MemberAuthCallbackService extends SPIBaseService implements Extensi
MemberAuthCallBackRequestDTO fields = req . getData ( ) ;
MemberAuthCallBackRequestDTO fields = req . getData ( ) ;
log . info ( "receive callback: " + JSON . toJSONString ( fields ) ) ;
log . info ( "receive callback: " + JSON . toJSONString ( fields ) ) ;
String body = fields . getBody ( ) ;
String body = fields . getBody ( ) ;
// String body = "userId=4463798&cnaliMemberId=b2b-221123084407697b20&authCode=NGNiYzEyODUtNzFhOS01ZmIwLWE5MDEtYzI3ZTAyYWFjOTA3&gmtMemberExpireTime=2023-11-13+23%3A59%3A59&type=auth";
// String body = "{\"userId\":\"111087462\",\"cnaliMemberId\":\"b2b-6848123449731a\",\"authCode\":\"NGVkNWM1NjctNzYxMy01YWIwLWI5MDUtMmFhYjYwZGFiYzI5\",\"gmtMemberExpireTime\":\"2023-12-21 23:59:59\",\"type\":\"auth\"}";
Map < String , String > map = new HashMap < String , String > ( ) ;
// ----逻辑校验----
// ----逻辑校验----
// ----业务处理----
// ----业务处理----
try {
try {
final String charset = "utf-8" ;
// final String charset = "utf-8";
String contents = URLDecoder . decode ( body , charset ) ;
// String contents = URLDecoder.decode(body, charset);
String [ ] keyValues = contents . split ( "&" ) ;
// String[] keyValues = contents.split("&");
for ( int i = 0 ; i < keyValues . length ; i + + ) {
// for (int i = 0; i < keyValues.length; i++) {
String key = keyValues [ i ] . substring ( 0 , keyValues [ i ] . indexOf ( "=" ) ) ;
// String key = keyValues[i].substring(0, keyValues[i].indexOf("="));
String value = keyValues [ i ] . substring ( keyValues [ i ] . indexOf ( "=" ) + 1 ) ;
// String value = keyValues[i].substring(keyValues[i].indexOf("=") + 1);
map . put ( key , value ) ;
// map.put(key, value);
}
// }
String authCode = map . get ( "authCode" ) ;
JSONObject map = JSONObject . parseObject ( body ) ;
String cnaliMemberId = map . get ( "cnaliMemberId" ) ;
String authCode = map . getString ( "authCode" ) ;
String gmtMemberExpireTime = map . get ( "gmtMemberExpireTime" ) ;
String cnaliMemberId = map . getString ( "cnaliMemberId" ) ;
String userId = map . get ( "userId" ) ;
String gmtMemberExpireTime = map . getString ( "gmtMemberExpireTime" ) ;
String userId = map . getString ( "userId" ) ;
this . authCode = fields . getAuthCode ( ) ;
this . authCode = fields . getAuthCode ( ) ;
Shop1688DsAuth shop1688DsAuth = shop1688DsAuthService . getDetailByShopId ( Long . valueOf ( userId ) ) ;
Shop1688DsAuth shop1688DsAuth = shop1688DsAuthService . getDetailByShopId ( Long . valueOf ( userId ) ) ;