Merge branch 'whb' into jieling

master
whb 2021-03-08 10:34:31 +08:00
commit d03fafb003
7 changed files with 242 additions and 57 deletions

View File

@ -63,12 +63,6 @@ public class MailController {
map.addAttribute("serverInfo",allServerInfo);
map.addAttribute("itemNameMap",itemNameMap);
/*List<String> idList =new ArrayList<String>();
for (int i = 0;i<allServerInfo.size();i++){
idList.add(allServerInfo.get(i).getServer_id());
}
map.addAttribute("idList",idList);*/
} catch (Exception e) {
e.printStackTrace();
}

View File

@ -11,6 +11,7 @@ import com.jmfy.utils.RedisUtil;
import com.jmfy.utils.SeqUtils;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
@ -32,10 +33,11 @@ public class NoticeController {
@RequestMapping(value = "/publishNotice", method = {RequestMethod.POST, RequestMethod.GET})
public @ResponseBody
int publishNotice(HttpServletRequest request) throws Exception {
String content = request.getParameter("content1");
String title = request.getParameter("title1");
int type = Integer.valueOf(request.getParameter("addType"));
int publishNotice(HttpServletRequest request,@RequestBody Map map) throws Exception {
String content = (String) map.get("content");
String title = (String) map.get("title");request.getParameter("title");
int type = Integer.valueOf((String) map.get("addType"));
NoticeInfo noticeInfo = new NoticeInfo();
long id = RedisUtil.getInstence().increment("notice_id");
@ -46,8 +48,8 @@ public class NoticeController {
if(type==0){
RedisUtil.getInstence().putMapEntry(RedisUserKey.NOTICE,"" ,"1",noticeInfo,0);
}else{
String startTime = JsonUtil.date3TimeStamp(request.getParameter("startTime"));
String endTime = JsonUtil.date3TimeStamp(request.getParameter("endTime"));
String startTime = JsonUtil.date3TimeStamp((String) map.get("startTime"));
String endTime = JsonUtil.date3TimeStamp((String) map.get("endTime"));
noticeInfo.setStartTime(Long.parseLong(startTime));
noticeInfo.setEndTime(Long.parseLong(endTime));
RedisUtil.getInstence().putMapEntry(RedisUserKey.NOTICE,"" ,String.valueOf(id),noticeInfo,0);

View File

@ -52,10 +52,28 @@ public class ServerInfoVo{
public String getIp_port() {
return ip_port;
}
public long getOnlineNum(){
return onlineNum;
}
public void setIp_port(String ip_port) {
this.ip_port = ip_port;
}
@Override
public String toString() {
return "ServerInfoVo{" +
"server_id='" + server_id + '\'' +
", ip_port='" + ip_port + '\'' +
", name='" + name + '\'' +
", open_time='" + open_time + '\'' +
", open_type='" + open_type + '\'' +
", status=" + status +
", is_new=" + is_new +
", registerNum=" + registerNum +
", onlineNum=" + onlineNum +
'}';
}
}

View File

@ -36,16 +36,21 @@
</nav>
<div class="page-container">
<form class="form form-horizontal" id="form-article-add" action="/publishNotice" method="post" target="updataSYSNotice"
onsubmit="return sendCheck()">
<form class="form form-horizontal" id="form-article-add" target="updataSYSNotice">
<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="title1"
中文<input type="text" name="title1"
placeholder="" value=""
class="input-text"/>
英文<input type="text" name="title2"
placeholder="" value=""
class="input-text"/>
越南文<input type="text" name="title3"
placeholder="" value=""
class="input-text"/>
<span class="SERVERID"></span>
</div>
</div>
@ -55,7 +60,9 @@
<span class="c-red">*</span>
游戏公告内容:</label>
<div class="formControls col-xs-8 col-sm-9">
<textarea rows="20" cols="150" wrap="soft" id="content1" name="content1"></textarea>
中文<textarea rows="10" cols="150" wrap="soft" id="content1" name="content1" style="width:31%;"></textarea>
英文<textarea rows="10" cols="150" wrap="soft" id="content2" name="content2" style="width:31%;"></textarea>
越南文<textarea rows="10" cols="150" wrap="soft" id="content3" name="content3" style="width:30%;"></textarea>
<span class="ROLEID"></span>
</div>
</div>
@ -93,7 +100,7 @@
<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" type="submit" style="font-size: 15px"><i class="Hui-iconfont">&#xe665;</i>
<button class="btn btn-primary radius" onClick="return sendCheck();" style="font-size: 15px"><i class="Hui-iconfont">&#xe665;</i>
提交
</button>
</div>
@ -140,19 +147,77 @@ $('#updataSYSNotice').load(function () {
function sendCheck() {
var erroCode = $('.SERVERID');
var reg = new RegExp("[|#]",'g');
var title1 = $("input[name='title1']").val();
var content1 = document.getElementById("summary").value;
var title2 = $("input[name='title2']").val();
var title3 = $("input[name='title3']").val();
var title = title1+"|"+title2+"|"+title3;
var content1 = $("textarea[name='content1']").val();
var content2 = $("textarea[name='content2']").val();
var content3 = $("textarea[name='content3']").val();
var content = content1+"|"+content2+"|"+content3;
if (reg.test(title1)){
alert("中文标题不能有特殊字符")
}
if (reg.test(title2)){
alert("英文标题不能有特殊字符")
}
if (reg.test(title3)){
alert("越南文标题不能有特殊字符")
}
if (reg.test(content1)){
alert("中文正文不能有特殊字符")
}
if (reg.test(content2)){
alert("英文正文不能有特殊字符")
}
if (reg.test(content3)){
alert("越南文正文不能有特殊字符")
}
var startTime = $("input[name='startTime']").val();
var endTime = $("input[name='endTime']").val();
var addType = $("select[name='addType']").val();
if (title === '' || title == null) {
if (title1 === '' || title1 == null) {
erroCode.html('<span style="color: red; ">游戏公告标题不能为空!</span>');
return false;
}
if (content1 === '' || content1 == null) {
if (content === '' || content == null) {
erroCode.html('<span style="color: red; ">游戏公告内容不能为空!</span>');
return false;
}
$.ajax({
type: "POST",
data:
JSON.stringify({
"title": title,
"content": content,
"startTime": startTime,
"endTime": endTime,
"addType": addType
})
,
url: "/publishNotice",
return true;
contentType: 'application/json',
success: function (data) {
console.log(data)
if (data === 0) {
layer.msg('成功!', {icon: 6, time: 1000});
}else {
layer.msg('失败!', {icon: 6, time: 1000});
}
}
}
)
}
</script>
<!--/请在上方写此页面业务相关的脚本-->

View File

@ -69,7 +69,15 @@
<span class="c-red">*</span>
邮件标题:</label>
<div class="formControls col-xs-8 col-sm-9">
<input type="text" name="mailTitle" placeholder="" value="" class="input-text"/>
<div>
中文<input type="text" name="mailTitle1" id="mailTitle1" placeholder="" value="" class="input-text"/>
</div>
<div>
英文<input type="text" name="mailTitle2" placeholder="" value="" class="input-text"/>
</div>
<div>
越南文<input type="text" name="mailTitle3" placeholder="" value="" class="input-text"/>
</div>
<span class="MAILTITLE"></span>
</div>
</div>
@ -78,7 +86,9 @@
<span class="c-red">*</span>
邮件正文:</label>
<div class="formControls col-xs-8 col-sm-9">
<textarea class="textarea" name="mailContent"></textarea>
中文<textarea class="textarea" name="mailContent1" style="width:31%;"></textarea>
英文<textarea class="textarea" name="mailContent2" style="width:31%;"></textarea>
越南文<textarea class="textarea" name="mailContent3" style="width:30%;"></textarea>
<span class="MAILCONTENT"></span>
</div>
</div>
@ -275,13 +285,43 @@
}
})
}
function sendSysMail() {
//特殊字符验证
var reg = new RegExp("[|#]",'g');
var mailTitle1 = $("input[name='mailTitle1']").val();
if (reg.test(mailTitle1)){
alert("中文标题不能有特殊字符")
}
var mailTitle2 = $("input[name='mailTitle2']").val();
if (reg.test(mailTitle2)){
alert("英文标题不能有特殊字符")
}
var mailTitle3 = $("input[name='mailTitle3']").val();
if (reg.test(mailTitle3)){
alert("越南文标题不能有特殊字符")
}
var mailContent1 = $("textarea[name='mailContent1']").val();
if (reg.test(mailContent1)){
alert("中文正文不能有特殊字符")
}
var mailContent2 = $("textarea[name='mailContent2']").val();
if (reg.test(mailContent2)){
alert("英文正文不能有特殊字符")
}
var mailContent3 = $("textarea[name='mailContent3']").val();
if (reg.test(mailContent3)){
alert("越南文正文不能有特殊字符")
}
var mailTitle = mailTitle1+"|"+mailTitle2+"|"+mailTitle3;
var mailContent = mailContent1+"|"+mailContent2+"|"+mailContent3;
var erroCode = $('.SERVERID');
var serverId = $("#serverId").val();
var mailTitle = $("input[name='mailTitle']").val();
var mailContent = $("textarea[name='mailContent']").val();
// var attach = $("input[name='attach']").val();
var isAttach = document.getElementById("isAttach").value;
var userId = $("input[name='userId']").val();

View File

@ -63,39 +63,61 @@
<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 class="page-container">
<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}" style="text-align: left">
<input th:text="${obj.server_id}" type='checkbox' name='serverId' th:value="${obj.server_id}"/>
<span th:text="${obj.name}"></span>
</div>-->
<!--<div th:with="colSize=${5}, rowSize=${serverInfo.size()/colSize}, rowSize=${(serverInfo.size()%colSize==0 ? rowSize : (rowSize+1))}">
<tr th:if="${serverInfo.size() gt 0}" th:each="rowIdx:${#numbers.sequence(1, rowSize)}">
<td th:each="colIdx:${#numbers.sequence(1,colSize)}">
<th:block th:with="idx=${(rowIdx-1)*colSize+colIdx-1}, user=${idx<serverInfo.size() ? serverInfo[idx] : null}">
&lt;!&ndash; th:if 决定是否输出 input 标签user不是空指针才输出 &ndash;&gt;
&lt;!&ndash;<input th:if="${user ne null}" name="serverId" type="checkbox" th:value="${user.server_id}" th:text="${user.server_id}"/>&ndash;&gt;
</th:block>
</td>
</tr>
</div>-->
<!--<div th:each="usr,status:${serverInfo}" style="text-align: left" >
<p th:remove="tag" th:utext="${(status.index+1)%5==1 ? '&lt;tr&gt;':''}"/>
<input name="serverId" type="checkbox" th:value="${usr.server_id}" th:text="${usr.server_id}"/>&nbsp;
<span th:text="${usr.name}"></span>
<p th:remove="tag" th:utext="${(status.index+1)%5==0 ? '&lt;/tr&gt;':''}"/>
</div>-->
<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 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 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 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>
</div>
<iframe name='sendGM' id="sendGM" style='display: none'></iframe>
</div>
@ -158,7 +180,6 @@
}
});
});
</script>
</body>
</html>

View File

@ -68,7 +68,15 @@
<span class="c-red">*</span>
邮件标题:</label>
<div class="formControls col-xs-8 col-sm-9">
<input type="text" name="mailTitle" placeholder="" value="" class="input-text"/>
<div>
中文<input type="text" name="mailTitle1" placeholder="" value="" class="input-text"/>
</div>
<div>
英文<input type="text" name="mailTitle2" placeholder="" value="" class="input-text"/>
</div>
<div>
越南文<input type="text" name="mailTitle3" placeholder="" value="" class="input-text"/>
</div>
<span class="MAILTITLE"></span>
</div>
</div>
@ -77,7 +85,9 @@
<span class="c-red">*</span>
邮件正文:</label>
<div class="formControls col-xs-8 col-sm-9">
<textarea class="textarea" name="mailContent"></textarea>
中文<textarea class="textarea" name="mailContent1" style="width:31%;"></textarea>
英文<textarea class="textarea" name="mailContent2" style="width:31%;"></textarea>
越南文<textarea class="textarea" name="mailContent3" style="width:30%;"></textarea>
<span class="MAILCONTENT"></span>
</div>
</div>
@ -280,10 +290,45 @@
});
function sendSysMail() {
//特殊字符验证
var reg = new RegExp("[|#]",'g');
var mailTitle1 = $("input[name='mailTitle1']").val();
var mailTitle2 = $("input[name='mailTitle2']").val();
var mailTitle3 = $("input[name='mailTitle3']").val();
var mailContent1 = $("textarea[name='mailContent1']").val();
var mailContent2 = $("textarea[name='mailContent2']").val();
var mailContent3 = $("textarea[name='mailContent3']").val();
if (reg.test(mailTitle1)){
alert("中文标题不能有特殊字符")
}
if (reg.test(mailTitle2)){
alert("英文标题不能有特殊字符")
}
if (reg.test(mailTitle3)){
alert("越南文标题不能有特殊字符")
}
if (reg.test(mailContent1)){
alert("中文正文不能有特殊字符")
}
if (reg.test(mailContent2)){
alert("英文正文不能有特殊字符")
}
if (reg.test(mailContent3)){
alert("越南文正文不能有特殊字符")
}
var mailTitle = mailTitle1+"|"+mailTitle2+"|"+mailTitle3;
var mailContent = mailContent1+"|"+mailContent2+"|"+mailContent3;
var erroCode = $('.SERVERID');
var serverId = $("#serverId").val().toString();
var mailTitle = $("input[name='mailTitle']").val();
var mailContent = $("textarea[name='mailContent']").val();
// var attach = $("input[name='attach']").val();
var isAttach = document.getElementById("isAttach").value;
var sendTime = $("input[name='sendTime']").val();