预备开门页面及接口

This commit is contained in:
Yutousama 2021-12-20 00:47:02 +08:00
parent a73a5b34e2
commit edfddd7e17
18 changed files with 10903 additions and 2 deletions

View File

@ -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;
@ -13,4 +14,33 @@ public class AppController {
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";
}
}

1
web/layui/css/layui.css Normal file

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1 @@
html #layuicss-skincodecss{display:none;position:absolute;width:1989px}.layui-code-h3,.layui-code-view{position:relative;font-size:12px}.layui-code-view{display:block;margin:10px 0;padding:0;border:1px solid #eee;border-left-width:6px;background-color:#FAFAFA;color:#333;font-family:Courier New}.layui-code-h3{padding:0 10px;height:40px;line-height:40px;border-bottom:1px solid #eee}.layui-code-h3 a{position:absolute;right:10px;top:0;color:#999}.layui-code-view .layui-code-ol{position:relative;overflow:auto}.layui-code-view .layui-code-ol li{position:relative;margin-left:45px;line-height:20px;padding:0 10px;border-left:1px solid #e2e2e2;list-style-type:decimal-leading-zero;*list-style-type:decimal;background-color:#fff}.layui-code-view .layui-code-ol li:first-child{padding-top:10px}.layui-code-view .layui-code-ol li:last-child{padding-bottom:10px}.layui-code-view pre{margin:0}.layui-code-notepad{border:1px solid #0C0C0C;border-left-color:#3F3F3F;background-color:#0C0C0C;color:#C2BE9E}.layui-code-notepad .layui-code-h3{border-bottom:none}.layui-code-notepad .layui-code-ol li{background-color:#3F3F3F;border-left:none}.layui-code-demo .layui-code{visibility:visible!important;margin:-15px;border-top:none;border-right:none;border-bottom:none}.layui-code-demo .layui-tab-content{padding:15px;border-top:none}

File diff suppressed because one or more lines are too long

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

File diff suppressed because one or more lines are too long

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 701 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

BIN
web/layui/font/iconfont.eot Normal file

Binary file not shown.

554
web/layui/font/iconfont.svg Normal file

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 299 KiB

BIN
web/layui/font/iconfont.ttf Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

10253
web/layui/jquery-3.2.1.js vendored Normal file

File diff suppressed because it is too large Load Diff

5
web/layui/layui.js Normal file

File diff suppressed because one or more lines are too long

55
web/openDoor.html Normal file
View File

@ -0,0 +1,55 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>开门</title>
<link rel="stylesheet" href="layui/css/layui.css">
</head>
<body>
<div class="myDiy">
<button id="myButton" type="button" class="button layui-btn-radius layui-btn layui-btn-lg layui-btn-normal">
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</button>
</div>
</body>
<script src="layui/layui.js"></script>
<script src="layui/jquery-3.2.1.js"></script>
<script>
$('#myButton').click(function () {
$.get('/door/set.do?status=open', function (ret) {
if (ret === "1") {
let index = layer.load(2,{ shade: [0.45, '#57606f'] });
load(index)
}
})
})
function load(index) {
$.get("/door/status.do", function (ret) {
if(ret==="1"){
layer.close(index)
layer.msg("已开门")
}else {
load(index)
}
});
}
</script>
<style>
.myDiy {
width: 40%;
height: 300px;
margin-top: 35%;
margin-left: 35%;
}
.button {
width: 300px;
height: 300px;
font-size: 3em;
}
</style>
</html>