|
|
|
@ -23,6 +23,8 @@ import com.ms.dal.entity.ShopTo1688DsMember;
|
|
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
|
|
|
|
|
import java.net.URLDecoder;
|
|
|
|
|
import java.util.HashMap;
|
|
|
|
|
import java.util.Map;
|
|
|
|
|
import java.util.Objects;
|
|
|
|
|
|
|
|
|
@ -41,21 +43,36 @@ public class MemberAuthCallback extends SPIBaseService implements ExtensionServi
|
|
|
|
|
// ----参数校验----
|
|
|
|
|
MemberAuthCallBackRequestDTO fields = req.getData();
|
|
|
|
|
log.info("receive callback: " + JSON.toJSONString(fields));
|
|
|
|
|
authCode = fields.getAuthCode();
|
|
|
|
|
String body = "userId=gfZbbg6BSAlPMmw75xlCzQ%3D%3D&cnaliMemberId=b2b-221123084407697b20&authCode=NGNiYzEyODUtNzFhOS01ZmIwLWE5MDEtYzI3ZTAyYWFjOTA2&gmtMemberExpireTime=2023-11-13+23%3A59%3A59&type=auth";
|
|
|
|
|
|
|
|
|
|
Map<String, String> map = new HashMap<String, String>();
|
|
|
|
|
// ----逻辑校验----
|
|
|
|
|
|
|
|
|
|
// ----业务处理----
|
|
|
|
|
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");
|
|
|
|
|
this.authCode = fields.getAuthCode();
|
|
|
|
|
log.info(map.toString());
|
|
|
|
|
|
|
|
|
|
Shop1688DsAuth shop1688DsAuth = new Shop1688DsAuth();
|
|
|
|
|
shop1688DsAuth.setAuthCode(fields.getAuthCode());
|
|
|
|
|
shop1688DsAuth.setAuthCode(authCode);
|
|
|
|
|
shop1688DsAuth.setShopId(shopId);
|
|
|
|
|
shop1688DsAuthService.insert(shop1688DsAuth);
|
|
|
|
|
|
|
|
|
|
ShopTo1688DsMember shopTo1688DsMember= new ShopTo1688DsMember();
|
|
|
|
|
shopTo1688DsMember.setCnaliMemberId(fields.getCnaliMemberId());
|
|
|
|
|
shopTo1688DsMember.setCnaliMemberId(cnaliMemberId);
|
|
|
|
|
shopTo1688DsMember.setShopId(shopId);
|
|
|
|
|
shopTo1688DsMember.setGmtExpire(fields.getGmtMemberExpireTime());
|
|
|
|
|
shopTo1688DsMember.setGmtExpire(gmtMemberExpireTime);
|
|
|
|
|
shopTo1688DsMemberService.insert(shopTo1688DsMember);
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
log.error(e.getMessage());
|
|
|
|
|