预备开门页面及接口
This commit is contained in:
parent
a73a5b34e2
commit
edfddd7e17
@ -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
1
web/layui/css/layui.css
Normal file
File diff suppressed because one or more lines are too long
1
web/layui/css/modules/code.css
Normal file
1
web/layui/css/modules/code.css
Normal 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}
|
1
web/layui/css/modules/laydate/default/laydate.css
Normal file
1
web/layui/css/modules/laydate/default/laydate.css
Normal file
File diff suppressed because one or more lines are too long
BIN
web/layui/css/modules/layer/default/icon-ext.png
Normal file
BIN
web/layui/css/modules/layer/default/icon-ext.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 5.8 KiB |
BIN
web/layui/css/modules/layer/default/icon.png
Normal file
BIN
web/layui/css/modules/layer/default/icon.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 11 KiB |
1
web/layui/css/modules/layer/default/layer.css
Normal file
1
web/layui/css/modules/layer/default/layer.css
Normal file
File diff suppressed because one or more lines are too long
BIN
web/layui/css/modules/layer/default/loading-0.gif
Normal file
BIN
web/layui/css/modules/layer/default/loading-0.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 5.7 KiB |
BIN
web/layui/css/modules/layer/default/loading-1.gif
Normal file
BIN
web/layui/css/modules/layer/default/loading-1.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 701 B |
BIN
web/layui/css/modules/layer/default/loading-2.gif
Normal file
BIN
web/layui/css/modules/layer/default/loading-2.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.7 KiB |
BIN
web/layui/font/iconfont.eot
Normal file
BIN
web/layui/font/iconfont.eot
Normal file
Binary file not shown.
554
web/layui/font/iconfont.svg
Normal file
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
BIN
web/layui/font/iconfont.ttf
Normal file
Binary file not shown.
BIN
web/layui/font/iconfont.woff
Normal file
BIN
web/layui/font/iconfont.woff
Normal file
Binary file not shown.
BIN
web/layui/font/iconfont.woff2
Normal file
BIN
web/layui/font/iconfont.woff2
Normal file
Binary file not shown.
10253
web/layui/jquery-3.2.1.js
vendored
Normal file
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
5
web/layui/layui.js
Normal file
File diff suppressed because one or more lines are too long
55
web/openDoor.html
Normal file
55
web/openDoor.html
Normal 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">
|
||||
开 门
|
||||
</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>
|
Loading…
Reference in New Issue
Block a user