From e9892f991dcc6ed15f89b72a39b90542156c0172 Mon Sep 17 00:00:00 2001 From: whb <15647141185@163.com> Date: Tue, 23 Feb 2021 14:54:03 +0800 Subject: [PATCH 1/2] =?UTF-8?q?GM=E6=94=B9=E7=89=884?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/jmfy/controller/MailController.java | 6 ---- .../resources/templates/sendPersonalMail.html | 28 ++++++++++++++--- src/main/resources/templates/sendSysMail.html | 31 ++++++++++++++++--- 3 files changed, 51 insertions(+), 14 deletions(-) diff --git a/src/main/java/com/jmfy/controller/MailController.java b/src/main/java/com/jmfy/controller/MailController.java index 62ed884..2afa583 100644 --- a/src/main/java/com/jmfy/controller/MailController.java +++ b/src/main/java/com/jmfy/controller/MailController.java @@ -63,12 +63,6 @@ public class MailController { map.addAttribute("serverInfo",allServerInfo); map.addAttribute("itemNameMap",itemNameMap); - /*List idList =new ArrayList(); - for (int i = 0;i* 邮件标题:
- +
+ 中文 +
+
+ 英文 +
+
+ 粤文 +
@@ -78,7 +86,9 @@ * 邮件正文:
- + 中文 + 英文 + 粤文
@@ -278,10 +288,20 @@ function sendSysMail() { + 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(); + + 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(); diff --git a/src/main/resources/templates/sendSysMail.html b/src/main/resources/templates/sendSysMail.html index 4527106..5e8bffa 100644 --- a/src/main/resources/templates/sendSysMail.html +++ b/src/main/resources/templates/sendSysMail.html @@ -68,7 +68,15 @@ * 邮件标题:
- +
+ 中文 +
+
+ 英文 +
+
+ 粤文 +
@@ -77,7 +85,9 @@ * 邮件正文:
- + 中文 + 英文 + 粤文
@@ -280,10 +290,23 @@ }); function sendSysMail() { + 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(); + + 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(); From 43e7f6924d31c0561a0dd6a30693f338b87ffb40 Mon Sep 17 00:00:00 2001 From: whb <15647141185@163.com> Date: Mon, 8 Mar 2021 10:33:47 +0800 Subject: [PATCH 2/2] =?UTF-8?q?GM=E6=94=B9=E7=89=88=EF=BC=8C=E6=A0=87?= =?UTF-8?q?=E9=A2=98=E5=8A=A0=E8=8B=B1=E6=96=87=EF=BC=8C=E8=B6=8A=E5=8D=97?= =?UTF-8?q?=E6=96=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/jmfy/controller/NoticeController.java | 14 ++-- .../java/com/jmfy/model/vo/ServerInfoVo.java | 18 ++++ .../resources/static/html/sendSysNotice.html | 83 +++++++++++++++++-- .../resources/templates/sendPersonalMail.html | 28 ++++++- src/main/resources/templates/sendSysCmd.html | 75 +++++++++++------ src/main/resources/templates/sendSysMail.html | 26 +++++- 6 files changed, 196 insertions(+), 48 deletions(-) diff --git a/src/main/java/com/jmfy/controller/NoticeController.java b/src/main/java/com/jmfy/controller/NoticeController.java index a8e25e7..4b7349c 100644 --- a/src/main/java/com/jmfy/controller/NoticeController.java +++ b/src/main/java/com/jmfy/controller/NoticeController.java @@ -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); diff --git a/src/main/java/com/jmfy/model/vo/ServerInfoVo.java b/src/main/java/com/jmfy/model/vo/ServerInfoVo.java index f63f261..792c0b6 100644 --- a/src/main/java/com/jmfy/model/vo/ServerInfoVo.java +++ b/src/main/java/com/jmfy/model/vo/ServerInfoVo.java @@ -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 + + '}'; + } } diff --git a/src/main/resources/static/html/sendSysNotice.html b/src/main/resources/static/html/sendSysNotice.html index c3b14c4..52430ff 100644 --- a/src/main/resources/static/html/sendSysNotice.html +++ b/src/main/resources/static/html/sendSysNotice.html @@ -36,16 +36,21 @@
-
+
- + 英文 + 越南文
@@ -55,7 +60,9 @@ * 游戏公告内容:
- + 中文 + 英文 + 越南文
@@ -93,7 +100,7 @@
-
@@ -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('游戏公告标题不能为空!'); return false; } - if (content1 === '' || content1 == null) { + if (content === '' || content == null) { erroCode.html('游戏公告内容不能为空!'); 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}); + } + } + } + ) } diff --git a/src/main/resources/templates/sendPersonalMail.html b/src/main/resources/templates/sendPersonalMail.html index 64fa898..a8651ed 100644 --- a/src/main/resources/templates/sendPersonalMail.html +++ b/src/main/resources/templates/sendPersonalMail.html @@ -70,13 +70,13 @@ 邮件标题:
- 中文 + 中文
英文
- 粤文 + 越南文
@@ -88,7 +88,7 @@
中文 英文 - 粤文 + 越南文
@@ -285,16 +285,36 @@ } }) } - + 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; diff --git a/src/main/resources/templates/sendSysCmd.html b/src/main/resources/templates/sendSysCmd.html index 5bd5917..b078f9f 100644 --- a/src/main/resources/templates/sendSysCmd.html +++ b/src/main/resources/templates/sendSysCmd.html @@ -63,39 +63,61 @@
+
+ +
+ 全选 +
+
+ + + + + + + + -
- -
- 全选 -
-
-
- -
-
-
- -
- - +
+ +
+ + +
-
-
-
- +
+
+ +
-
+
@@ -158,7 +180,6 @@ } }); }); - diff --git a/src/main/resources/templates/sendSysMail.html b/src/main/resources/templates/sendSysMail.html index 5e8bffa..530ee0d 100644 --- a/src/main/resources/templates/sendSysMail.html +++ b/src/main/resources/templates/sendSysMail.html @@ -75,7 +75,7 @@ 英文
- 粤文 + 越南文
@@ -87,7 +87,7 @@
中文 英文 - 粤文 + 越南文
@@ -290,6 +290,8 @@ }); 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(); @@ -298,6 +300,26 @@ 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;