QQBot/src/main/java/com/yutou/qqbot/QQBotController.java
Yutousama f4733ab9bc 修复Linux下无法使用浏览器的问题
修复无权用户无法访问公开模块的问题
2021-12-09 02:50:53 +08:00

37 lines
1.1 KiB
Java

package com.yutou.qqbot;
import com.yutou.qqbot.utlis.AppTools;
import com.yutou.qqbot.utlis.RedisTools;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import javax.servlet.http.HttpServletRequest;
import java.io.IOException;
@Controller
public class QQBotController {
@ResponseBody
@RequestMapping("/tools/openpc.do")
public String open_pc(HttpServletRequest request, String type) {
if ("nas".equals(type)) {
try {
Process process = Runtime.getRuntime().exec("wakeonlan 00:D8:61:6F:02:2F");
RedisTools.processOut(process.getInputStream());
RedisTools.processOut(process.getErrorStream());
process.destroy();
} catch (IOException e) {
e.printStackTrace();
}
}
return "ok";
}
@ResponseBody
@RequestMapping("/tools/server.do")
public String sendServerManager(String title, String msg) {
AppTools.sendServer(title, msg);
return "ok";
}
}