This commit is contained in:
van
2026-04-01 01:57:19 +08:00
parent 9f3fb23a91
commit f2f6d02b2f
13 changed files with 347 additions and 0 deletions

View File

@@ -0,0 +1,41 @@
package com.ruoyi.web.controller.jarvis;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.jarvis.domain.dto.WeComInboundRequest;
import com.ruoyi.jarvis.service.IWeComInboundService;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.HashMap;
import java.util.Map;
/**
* wxSend 企微回调桥接HTTPS + 共享密钥,无登录态
*/
@RestController
@RequestMapping("/jarvis/wecom")
public class WeComInboundController {
public static final String HEADER_SECRET = "X-Jarvis-WeCom-Secret";
@Value("${jarvis.wecom.inbound-secret:}")
private String inboundSecret;
@Resource
private IWeComInboundService weComInboundService;
@PostMapping("/inbound")
public AjaxResult inbound(
@RequestHeader(value = HEADER_SECRET, required = false) String secret,
@RequestBody WeComInboundRequest body) {
if (!StringUtils.hasText(inboundSecret) || !inboundSecret.equals(secret)) {
return AjaxResult.error("拒绝访问");
}
String reply = weComInboundService.handleInbound(body != null ? body : new WeComInboundRequest());
Map<String, Object> data = new HashMap<>(2);
data.put("reply", reply != null ? reply : "");
return AjaxResult.success(data);
}
}

View File

@@ -205,6 +205,9 @@ jarvis:
# 获取评论接口服务地址(后端转发,避免前端跨域)
fetch-comments:
base-url: http://192.168.8.60:5008
# 企微经 wxSend 调用本接口时校验(须与 wxSend 配置一致)
wecom:
inbound-secret: jarvis_wecom_bridge_change_me
# Ollama 大模型服务(监控健康度调试用)
ollama:
base-url: http://192.168.8.34:11434

View File

@@ -205,6 +205,8 @@ jarvis:
# 获取评论接口服务地址(后端转发)
fetch-comments:
base-url: http://192.168.8.60:5008
wecom:
inbound-secret: jarvis_wecom_bridge_change_me
# Ollama 大模型服务(监控健康度调试用)
ollama:
base-url: http://192.168.8.34:11434