From 32152389599ceb4902b264f8945df433d6786676 Mon Sep 17 00:00:00 2001 From: xuexinpeng Date: Thu, 12 Aug 2021 15:21:29 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A4=AA=E5=88=9D=E5=AF=86=E5=8D=B7=E5=8A=9F?= =?UTF-8?q?=E8=83=BD=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ServerFunctionConfigController.java | 71 ++++++++ .../java/com/jmfy/dao/SecretVolumeDao.java | 16 ++ .../com/jmfy/dao/impl/BanFunctionImpl.java | 2 - .../jmfy/dao/impl/SecretVolumeDaoImpl.java | 58 ++++++ .../java/com/jmfy/model/SecretVolumeInfo.java | 54 ++++++ .../java/com/jmfy/model/vo/PowersEnum.java | 4 + .../static/html/addSecretVolumeInfo.html | 171 ++++++++++++++++++ .../resources/templates/findServerInfo.html | 1 + .../templates/findTaiChuSecretVolumeInfo.html | 82 +++++++++ .../resources/templates/secretVolumeEdit.html | 149 +++++++++++++++ 10 files changed, 606 insertions(+), 2 deletions(-) create mode 100644 src/main/java/com/jmfy/controller/ServerFunctionConfigController.java create mode 100644 src/main/java/com/jmfy/dao/SecretVolumeDao.java create mode 100644 src/main/java/com/jmfy/dao/impl/SecretVolumeDaoImpl.java create mode 100644 src/main/java/com/jmfy/model/SecretVolumeInfo.java create mode 100644 src/main/resources/static/html/addSecretVolumeInfo.html create mode 100644 src/main/resources/templates/findTaiChuSecretVolumeInfo.html create mode 100644 src/main/resources/templates/secretVolumeEdit.html diff --git a/src/main/java/com/jmfy/controller/ServerFunctionConfigController.java b/src/main/java/com/jmfy/controller/ServerFunctionConfigController.java new file mode 100644 index 0000000..c269924 --- /dev/null +++ b/src/main/java/com/jmfy/controller/ServerFunctionConfigController.java @@ -0,0 +1,71 @@ +package com.jmfy.controller; + +import com.jmfy.dao.SecretVolumeDao; +import com.jmfy.model.SecretVolumeInfo; +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; + +import javax.annotation.Resource; +import javax.servlet.http.HttpServletRequest; +import java.util.List; + +@Controller +public class ServerFunctionConfigController { + + @Resource + private SecretVolumeDao secretVolumeDao; + + + @RequestMapping(value = "/getAllSecretVolumeInfo", method = {RequestMethod.POST, RequestMethod.GET}) + public String getAllSecretInfo(ModelMap map) throws Exception { + List secretVolumeInfos = secretVolumeDao.getAllSecretInfo(); + map.addAttribute("secretVolumeInfos", secretVolumeInfos); + return "findTaiChuSecretVolumeInfo"; + + } + + @RequestMapping(value = "/toEditSecretVolume", method = {RequestMethod.POST, RequestMethod.GET}) + public String getAllUserId(ModelMap map, int id) throws Exception { + SecretVolumeInfo secretVolumeInfo = secretVolumeDao.getSecretVolumeInfo(id); + if (secretVolumeInfo == null) { + return null; + } + map.addAttribute("secretVolumeInfo", secretVolumeInfo); + return "secretVolumeEdit"; + + } + + @RequestMapping(value = "/secretVolumeEdit", method = {RequestMethod.POST, RequestMethod.GET}) + public String toServerInfoEdit(ModelMap map, HttpServletRequest request) throws Exception { + int id = Integer.parseInt(request.getParameter("id")); + String strategyLink = request.getParameter("strategyLink"); + String windowLink = request.getParameter("windowLink"); + String chargeLimit = request.getParameter("chargeLimit"); + secretVolumeDao.updateSecretVolumeInfo(id, strategyLink, windowLink, chargeLimit); + SecretVolumeInfo secretVolumeInfo = secretVolumeDao.getSecretVolumeInfo(id); + if (secretVolumeInfo == null) { + return "404"; + } + map.addAttribute("secretVolumeInfos", secretVolumeInfo); + return "findTaiChuSecretVolumeInfo"; + } + + + @RequestMapping(value = "/addSecretVolume", method = {RequestMethod.POST, RequestMethod.GET}) + public @ResponseBody + int addServer(@RequestBody SecretVolumeInfo secretVolumeInfo, HttpServletRequest request) throws Exception { + if (secretVolumeInfo.get_id() == 0 || secretVolumeInfo.getStrategyLink() == null || secretVolumeInfo.getWindowLink() == null || secretVolumeInfo.getChargeLimit() == null) { + return 1; + } + SecretVolumeInfo secretVolumeInfoData = secretVolumeDao.getSecretVolumeInfo(secretVolumeInfo.get_id()); + if (secretVolumeInfoData != null) { + return 1; + } + secretVolumeDao.addSecretVolumeInfo(secretVolumeInfo); + return 0; + } +} diff --git a/src/main/java/com/jmfy/dao/SecretVolumeDao.java b/src/main/java/com/jmfy/dao/SecretVolumeDao.java new file mode 100644 index 0000000..bab0c42 --- /dev/null +++ b/src/main/java/com/jmfy/dao/SecretVolumeDao.java @@ -0,0 +1,16 @@ +package com.jmfy.dao; + +import com.jmfy.model.SecretVolumeInfo; + +import java.util.List; + +public interface SecretVolumeDao { + + List getAllSecretInfo() throws Exception; + + SecretVolumeInfo getSecretVolumeInfo(int id) throws Exception; + + void updateSecretVolumeInfo(int id, String strategyLink, String windowLink, String chargeLimit) throws Exception; + + void addSecretVolumeInfo(SecretVolumeInfo info) throws Exception; +} diff --git a/src/main/java/com/jmfy/dao/impl/BanFunctionImpl.java b/src/main/java/com/jmfy/dao/impl/BanFunctionImpl.java index edaa651..e2a7e41 100644 --- a/src/main/java/com/jmfy/dao/impl/BanFunctionImpl.java +++ b/src/main/java/com/jmfy/dao/impl/BanFunctionImpl.java @@ -1,8 +1,6 @@ package com.jmfy.dao.impl; import com.jmfy.dao.BanFuctionDao; -import com.jmfy.model.BlackList; -import com.jmfy.model.CAdmin; import com.jmfy.model.Constant; import com.jmfy.model.ServerBanPro; import com.jmfy.utils.Connect; diff --git a/src/main/java/com/jmfy/dao/impl/SecretVolumeDaoImpl.java b/src/main/java/com/jmfy/dao/impl/SecretVolumeDaoImpl.java new file mode 100644 index 0000000..2c59d57 --- /dev/null +++ b/src/main/java/com/jmfy/dao/impl/SecretVolumeDaoImpl.java @@ -0,0 +1,58 @@ +package com.jmfy.dao.impl; + +import com.jmfy.dao.SecretVolumeDao; +import com.jmfy.model.Constant; +import com.jmfy.model.SecretVolumeInfo; +import com.jmfy.model.ServerInfo; +import com.jmfy.utils.Connect; +import org.springframework.data.mongodb.core.MongoTemplate; +import org.springframework.data.mongodb.core.query.Criteria; +import org.springframework.data.mongodb.core.query.Query; +import org.springframework.data.mongodb.core.query.Update; +import org.springframework.stereotype.Component; + +import javax.annotation.Resource; +import java.util.List; + +@Component +public class SecretVolumeDaoImpl implements SecretVolumeDao { + @Resource + private Connect connect; + public static final String dbName = Constant.dbName; + + @Override + public List getAllSecretInfo() throws Exception { + MongoTemplate mongoTemplate = connect.getMongoTemplete(dbName); + Query query = new Query(); + return mongoTemplate.find(query, SecretVolumeInfo.class); + } + + + @Override + public SecretVolumeInfo getSecretVolumeInfo(int id) throws Exception { + MongoTemplate mongoTemplate = connect.getMongoTemplete(dbName); + Query query = new Query(); + query.addCriteria(Criteria.where("_id").is(id)); + return mongoTemplate.findOne(query, SecretVolumeInfo.class); + } + + @Override + public void updateSecretVolumeInfo(int id, String strategyLink, String windowLink, String chargeLimit) throws Exception { + Update update = new Update(); + //update.set("id",id); + update.set("strategyLink",strategyLink); + update.set("windowLink",windowLink); + update.set("chargeLimit",chargeLimit); + MongoTemplate mongoTemplate = connect.getMongoTemplete(dbName); + + Query query = new Query(Criteria.where("_id").is(id)); + + mongoTemplate.updateMulti(query, update, SecretVolumeInfo.class); + } + + @Override + public void addSecretVolumeInfo(SecretVolumeInfo info) throws Exception { + MongoTemplate mongoTemplate = connect.getMongoTemplete(dbName); + mongoTemplate.insert(info, "secret_volume_info"); //有则更新,没有则新增 + } +} diff --git a/src/main/java/com/jmfy/model/SecretVolumeInfo.java b/src/main/java/com/jmfy/model/SecretVolumeInfo.java new file mode 100644 index 0000000..21db316 --- /dev/null +++ b/src/main/java/com/jmfy/model/SecretVolumeInfo.java @@ -0,0 +1,54 @@ +package com.jmfy.model; + +import org.springframework.data.annotation.Id; +import org.springframework.data.mongodb.core.mapping.Document; +import org.springframework.data.mongodb.core.mapping.Field; + +@Document(collection = "secret_volume_info") +public class SecretVolumeInfo { + + @Id + private int _id; + + @Field(value = "strategyLink") + private String strategyLink; //使用链接 + + @Field(value = "windowLink") + private String windowLink; // 素材链接 + + + @Field(value = "chargeLimit") + private String chargeLimit; + + public int get_id() { + return _id; + } + + public void set_id(int _id) { + this._id = _id; + } + + public String getStrategyLink() { + return strategyLink; + } + + public void setStrategyLink(String strategyLink) { + this.strategyLink = strategyLink; + } + + public String getWindowLink() { + return windowLink; + } + + public void setWindowLink(String windowLink) { + this.windowLink = windowLink; + } + + public String getChargeLimit() { + return chargeLimit; + } + + public void setChargeLimit(String chargeLimit) { + this.chargeLimit = chargeLimit; + } +} diff --git a/src/main/java/com/jmfy/model/vo/PowersEnum.java b/src/main/java/com/jmfy/model/vo/PowersEnum.java index e14ca84..62760b7 100644 --- a/src/main/java/com/jmfy/model/vo/PowersEnum.java +++ b/src/main/java/com/jmfy/model/vo/PowersEnum.java @@ -96,6 +96,10 @@ public enum PowersEnum { //功能封禁 BAN_FUNCTION(1201,"功能封禁",1201,1,""), BAN_FUNCTION_ACTION(1202,"功能封禁操作",1201,1,"/html/banFunction.html"), + //太初密卷 + TAICHU_SECRET_VOLUME(1301,"太初密卷",1301,1,""), + TAICHU_SECRET_VOLUME_INFO(1302,"太初密卷信息",1301,1,"getAllSecretVolumeInfo"), + TAICHU_SECRET_VOLUME_ADD(1303,"添加太初密卷信息",1301,1,"/html/addSecretVolumeInfo.html"), ; private int id; diff --git a/src/main/resources/static/html/addSecretVolumeInfo.html b/src/main/resources/static/html/addSecretVolumeInfo.html new file mode 100644 index 0000000..36a6e3d --- /dev/null +++ b/src/main/resources/static/html/addSecretVolumeInfo.html @@ -0,0 +1,171 @@ + + + + + + + + + + + + + + + + + + + + + 基本设置 + + + +
+
+
+
+ 新增太初密卷信息 +
+
+ + + +
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+
+
+
+ +
+
+
+
+ + + + + + + + + + + + + + + + + diff --git a/src/main/resources/templates/findServerInfo.html b/src/main/resources/templates/findServerInfo.html index 8aba60d..f4c6cf6 100644 --- a/src/main/resources/templates/findServerInfo.html +++ b/src/main/resources/templates/findServerInfo.html @@ -181,5 +181,6 @@ ) }); + \ No newline at end of file diff --git a/src/main/resources/templates/findTaiChuSecretVolumeInfo.html b/src/main/resources/templates/findTaiChuSecretVolumeInfo.html new file mode 100644 index 0000000..4c99a0a --- /dev/null +++ b/src/main/resources/templates/findTaiChuSecretVolumeInfo.html @@ -0,0 +1,82 @@ + + + + + + + + + + + + + + + + + + + + 服务器列表信息 + + + + + +
+

太初秘境信息

+
+
+ + + + + + + + + + + + + + + + + + + + + +
窗口使用链接使用素材展示充值额度操作
+ + 配置 +
+
+
+ + + + + + + + + + +
+ + + \ No newline at end of file diff --git a/src/main/resources/templates/secretVolumeEdit.html b/src/main/resources/templates/secretVolumeEdit.html new file mode 100644 index 0000000..2e7d8cd --- /dev/null +++ b/src/main/resources/templates/secretVolumeEdit.html @@ -0,0 +1,149 @@ + + + + + + + + + + + + + + + + + + + + + 基本设置 + + + +
+
+
+
+ 修改服务器状态 +
+
+
+ +
+ +
+
+
+ +
+ +
+
+ +
+ +
+ +
+
+ +
+ +
+ +
+
+ +
+
+
+
+ + +
+
+
+
+ + + + + + + + + + + + + + + + +