From b6b6abc068abe7e65b0114c14f245ade7776c6f2 Mon Sep 17 00:00:00 2001 From: wangchaoxu Date: Thu, 21 Sep 2023 17:29:01 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8A=A0=E5=95=86=E6=88=B7=E5=90=8D=E7=A7=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../spi/callback/ShopAuthCallbackService.java | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/ms-biz/src/main/java/com/ms/api/spi/callback/ShopAuthCallbackService.java b/ms-biz/src/main/java/com/ms/api/spi/callback/ShopAuthCallbackService.java index e9efd180..97e565b8 100644 --- a/ms-biz/src/main/java/com/ms/api/spi/callback/ShopAuthCallbackService.java +++ b/ms-biz/src/main/java/com/ms/api/spi/callback/ShopAuthCallbackService.java @@ -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值