太初密卷功能配置

xuexinpeng 2021-08-12 15:21:29 +08:00
parent 6123cc4884
commit 3215238959
10 changed files with 606 additions and 2 deletions

View File

@ -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<SecretVolumeInfo> 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;
}
}

View File

@ -0,0 +1,16 @@
package com.jmfy.dao;
import com.jmfy.model.SecretVolumeInfo;
import java.util.List;
public interface SecretVolumeDao {
List<SecretVolumeInfo> 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;
}

View File

@ -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;

View File

@ -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<SecretVolumeInfo> 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"); //有则更新,没有则新增
}
}

View File

@ -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;
}
}

View File

@ -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;

View File

@ -0,0 +1,171 @@
<!--_meta 作为公共模版分离出去-->
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8"/>
<meta name="renderer" content="webkit|ie-comp|ie-stand"/>
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"/>
<meta name="viewport"
content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no"/>
<meta http-equiv="Cache-Control" content="no-siteapp"/>
<link rel="Bookmark" href="../favicon.ico"/>
<link rel="Shortcut Icon" href="../favicon.ico"/>
<!--[if lt IE 9]>
<script type="text/javascript" src="../lib/html5shiv.js"></script>
<script type="text/javascript" src="../lib/respond.min.js"></script>
<![endif]-->
<link rel="stylesheet" type="text/css" href="../h-ui/css/H-ui.min.css"/>
<link rel="stylesheet" type="text/css" href="../h-ui.admin/css/H-ui.admin.css"/>
<link rel="stylesheet" type="text/css" href="../lib/Hui-iconfont/1.0.8/iconfont.css"/>
<link rel="stylesheet" type="text/css" href="../h-ui.admin/skin/default/skin.css" id="skin"/>
<link rel="stylesheet" type="text/css" href="../h-ui.admin/css/style.css"/>
<!--[if IE 6]>
<script type="text/javascript" src="../lib/DD_belatedPNG_0.0.8a-min.js"></script>
<script>DD_belatedPNG.fix('*');</script>
<![endif]-->
<!--/meta 作为公共模版分离出去-->
<title>基本设置</title>
</head>
<body>
<nav class="breadcrumb"><i class="Hui-iconfont">&#xe67f;</i> 首页
<span class="c-gray en">&gt;</span>
服务器管理
<span class="c-gray en">&gt;</span>
创建服务器
</nav>
<div class="page-container">
<form class="form form-horizontal" id="form-article-add" action="http://60.1.1.212:9076/idip/manager" method="post">
<div id="tab-system" class="HuiTab">
<div class="tabBar cl">
<span>新增太初密卷信息</span>
</div>
<div class="tabCon">
<span class="ERRINFO"></span>
<div class="row cl">
<label class="form-label col-xs-4 col-sm-2">
<span class="c-red">*</span>
id</label>
<div class="formControls col-xs-8 col-sm-9">
<input type="number" name="_id" style="width: 100px;" placeholder="0自动生成" class="input-text"/>
</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="strategyLink" placeholder="" class="input-text"/>
</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="windowLink" placeholder="" class="input-text"/>
</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="chargeLimit" placeholder="" class="input-text"/>
</div>
</div>
</div>
</div>
<div class="row cl">
<div class="col-xs-8 col-sm-9 col-xs-offset-4 col-sm-offset-2">
<button onClick="return addServer();" class="btn btn-primary radius" type="button"><i
class="Hui-iconfont">&#xe632;</i> 添加
</button>
</div>
</div>
</form>
</div>
<!--_footer 作为公共模版分离出去-->
<script type="text/javascript" src="../lib/jquery/1.9.1/jquery.min.js"></script>
<script type="text/javascript" src="../lib/layer/2.4/layer.js"></script>
<script type="text/javascript" src="../h-ui/js/H-ui.min.js"></script>
<script type="text/javascript" src="../h-ui.admin/js/H-ui.admin.js"></script> <!--/_footer 作为公共模版分离出去-->
<!--请在下方写此页面业务相关的脚本-->
<script type="text/javascript" src="../lib/My97DatePicker/4.8/WdatePicker.js"></script>
<script type="text/javascript" src="../lib/jquery.validation/1.14.0/jquery.validate.js"></script>
<script type="text/javascript" src="../lib/jquery.validation/1.14.0/validate-methods.js"></script>
<script type="text/javascript" src="../lib/jquery.validation/1.14.0/messages_zh.js"></script>
<script type="text/javascript">
$(function () {
$('.skin-minimal input').iCheck({
checkboxClass: 'icheckbox-blue',
radioClass: 'iradio-blue',
increaseArea: '20%'
});
$("#tab-system").Huitab({
index: 0
});
});
function addServer() {
var erroCode = $('.ERRINFO');
var _id = $("input[name='_id']").val();
var strategyLink = $("input[name='strategyLink']").val();
var windowLink = $("input[name='windowLink']").val();
var chargeLimit = $("input[name='chargeLimit']").val();
if (_id === '' || _id == null) {
erroCode.html('<span style="color: red; ">服务器id不能为空!</span>');
return false;
}
if (strategyLink === '' || strategyLink == null) {
erroCode.html('<span style="color: red; ">使用链接不能为空!</span>');
return false;
}
if (windowLink === '' || windowLink == null) {
erroCode.html('<span style="color: red; ">使用素材不能为空!</span>');
return false;
}
if (chargeLimit === '' || chargeLimit == null) {
erroCode.html('<span style="color: red; ">展示充值金额不能为空!</span>');
return false;
}
$.ajax({
type: "POST",
data:
JSON.stringify({
"_id": _id,
"strategyLink": strategyLink,
"windowLink": windowLink,
"chargeLimit": chargeLimit,
})
,
url: "/addSecretVolume",
dataType: "json",
contentType: 'application/json',
success: function (data) {
if (data === 0) {
layer.msg('添加成功!', {icon: 6, time: 1000});
}
if (data === 1) {
layer.msg('添加失败!', {icon: 6, time: 1000});
}
if (data === 2) {
layer.msg('添加失败 自动开服请设置开服时间!', {icon: 6, time: 2000});
}
}
}
)
}
</script>
<!--/请在上方写此页面业务相关的脚本-->
</body>
</html>

View File

@ -181,5 +181,6 @@
)
});
</script>
</div>
</body>
</html>

View File

@ -0,0 +1,82 @@
<!DOCTYPE html>
<html lang="en">
<html xmlns:th="http://www.thymeleaf.org">
<head>
<meta charset="utf-8"/>
<meta name="renderer" content="webkit|ie-comp|ie-stand"/>
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"/>
<meta name="viewport"
content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no"/>
<meta http-equiv="Cache-Control" content="no-siteapp"/>
<script type="text/javascript" src="lib/html5shiv.js"></script>
<script type="text/javascript" src="lib/respond.min.js"></script>
<![endif]-->
<link rel="stylesheet" type="text/css" href="h-ui/css/H-ui.min.css"/>
<link rel="stylesheet" type="text/css" href="h-ui.admin/css/H-ui.admin.css"/>
<link rel="stylesheet" type="text/css" href="lib/Hui-iconfont/1.0.8/iconfont.css"/>
<link rel="stylesheet" type="text/css" href="h-ui.admin/skin/default/skin.css" id="skin"/>
<link rel="stylesheet" type="text/css" href="h-ui.admin/css/style.css"/>
<script type="text/javascript" src="lib/DD_belatedPNG_0.0.8a-min.js"></script>
<script>DD_belatedPNG.fix('*');</script>
<title>服务器列表信息</title>
<style>
</style>
</head>
<body>
<nav class="breadcrumb">
<i class="Hui-iconfont">&#xe67f;</i> 首页
<span class="c-gray en">&gt;</span> 太初密卷
<span class="c-gray en">&gt;</span> 太初密卷信息
<a class="btn btn-success radius r" style="line-height:1.6em;margin-top:3px"
href="javascript:location.replace('/getAllSecretVolumeInfo');" title="刷新"><i class="Hui-iconfont">&#xe68f;</i></a></nav>
<div class="page-container" style="text-align: center">
<h2><span style="color:red;">太初秘境信息</span></h2>
<div class="text-c">
<div class="mt-20">
<table class="table table-border table-bordered table-bg table-hover table-sort table-responsive">
<thead>
<tr class="text-c" >
<!--<th width="25"><input type="checkbox" name="" value=""/></th>-->
<!--<th width="200"><input type="checkbox" id="allChecks" onclick="ckAll()" /> 全选</th>-->
<th width="200">窗口</th>
<th width="200">使用链接</th>
<th width="200">使用素材</th>
<th width="200">展示充值额度</th>
<th width="240">操作</th>
</tr>
</thead>
<tbody>
<tr th:each="obj:${secretVolumeInfos}">
<td th:text="${obj._id}" style="text-align: center;"></td>
<td th:text="${obj.strategyLink}" style="text-align: center;"></td>
<td th:text="${obj.windowLink}" style="text-align: center;"></td>
<td th:text="${obj.chargeLimit}" style="text-align: center;"></td>
<td class="td-manage" style="text-align: center;">
<a title="" href="javascript:;"
th:href="@{/toEditSecretVolume(id =${obj._id})}" class="ml-5"
style="text-decoration:none">
<span class="btn btn-primary radius">配置</span></a>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<!--_footer 作为公共模版分离出去-->
<script type="text/javascript" src="lib/jquery/1.9.1/jquery.min.js"></script>
<script type="text/javascript" src="lib/layer/2.4/layer.js"></script>
<script type="text/javascript" src="h-ui/js/H-ui.min.js"></script>
<script type="text/javascript" src="h-ui.admin/js/H-ui.admin.js"></script>
<!--请在下方写此页面业务相关的脚本-->
<script type="text/javascript" src="lib/My97DatePicker/4.8/WdatePicker.js"></script>
<script type="text/javascript" src="lib/datatables/1.10.0/jquery.dataTables.min.js"></script>
<script type="text/javascript" src="lib/laypage/1.2/laypage.js"></script>
</div>
</body>
</html>

View File

@ -0,0 +1,149 @@
<!DOCTYPE HTML>
<html xmlns:th="http://www.thymeleaf.org">
<html>
<head>
<meta charset="utf-8"/>
<meta name="renderer" content="webkit|ie-comp|ie-stand"/>
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"/>
<meta name="viewport"
content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no"/>
<meta http-equiv="Cache-Control" content="no-siteapp"/>
<link rel="Bookmark" href="/favicon.ico"/>
<link rel="Shortcut Icon" href="/favicon.ico"/>
<!--[if lt IE 9]>
<script type="text/javascript" src="lib/html5shiv.js"></script>
<script type="text/javascript" src="lib/respond.min.js"></script>
<![endif]-->
<link rel="stylesheet" type="text/css" href="h-ui/css/H-ui.min.css"/>
<link rel="stylesheet" type="text/css" href="h-ui.admin/css/H-ui.admin.css"/>
<link rel="stylesheet" type="text/css" href="lib/Hui-iconfont/1.0.8/iconfont.css"/>
<link rel="stylesheet" type="text/css" href="h-ui.admin/skin/default/skin.css" id="skin"/>
<link rel="stylesheet" type="text/css" href="h-ui.admin/css/style.css"/>
<!--[if IE 6]>
<script type="text/javascript" src="lib/DD_belatedPNG_0.0.8a-min.js"></script>
<script>DD_belatedPNG.fix('*');</script>
<![endif]-->
<!--/meta 作为公共模版分离出去-->
<title>基本设置</title>
</head>
<body>
<nav class="breadcrumb">
<a href="javascript:;" onclick="history.go(-1)"><i class="Hui-iconfont">&#xe67f;</i> 首页</a>
<span class="c-gray en">&gt;</span>
太初密卷
<span class="c-gray en">&gt;</span>
太初密卷信息
<!--<a class="btn btn-success radius r" style="line-height:1.6em;margin-top:3px" href="javascript:location.replace('/findServerInfo');" title="刷新" ><i class="Hui-iconfont">&#xe68f;</i></a>-->
</nav>
<div class="page-container">
<form class="form form-horizontal" th:object="${secretVolumeInfo}" action="/secretVolumeEdit" method="post">
<div id="tab-system" class="HuiTab">
<div class="tabBar cl">
<span>修改服务器状态</span>
</div>
<div class="tabCon">
<div class="row cl">
<label class="form-label col-xs-4 col-sm-2">
<span class="c-red">*</span>
id</label>
<div class="formControls col-xs-8 col-sm-9">
<input type="text" name="id" placeholder="" th:value="*{_id}" class="input-text"/>
</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="strategyLink" placeholder="" th:value="*{strategyLink}" class="input-text"/>
</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="windowLink" placeholder="" th:value="*{windowLink}" class="input-text"/>
</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="chargeLimit" placeholder="" th:value="*{chargeLimit}" class="input-text"/>
</div>
</div>
</div>
</div>
<div class="row cl">
<div class="col-xs-8 col-sm-9 col-xs-offset-4 col-sm-offset-2">
<button class="btn btn-primary radius" type="submit"><i class="Hui-iconfont">&#xe632;</i> 保存</button>
<button class="btn btn-default radius" type="button"><a href="/getAllSecretVolumeInfo">&nbsp;&nbsp;取消&nbsp;&nbsp;</a>
</button>
</div>
</div>
</form>
</div>
<!--_footer 作为公共模版分离出去-->
<script type="text/javascript" src="lib/jquery/1.9.1/jquery.min.js"></script>
<script type="text/javascript" src="lib/layer/2.4/layer.js"></script>
<script type="text/javascript" src="h-ui/js/H-ui.min.js"></script>
<script type="text/javascript" src="h-ui.admin/js/H-ui.admin.js"></script> <!--/_footer 作为公共模版分离出去-->
<!--请在下方写此页面业务相关的脚本-->
<script type="text/javascript" src="lib/My97DatePicker/4.8/WdatePicker.js"></script>
<script type="text/javascript" src="lib/jquery.validation/1.14.0/jquery.validate.js"></script>
<script type="text/javascript" src="lib/jquery.validation/1.14.0/validate-methods.js"></script>
<script type="text/javascript" src="lib/jquery.validation/1.14.0/messages_zh.js"></script>
<script type="text/javascript">
$(function () {
$('.skin-minimal input').iCheck({
checkboxClass: 'icheckbox-blue',
radioClass: 'iradio-blue',
increaseArea: '20%'
});
$("#tab-system").Huitab({
index: 0
});
});
$(document).ready(function () {
var flag = $("#status").val();
var register_state=$("#register_state").val();
var is_new=$("#is_new").val();
if (register_state === "1"){
$("#register_state1 option[value='" + register_state + "']").attr("selected", "selected");
} else if(register_state === "0"){
$("#register_state1 option[value='" + register_state + "']").attr("selected", "selected");
}
if (is_new === "1"){
$("#is_new1 option[value='" + is_new + "']").attr("selected", "selected");
} else if(register_state === "0"){
$("#is_new1 option[value='" + is_new + "']").attr("selected", "selected");
}
//根据值让option选中
if (flag === "4") {
$("#status1 option[value='" + flag + "']").attr("selected", "selected");
} else if (flag === "3") {
$("#status1 option[value='" + flag + "']").attr("selected", "selected");
} else if (flag === "2") {
$("#status1 option[value='" + flag + "']").attr("selected", "selected");
} else if (flag === "1") {
$("#status1 option[value='" + flag + "']").attr("selected", "selected");
}
});
</script>
<!--/请在上方写此页面业务相关的脚本-->
</body>
</html>