1
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user