授权回调结构修改

ljl-dsPurchaseOrder
cxxxxxxx详 1 year ago
parent acd1c9ad71
commit 471987a666

@ -5,8 +5,8 @@ curl --location --request POST 'localhost:8080/base/cloud/spi' \
--data-raw '{ --data-raw '{
"appId":"7264840234423027259", "appId":"7264840234423027259",
"authId":"4463798", "authId":"4463798",
"method":"testSpi", "method":"memberAuthCallBack",
"data":"{\"moveCollectTaskDetailIds\":[26],\"deleteOnSaleProduct\":0,\"deleteProduct\":0}" "data":"{\"url\":\"/api/open/lightapp/callback/1688/7264840234423027259/memberAuthCallBack\",\"body\":\"{\\\"userId\\\":\\\"111087462\\\",\\\"cnaliMemberId\\\":\\\"b2b-6848123449731a\\\",\\\"authCode\\\":\\\"NGVkNWM1NjctNzYxMy01YWIwLWI5MDUtMmFhYjYwZGFiYzI5\\\",\\\"gmtMemberExpireTime\\\":\\\"2023-12-21 23:59:59\\\",\\\"type\\\":\\\"auth\\\"}\"}"
}' }'

@ -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));

Loading…
Cancel
Save