|
|
|
@ -57,6 +57,21 @@ public class ShopAuthCallbackService extends SPIBaseService implements Extension
|
|
|
|
|
String msg = bodyObj.getString("msg");
|
|
|
|
|
JSONObject msgObj = JSONObject.parseObject(msg);
|
|
|
|
|
Long shopId = msgObj.getLong("shop_id");
|
|
|
|
|
String code = msgObj.getString("code");
|
|
|
|
|
String shopName = "";
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
TokenCreateRequest request = new TokenCreateRequest();
|
|
|
|
|
TokenCreateParam param = request.getParam();
|
|
|
|
|
param.setCode(code);
|
|
|
|
|
param.setGrantType("authorization_code");
|
|
|
|
|
log.info("create token response: " + JSON.toJSONString(param));
|
|
|
|
|
TokenCreateResponse response = request.execute();
|
|
|
|
|
TokenCreateData tokenCreateData = response.getData();
|
|
|
|
|
shopName = tokenCreateData.getShopName();
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
log.error("获取商户信息失败", e);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Shop shop = shopService.getDetailById(shopId);
|
|
|
|
|
if (Objects.isNull(shop)) {
|
|
|
|
@ -64,10 +79,10 @@ public class ShopAuthCallbackService extends SPIBaseService implements Extension
|
|
|
|
|
shop.setShopId(shopId);
|
|
|
|
|
shop.setGmtCreate(new Date());
|
|
|
|
|
shop.setGmtModified(new Date());
|
|
|
|
|
shop.setShopName(shopName);
|
|
|
|
|
shopService.insert(shop);
|
|
|
|
|
|
|
|
|
|
// TODO 创建素材文件夹
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 按照三方平台的规范返回成功或失败的body值
|
|
|
|
|