From a7998050aed9ce6f4e3ab32e8bfe4148bdb0aca2 Mon Sep 17 00:00:00 2001 From: wanjia <553039491@qq.com> Date: Wed, 29 Mar 2023 18:07:04 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E6=B3=A8=E5=86=8Cbot?= =?UTF-8?q?=E6=97=B6=EF=BC=8C=E5=90=8C=E6=AD=A5=E8=B0=83=E7=94=A8gitlink?= =?UTF-8?q?=20api=20=E6=9B=B4=E6=96=B0=E5=9B=9E=E8=B0=83=E5=9C=B0=E5=9D=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../gitlink/softbot/service/user/impl/UserService.java | 4 ++++ src/main/java/com/gitlink/softbot/utils/GitLinkApi.java | 8 ++++++++ 2 files changed, 12 insertions(+) diff --git a/src/main/java/com/gitlink/softbot/service/user/impl/UserService.java b/src/main/java/com/gitlink/softbot/service/user/impl/UserService.java index 53a4876..d130353 100644 --- a/src/main/java/com/gitlink/softbot/service/user/impl/UserService.java +++ b/src/main/java/com/gitlink/softbot/service/user/impl/UserService.java @@ -196,6 +196,10 @@ public class UserService extends AbstractUserBot implements IUserService { marketBotMapper.updateById(marketBot); } botMapper.updateById(updateBot); + //同步更新回调地址 + Response response = api.updateCallbackUrl(botInputVO.getUserId(), updateBot.getId()); + //校验异常 + checkException(response); }catch (DuplicateKeyException e){ throw new BotException("Bot更新失败!"); } diff --git a/src/main/java/com/gitlink/softbot/utils/GitLinkApi.java b/src/main/java/com/gitlink/softbot/utils/GitLinkApi.java index 05677c0..afb1877 100644 --- a/src/main/java/com/gitlink/softbot/utils/GitLinkApi.java +++ b/src/main/java/com/gitlink/softbot/utils/GitLinkApi.java @@ -121,6 +121,14 @@ public class GitLinkApi { return response; } + public Response updateCallbackUrl(Integer uid, Integer botId) { + Map inputParams = new HashMap<>(); + inputParams.put("uid", uid.toString()); + Object[] params = new Object[]{botId.toString()}; + Response response = RestTemplateUtil.httpRequest(restTemplate, HttpMethod.POST, URL+"/app", params, "/update_callback_url" , inputParams, null ,getHeader()); + return response; + } + // public Response activeBotAuth(Integer uid, Integer botId){ // Map inputParams = new HashMap<>(); // inputParams.put("uid", uid.toString());