generated from root/miduo_server
gm修改
parent
c4e6475c56
commit
173aff641a
|
|
@ -47,6 +47,7 @@ public class Application extends SpringBootServletInitializer {
|
|||
ScheduledExecutorService scheduledExecutorService = Executors.newSingleThreadScheduledExecutor();
|
||||
MinuteTask minuteTask = configurableApplicationContext.getBean(MinuteTask.class);
|
||||
scheduledExecutorService.scheduleWithFixedDelay(minuteTask,30,10, TimeUnit.SECONDS);
|
||||
FileCacheUtils.initData();
|
||||
// FileCacheUtils.initData();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -37,9 +37,11 @@ public class CdkInfoController {
|
|||
|
||||
@RequestMapping(value = "/toAddCDKGoodsPage",method = RequestMethod.GET)
|
||||
public String toAddCDKGoodsPage(ModelMap map){
|
||||
Map<Integer, String> itemNameMap = FileCacheUtils.itemNameMap;
|
||||
try {
|
||||
List<ServerInfo> allServerInfo = serverInfoDao.getAllServerInfo();
|
||||
map.addAttribute("serverInfo",allServerInfo);
|
||||
map.addAttribute("itemNameMap",itemNameMap);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
|
@ -79,6 +81,10 @@ public class CdkInfoController {
|
|||
return 0;
|
||||
}
|
||||
|
||||
@RequestMapping(value = "deleteCdkNumber",method = {RequestMethod.POST})
|
||||
public @ResponseBody int deleteCdkNumber(ModelMap map,int goodsId) throws Exception {
|
||||
return cdkInfoDao.deleteCdk(goodsId);
|
||||
}
|
||||
@RequestMapping(value = "/findCdkInfo", method = {RequestMethod.POST, RequestMethod.GET})
|
||||
public String findCdkInfo (HttpSession session, ModelMap map , HttpServletRequest request) throws Exception {
|
||||
HashMap<String, String> parameterMap = JsonUtil.getInstence().getParameterMap(request);
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ import com.jmfy.model.ServerInfo;
|
|||
import com.jmfy.model.ServerMail;
|
||||
import com.jmfy.model.vo.ServerMailVo;
|
||||
import com.jmfy.model.vo.ServerPMailVo;
|
||||
import com.jmfy.utils.FileCacheUtils;
|
||||
import com.jmfy.utils.JsonUtil;
|
||||
import com.jmfy.utils.SeqUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
|
@ -20,10 +21,7 @@ import javax.annotation.Resource;
|
|||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpSession;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.*;
|
||||
|
||||
@Controller
|
||||
public class MailController {
|
||||
|
|
@ -40,9 +38,11 @@ public class MailController {
|
|||
|
||||
@RequestMapping(value = "/toMailPage",method = RequestMethod.GET)
|
||||
public String toMailPage(ModelMap map,Integer type){
|
||||
Map<Integer, String> itemNameMap = FileCacheUtils.itemNameMap;
|
||||
try {
|
||||
List<ServerInfo> allServerInfo = serverInfoDao.getAllServerInfo();
|
||||
map.addAttribute("serverInfo",allServerInfo);
|
||||
map.addAttribute("itemNameMap",itemNameMap);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -27,4 +27,6 @@ public interface CdkInfoDao {
|
|||
SCdkInfo getScdkInfo(int goodsId) throws Exception;
|
||||
|
||||
void updateCdkGoodsInfo(SCdkInfo scdkInfo,int goodsId) throws Exception;
|
||||
|
||||
int deleteCdk(int goodsId) throws Exception;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ package com.jmfy.dao.impl;
|
|||
import com.jmfy.dao.CdkInfoDao;
|
||||
import com.jmfy.model.*;
|
||||
import com.jmfy.utils.Connect;
|
||||
import com.mongodb.WriteResult;
|
||||
import org.springframework.data.mongodb.core.MongoTemplate;
|
||||
import org.springframework.data.mongodb.core.query.Criteria;
|
||||
import org.springframework.data.mongodb.core.query.Query;
|
||||
|
|
@ -109,4 +110,15 @@ public class CdkInfoDaoImpl implements CdkInfoDao {
|
|||
// Query query = new Query(Criteria.where("_id").is(goodsId));
|
||||
// mongoTemplate.updateMulti(query, update, SCdkInfo.class);
|
||||
}
|
||||
@Override
|
||||
public int deleteCdk(int goodsId) throws Exception{
|
||||
MongoTemplate mongoTemplate = connect.getMongoTemplete(Constant.dbName);
|
||||
Query query = new Query();
|
||||
Criteria cr = new Criteria();
|
||||
cr.andOperator(Criteria.where("_id").is(goodsId));
|
||||
query.addCriteria(cr);
|
||||
mongoTemplate.remove(query,SCdkInfo.class);
|
||||
return 1;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@
|
|||
<a class="btn btn-success radius r" style="line-height:1.6em;margin-top:3px" href="javascript:location.replace('/toCDKBuild');" title="刷新" >
|
||||
<i class="Hui-iconfont"></i></a></nav>
|
||||
<div class="page-container" style="text-align: center">
|
||||
<h2><span style="color:red;">序列號生成</span></h2>
|
||||
<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">
|
||||
|
|
@ -63,8 +63,9 @@
|
|||
<td th:text="${obj.roleUseNum}" style="text-align: center;"></td>
|
||||
<td th:text="${obj.buildTime=='0'?'暂未生成':obj.buildTime}" style="text-align: center;"></td>
|
||||
<td style="text-align: center; width: 300px">
|
||||
<button type="button" th:id="${obj.id}" class="btn btn-primary" onclick="return cdkAdd(this)"><i class="Hui-iconfont"></i> 序列號生成</button>
|
||||
<button type="button" th:id="${obj.id}" class="btn btn-success" onclick="return download(this)"><i class="Hui-iconfont"></i> 序列號导出</button>
|
||||
<button type="button" th:id="${obj.id}" class="btn btn-primary" onclick="return cdkAdd(this)"><i class="Hui-iconfont"></i> 序列号生成</button>
|
||||
<button type="button" th:id="${obj.id}" class="btn btn-success" onclick="return download(this)"><i class="Hui-iconfont"></i> 序列号导出</button>
|
||||
<button type="button" th:id="${obj.id}" class="btn btn-warning" onclick="return deleteCdk(this)"><i class="Hui-iconfont"></i> 删除</button>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
|
|
@ -144,6 +145,26 @@
|
|||
$("body").append(form);
|
||||
form.submit();
|
||||
}
|
||||
function deleteCdk(obj, goodsId) {
|
||||
goodsId = $(obj).attr("id");
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
data: {"goodsId": goodsId},
|
||||
url: "/deleteCdkNumber",
|
||||
success: function (data) {
|
||||
if (data == 1) {
|
||||
window.location.reload(); //刷新页面
|
||||
layer.msg('删除成功!', {icon: 6, time: 1000});
|
||||
}
|
||||
if(data==0){
|
||||
layer.error('此礼包不存在,请刷新页面', {icon: 6, time: 1000});
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -102,13 +102,19 @@
|
|||
附件:</label>
|
||||
<div class="formControls col-xs-8 col-sm-9">
|
||||
<div id="InputsWrapper">
|
||||
<div>
|
||||
物品id:<input type="text" name="itemId" id="itemId_1" style="width: 150px" />
|
||||
物品数量:<input type="text" name="itemNum" id="itemNum_1" style="width: 150px" />
|
||||
物品类型:<input type="text" name="itemType" id="itemType_1" style="width: 150px"/>
|
||||
<a href="#" class="removeclass"></a>
|
||||
<a href="#" id="AddMoreFileBox" class="btn btn-info">+</a>
|
||||
<span class="REWARD"></span>
|
||||
<div th:each="i:${#numbers.sequence(1,5)}">
|
||||
<div th:style="${i} ne 1?'display:none':''" th:id="item_+(${i})">
|
||||
物品id:
|
||||
<select name="itemIds[]" style="width: 150px" th:id="itemId_+(${i})"><!--下拉列表-->
|
||||
<option value="0" selected = "selected">0.无物品</option>
|
||||
<option th:each="item:${itemNameMap}" th:value="${item.key}" th:text="${item.key}+.+${item.value}"></option>
|
||||
</select>
|
||||
<!--<input type="text" name="itemIds[]" id="itemId_1" style="width: 150px" />-->
|
||||
物品数量:<input type="text" name="itemNums[]" th:id="itemNum_+(${i})" style="width: 150px" />
|
||||
<a href="#" th:if="${i} ne 1" class="removeclass">×</a>
|
||||
<a href="#" th:if="${i} eq 1" id="AddMoreFileBox" class="btn btn-info">+</a>
|
||||
<span class="REWARD"></span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -171,29 +177,28 @@
|
|||
});
|
||||
|
||||
$(document).ready(function() {
|
||||
var MaxInputs = 20;
|
||||
var InputsWrapper = $("#InputsWrapper");
|
||||
var AddButton = $("#AddMoreFileBox");
|
||||
var MaxInputs = 5; //maximum input boxes allowed
|
||||
var AddButton = $("#AddMoreFileBox"); //Add button ID
|
||||
|
||||
var x = InputsWrapper.length;
|
||||
var FieldCount=1;
|
||||
var item = "#item_";
|
||||
var x = 2; //initlal text box count
|
||||
|
||||
$(AddButton).click(function (e)
|
||||
$(AddButton).click(function (e) //on add input button click
|
||||
{
|
||||
if(x <= MaxInputs)
|
||||
console.log(x);
|
||||
if(x <= MaxInputs) //max input box allowed
|
||||
{
|
||||
FieldCount++;
|
||||
$(InputsWrapper).append('<div>' +
|
||||
'物品id:<input type="text" name="itemId" id="itemId_'+ FieldCount +'" style="width: 150px" /> ' +
|
||||
'物品数量:<input type="text" name="itemNum" id="itemNum_'+FieldCount+'" style="width: 150px" /> 物品类型:<input type="text" name="itemType" id="itemType_'+FieldCount+'" style="width: 150px" /><a href="#" class="removeclass">×</a></div>');
|
||||
//add input box
|
||||
$(item+x).css("display","block");
|
||||
x++;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
});
|
||||
$("body").on("click",".removeclass", function(e){ //user click on remove text
|
||||
if( x > 1 ) {
|
||||
$(this).parent('div').remove(); //remove text box
|
||||
if( x > 2 ) {
|
||||
x--; //decrement textbox
|
||||
$(item+x).css("display","none"); //remove text box
|
||||
}
|
||||
return false;
|
||||
})
|
||||
|
|
@ -213,17 +218,20 @@
|
|||
var effectTime = $("input[name='effectTime']").val();
|
||||
var version = $("input[name='version']").val();
|
||||
var itemIds = [];
|
||||
$("input[name='itemId']").each(function () {
|
||||
itemIds.push($(this).val());
|
||||
$("select[name='itemId']").each(function () {
|
||||
if($(this).val()!=='0'){
|
||||
itemIds.push($(this).val());
|
||||
}
|
||||
});
|
||||
var itemNums =[];
|
||||
$("input[name='itemNum']").each(function(){
|
||||
itemNums.push($(this).val());
|
||||
});
|
||||
var itemTypes =[];
|
||||
$("input[name='itemType']").each(function(){
|
||||
itemTypes.push($(this).val());
|
||||
if($(this).val()!=='') {
|
||||
itemNums.push($(this).val());
|
||||
}
|
||||
});
|
||||
if(itemNums.length!==itemIds.length){
|
||||
erroCode.html('<span style="color: red; ">物品id或物品数量不匹配</span>');
|
||||
}
|
||||
if (serverId === '' || serverId == null) {
|
||||
erroCode.html('<span style="color: red; ">服务器id不能为空!</span>');
|
||||
return false;
|
||||
|
|
@ -261,7 +269,6 @@
|
|||
"userId":userId,
|
||||
"itemIds": itemIds,
|
||||
"itemNums": itemNums,
|
||||
// "itemTypes[]": itemTypes,
|
||||
"sendTime": sendTime,
|
||||
"playerRTime": playerRTime,
|
||||
"effectTime": effectTime,
|
||||
|
|
|
|||
|
|
@ -93,13 +93,19 @@
|
|||
附件:</label>
|
||||
<div class="formControls col-xs-8 col-sm-9">
|
||||
<div id="InputsWrapper">
|
||||
<div>
|
||||
物品id:<input type="text" name="itemId" id="itemId_1" style="width: 150px" />
|
||||
物品数量:<input type="text" name="itemNum" id="itemNum_1" style="width: 150px" />
|
||||
物品类型:<input type="text" name="itemType" id="itemType_1" style="width: 150px"/>
|
||||
<a href="#" class="removeclass"></a>
|
||||
<a href="#" id="AddMoreFileBox" class="btn btn-info">+</a>
|
||||
<span class="REWARD"></span>
|
||||
<div th:each="i:${#numbers.sequence(1,5)}">
|
||||
<div th:style="${i} ne 1?'display:none':''" th:id="item_+(${i})">
|
||||
物品id:
|
||||
<select name="itemId" style="width: 150px" th:id="itemId_+(${i})"><!--下拉列表-->
|
||||
<option value="0" selected = "selected">0.无物品</option>
|
||||
<option th:each="item:${itemNameMap}" th:value="${item.key}" th:text="${item.key}+.+${item.value}"></option>
|
||||
</select>
|
||||
<!--<input type="text" name="itemIds[]" id="itemId_1" style="width: 150px" />-->
|
||||
物品数量:<input type="text" name="itemNum" th:id="itemNum_+(${i})" style="width: 150px" />
|
||||
<a href="#" th:if="${i} ne 1" class="removeclass">×</a>
|
||||
<a href="#" th:if="${i} eq 1" id="AddMoreFileBox" class="btn btn-info">+</a>
|
||||
<span class="REWARD"></span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -171,37 +177,35 @@ $(function(){
|
|||
});
|
||||
|
||||
$(document).ready(function() {
|
||||
var MaxInputs = 20;
|
||||
var InputsWrapper = $("#InputsWrapper");
|
||||
var AddButton = $("#AddMoreFileBox");
|
||||
var MaxInputs = 5; //maximum input boxes allowed
|
||||
var AddButton = $("#AddMoreFileBox"); //Add button ID
|
||||
|
||||
var x = InputsWrapper.length;
|
||||
var FieldCount=1;
|
||||
var item = "#item_";
|
||||
var x = 2; //initlal text box count
|
||||
|
||||
$(AddButton).click(function (e)
|
||||
$(AddButton).click(function (e) //on add input button click
|
||||
{
|
||||
if(x <= MaxInputs)
|
||||
console.log(x);
|
||||
if(x <= MaxInputs) //max input box allowed
|
||||
{
|
||||
FieldCount++;
|
||||
$(InputsWrapper).append('<div>' +
|
||||
'物品id:<input type="text" name="itemId" id="itemId_'+ FieldCount +'" style="width: 150px" /> ' +
|
||||
'物品数量:<input type="text" name="itemNum" id="itemNum_'+FieldCount+'" style="width: 150px" /> 物品类型:<input type="text" name="itemType" id="itemType_'+FieldCount+'" style="width: 150px" /><a href="#" class="removeclass">×</a></div>');
|
||||
//add input box
|
||||
$(item+x).css("display","block");
|
||||
x++;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
});
|
||||
$("body").on("click",".removeclass", function(e){ //user click on remove text
|
||||
if( x > 1 ) {
|
||||
$(this).parent('div').remove(); //remove text box
|
||||
if( x > 2 ) {
|
||||
x--; //decrement textbox
|
||||
$(item+x).css("display","none"); //remove text box
|
||||
}
|
||||
return false;
|
||||
})
|
||||
|
||||
});
|
||||
function sendSysMail() {
|
||||
var erroCode = $('.SERVERID');
|
||||
var serverId = $("input[name='serverId']").val();
|
||||
var serverId = $("#serverId").val();
|
||||
var mailTitle = $("input[name='mailTitle']").val();
|
||||
var mailContent = $("textarea[name='mailContent']").val();
|
||||
var attach = $("input[name='attach']").val();
|
||||
|
|
@ -211,16 +215,16 @@ function sendSysMail() {
|
|||
var effectTime = $("input[name='effectTime']").val();
|
||||
var version = $("input[name='version']").val();
|
||||
var itemIds = [];
|
||||
$("input[name='itemId']").each(function () {
|
||||
itemIds.push($(this).val());
|
||||
$("select[name='itemId']").each(function () {
|
||||
if($(this).val()!=='0'){
|
||||
itemIds.push($(this).val());
|
||||
}
|
||||
});
|
||||
var itemNums =[];
|
||||
$("input[name='itemNum']").each(function(){
|
||||
itemNums.push($(this).val());
|
||||
});
|
||||
var itemTypes =[];
|
||||
$("input[name='itemType']").each(function(){
|
||||
itemTypes.push($(this).val());
|
||||
if($(this).val()!=='') {
|
||||
itemNums.push($(this).val());
|
||||
}
|
||||
});
|
||||
if (serverId === '' || serverId == null) {
|
||||
erroCode.html('<span style="color: red; ">服务器id不能为空!</span>');
|
||||
|
|
@ -258,7 +262,6 @@ function sendSysMail() {
|
|||
"isAttach": isAttach,
|
||||
"itemIds": itemIds,
|
||||
"itemNums": itemNums,
|
||||
// "itemTypes[]": itemTypes,
|
||||
"sendTime": sendTime,
|
||||
"playerRTime": playerRTime,
|
||||
"effectTime": effectTime,
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@
|
|||
<body>
|
||||
<nav class="breadcrumb"><i class="Hui-iconfont"></i> 首页
|
||||
<span class="c-gray en">></span>
|
||||
序列號管理
|
||||
序列号管理
|
||||
<span class="c-gray en">></span>
|
||||
序列号礼包生成
|
||||
<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"></i></a>
|
||||
|
|
@ -133,12 +133,18 @@
|
|||
礼包奖励:</label>
|
||||
<div class="formControls col-xs-8 col-sm-9">
|
||||
<div id="InputsWrapper">
|
||||
<div>
|
||||
物品id:<input type="text" name="itemIds[]" id="itemId_1" style="width: 150px" />
|
||||
物品数量:<input type="text" name="itemNums[]" id="itemNum_1" style="width: 150px" />
|
||||
<a href="#" class="removeclass"></a>
|
||||
<a href="#" id="AddMoreFileBox" class="btn btn-info">+</a>
|
||||
<span class="REWARD"></span>
|
||||
<div th:each="i:${#numbers.sequence(1,5)}">
|
||||
<div th:style="${i} ne 1?'display:none':''" th:id="item_+(${i})">
|
||||
物品id:
|
||||
<select name="itemIds[]" style="width: 150px" th:id="itemId_+(${i})"><!--下拉列表-->
|
||||
<option th:each="item:${itemNameMap}" th:value="${item.key}" th:text="${item.key}+.+${item.value}"></option>
|
||||
</select>
|
||||
<!--<input type="text" name="itemIds[]" id="itemId_1" style="width: 150px" />-->
|
||||
物品数量:<input type="text" name="itemNums[]" th:id="itemNum_+(${i})" style="width: 150px" />
|
||||
<a href="#" th:if="${i} ne 1" class="removeclass">×</a>
|
||||
<a href="#" th:if="${i} eq 1" id="AddMoreFileBox" class="btn btn-info">+</a>
|
||||
<span class="REWARD"></span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -190,28 +196,28 @@ $('#sendNotice').load(function () {
|
|||
}
|
||||
})
|
||||
$(document).ready(function() {
|
||||
var MaxInputs = 20; //maximum input boxes allowed
|
||||
var InputsWrapper = $("#InputsWrapper"); //Input boxes wrapper ID
|
||||
var MaxInputs = 5; //maximum input boxes allowed
|
||||
var AddButton = $("#AddMoreFileBox"); //Add button ID
|
||||
|
||||
var x = InputsWrapper.length; //initlal text box count
|
||||
var FieldCount=1; //to keep track of text box added
|
||||
var item = "#item_";
|
||||
var x = 2; //initlal text box count
|
||||
|
||||
$(AddButton).click(function (e) //on add input button click
|
||||
{
|
||||
console.log(x);
|
||||
if(x <= MaxInputs) //max input box allowed
|
||||
{
|
||||
FieldCount++; //text box added increment
|
||||
//add input box
|
||||
$(InputsWrapper).append('<div>物品id:<input type="text" name="itemIds[]" id="itemId_'+ FieldCount +'" style="width: 150px" /> 物品数量:<input type="text" name="itemNums[]" id="itemNum_'+FieldCount+'" style="width: 150px" /><a href="#" class="removeclass">×</a></div>');
|
||||
x++; //text box increment
|
||||
$(item+x).css("display","block");
|
||||
x++;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
});
|
||||
$("body").on("click",".removeclass", function(e){ //user click on remove text
|
||||
if( x > 1 ) {
|
||||
$(this).parent('div').remove(); //remove text box
|
||||
if( x > 2 ) {
|
||||
x--; //decrement textbox
|
||||
$(item+x).css("display","none"); //remove text box
|
||||
}
|
||||
return false;
|
||||
})
|
||||
|
|
|
|||
Loading…
Reference in New Issue