Merge branch 'whb' into jieling

master
whb 2021-02-23 11:02:47 +08:00
commit 4f98606c22
2 changed files with 40 additions and 32 deletions

View File

@ -37,7 +37,6 @@ public class GmController {
@RequestMapping(value = "/sendGm", method = {RequestMethod.POST, RequestMethod.GET})
public @ResponseBody
int publishNotice(HttpServletRequest request) throws Exception {
List<ServerInfo> allServerInfo = serverInfoDao.getAllServerInfo();
List<String> serverList = new ArrayList<>();
@ -45,15 +44,14 @@ public class GmController {
serverList.add(serverInfo.getServer_id());
}
String content = request.getParameter("content1");
String content = request.getParameter("content");
String[] serverId = request.getParameterValues("serverId[]");
String cmd = content;
for (String s:serverId){
System.out.println(s);
}
/*for (String str : serverId) {
for (String str : serverId) {
if (!serverList.contains(str)) {
continue;
@ -82,7 +80,7 @@ public class GmController {
e.printStackTrace();
return 1;
}
}*/
}
return 0;
}

View File

@ -1,6 +1,6 @@
<!--_meta 作为公共模版分离出去-->
<!DOCTYPE HTML>
<html xmlns:th="http://www.springframework.org/schema/jdbc">
<html xmlns:th="http://www.thymeleaf.org">
<head>
<meta charset="utf-8"/>
<meta name="renderer" content="webkit|ie-comp|ie-stand"/>
@ -62,18 +62,42 @@
发送GM
<a class="btn btn-success radius r" style="line-height:1.6em;margin-top:3px" href="javascript:location.replace(location.href);" title="刷新" ><i class="Hui-iconfont">&#xe68f;</i></a>
</nav>
<div id="all">
<div class="page-container">
</div>
<div id="my">
<div class="row cl">
<label class="form-label col-xs-4 col-sm-2">
<span class="c-red">*</span>
服务器id</label>
<div>
<input type='checkbox' id='selectAll' >全选
</div>
<div class="formControls col-xs-8 col-sm-9">
<div th:each="obj:${serverInfo}" >
<input th:text="${obj.server_id}" type='checkbox' name='serverId' th:value="${obj.server_id}" />
<span th:text="${obj.name}"></span>
</div>
</div>
</div>
<div class="row cl">
<label class="form-label col-xs-4 col-sm-2">
<span class="c-red" >*</span>
内容:</label>
<div class="formControls col-xs-8 col-sm-9">
<input type="text" name="content" placeholder="" value="" class="input-text"/>
<span class="ROLEID"></span>
</div>
</div>
</div>
<div id="text">
</div>
<div id="sub">
<div class="row cl" style="text-align: center">
<div class="col-xs-8 col-sm-9 col-xs-offset-4 col-sm-offset-2">
<button class="btn btn-primary radius" style="font-size: 15px" onclick="sub()"><i class="Hui-iconfont" >&#xe665;</i>
提交
</button>
</div>
</div>
<iframe name='sendGM' id="sendGM" style='display: none'></iframe>
</div>
@ -90,31 +114,17 @@
<script type="text/javascript" src="../static/lib/jquery.validation/1.14.0/validate-methods.js"></script>
<script type="text/javascript" src="../static/lib/jquery.validation/1.14.0/messages_zh.js"></script>
<script type="text/javascript" th:inline = "javascript">
var ms = [[${serverInfo}]];
var m = document.getElementById("my");
var a = document.getElementById("all");
var t = document.getElementById("text");
var s = document.getElementById("sub");
m.innerHTML += "<form id='form' >";
a.innerHTML += "<input type='checkbox' id='selectAll' > "+"全选"
for(var i=0;i<ms.length;i++){
m.innerHTML += "<input style='' id='server' type='checkbox' name='serverId' value='"+ms[i].server_id+"'>"+ms[i].name+"&nbsp&nbsp&nbsp&nbsp";
}
t.innerHTML +="内容: "+"<input type='text' name='content' style='width: 95%;height: 40px' ; >"
s.innerHTML += "<input type='button' value='提交' onclick='sub()'>";
m.innerHTML += "</form>";
<script type="text/javascript">
function sub() {
var strSel=[];
var content = $('input[name^="content"]').map(function(){3
var content = $('input[name^="content"]').map(function(){
return this.value
}).get();
$("[name='serverId']:checked").each(function(index, element) {
strSel.push($(this).val());
});
console.log(strSel)
$.ajax({
type: "POST",
data: {
@ -125,7 +135,7 @@
success: function (data) {
if (data === 0) {
layer.msg('发送成功',{icon: 6,time:2000,end:function(){
location.reload();
window.location.href = "toMailPage?type=4"
}})
}
if (data === 1) {