This commit is contained in:
2025-08-27 19:41:34 +08:00
parent 3de81956cb
commit 74e80584ca
3 changed files with 400 additions and 0 deletions

View File

@@ -0,0 +1,38 @@
package com.ruoyi.web.controller.jarvis;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.jarvis.service.IInstructionService;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.Map;
/**
* 指令执行控制器:将 jd/JDUtil 的指令处理迁移为 HTTP 接口
*/
@RestController
@RequestMapping("/jarvis/instruction")
public class InstructionController extends BaseController {
private final IInstructionService instructionService;
public InstructionController(IInstructionService instructionService) {
this.instructionService = instructionService;
}
/**
* 执行文本指令
* body: { command: "京今日统计" }
*/
@PostMapping("/execute")
public AjaxResult execute(@RequestBody Map<String, String> body) {
String cmd = body != null ? body.get("command") : null;
String result = instructionService.execute(cmd);
return AjaxResult.success(result);
}
}