回调路径修改
This commit is contained in:
1 parent
9a1bc6b8dc
commit
2316d48224
1 file changed
+22
-2
+22
-2
@@ -1,3 +1,23 @@
|
|||||||
package com.ruoyi.system.controller;
|
package com.ruoyi.system.controller;
|
||||||
import com.alibaba.fastjson.JSONObject; import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.system.service.TelegramAuditService; import org.springframework.web.bind.annotation.*;
|
|
||||||
@RestController @RequestMapping("/api/telegram") public class TelegramAuditController { private final TelegramAuditService service; public TelegramAuditController(TelegramAuditService s){service=s;} @PostMapping("/webhook") public AjaxResult webhook(@RequestHeader(value="X-Telegram-Bot-Api-Secret-Token",required=false)String secret,@RequestBody JSONObject update){if(!service.matchesSecret(secret))return AjaxResult.error("非法请求");service.handleUpdate(update);return AjaxResult.success();} }
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import com.ruoyi.common.core.domain.AjaxResult;
|
||||||
|
import com.ruoyi.system.service.TelegramAuditService;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/auth/telegram")
|
||||||
|
public class TelegramAuditController {
|
||||||
|
private final TelegramAuditService service;
|
||||||
|
|
||||||
|
public TelegramAuditController(TelegramAuditService s) {
|
||||||
|
service = s;
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping("/webhook")
|
||||||
|
public AjaxResult webhook(@RequestHeader(value = "X-Telegram-Bot-Api-Secret-Token", required = false) String secret, @RequestBody JSONObject update) {
|
||||||
|
if (!service.matchesSecret(secret)) return AjaxResult.error("非法请求");
|
||||||
|
service.handleUpdate(update);
|
||||||
|
return AjaxResult.success();
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in new issue
Block a user