37 lines
1.1 KiB
Java
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";
|
|
}
|
|
}
|