预备开门页面及接口
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package com.yutou.qqbot.Controllers;
|
||||
|
||||
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;
|
||||
@@ -9,8 +10,37 @@ import org.springframework.web.bind.annotation.ResponseBody;
|
||||
public class AppController {
|
||||
@RequestMapping("/restart.do")
|
||||
@ResponseBody
|
||||
public String restart(){
|
||||
AppTools.exec("cd /home/yutou/public/servier/qqbot && ./start.sh",null,true,false);
|
||||
public String restart() {
|
||||
AppTools.exec("cd /home/yutou/public/servier/qqbot && ./start.sh", null, true, false);
|
||||
return "";
|
||||
}
|
||||
|
||||
@ResponseBody
|
||||
@RequestMapping("/door/set.do")
|
||||
public String openDoor(String status) {
|
||||
RedisTools.set("door", status);
|
||||
return "1";
|
||||
}
|
||||
|
||||
@ResponseBody
|
||||
@RequestMapping("/door/get.do")
|
||||
public String getDoor() {
|
||||
if ("open".equals(RedisTools.get("door"))) {
|
||||
RedisTools.set("door", "on");
|
||||
return "1";
|
||||
}
|
||||
return "0";
|
||||
}
|
||||
|
||||
@ResponseBody
|
||||
@RequestMapping("/door/status.do")
|
||||
public String getStatus() {
|
||||
String status = RedisTools.get("door");
|
||||
if ("open".equals(status)) {
|
||||
return "0";
|
||||
} else if ("on".equals(status)) {
|
||||
return "1";
|
||||
}
|
||||
return "-1";
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user