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