generated from root/miduo_server
设置开服时间
parent
7213bd6d8b
commit
5d9edb1a0d
|
|
@ -41,11 +41,17 @@ public class MailController {
|
|||
public @ResponseBody
|
||||
int getSendMail(HttpSession session, HttpServletRequest request) throws Exception {
|
||||
HashMap<String, String> parameterMap = JsonUtil.getInstence().getParameterMap(request);
|
||||
int serverId = Integer.parseInt(parameterMap.get("serverId"));
|
||||
// int serverId = Integer.parseInt(parameterMap.get("serverId"));
|
||||
String[] userIds = parameterMap.get("userIds").split("#");
|
||||
for (String userId : userIds) {
|
||||
CUser cUser = userInfoDao.findCuserInfo(serverId, Integer.parseInt(userId));
|
||||
CUserInfo cUserInfo = userInfoDao.findUserInfoByUserId(Integer.parseInt(userId));
|
||||
if (cUserInfo == null){
|
||||
LOGGER.info("getSendMail==> uid={}, cuserInfo is null ",userId);
|
||||
continue;
|
||||
}
|
||||
CUser cUser = userInfoDao.findCuserInfo(cUserInfo.getServerid(), Integer.parseInt(userId));
|
||||
if (cUser == null) {
|
||||
LOGGER.info("getSendMail==> uid={}, cUser is null ",userId);
|
||||
continue;
|
||||
}
|
||||
String reward = JsonUtil.getInstence().getReward(request);
|
||||
|
|
@ -54,7 +60,7 @@ public class MailController {
|
|||
}
|
||||
CMail mail = getMail(parameterMap, Integer.parseInt(userId), reward);
|
||||
try {
|
||||
mailDao.sendCMail(mail, serverId);
|
||||
mailDao.sendCMail(mail, cUserInfo.getServerid());
|
||||
} catch (Exception e) {
|
||||
LOGGER.info(e.toString());
|
||||
e.printStackTrace();
|
||||
|
|
|
|||
|
|
@ -42,7 +42,8 @@ public class ServerInfoController {
|
|||
CServerOpenTime cServerOpenTime = RedisUtil.getInstence().getObject(RedisUserKey.SERVER_OPEN_TIME_KEY, Integer.toString(serverInfo.getServer_id()),
|
||||
CServerOpenTime.class, GlobalsDef.REDIS_OVER_TIME);
|
||||
if (cServerOpenTime !=null){
|
||||
serverInfoVo.setOpen_time(JsonUtil.timeStamp2Date(String.valueOf(cServerOpenTime.getOpenTime() * 1000)));
|
||||
long time = (long) cServerOpenTime.getOpenTime() * 1000;
|
||||
serverInfoVo.setOpen_time(JsonUtil.timeStamp2Date(String.valueOf(time)));
|
||||
}else{
|
||||
serverInfoVo.setOpen_time(JsonUtil.timeStamp2Date(String.valueOf(serverInfo.getOpen_time() *1000)));
|
||||
}
|
||||
|
|
@ -81,25 +82,33 @@ public class ServerInfoController {
|
|||
map.addAttribute("serverInfos", serverInfoVos);
|
||||
return "findServerInfo";
|
||||
}
|
||||
@RequestMapping(value = "/closeWhite", method = {RequestMethod.POST, RequestMethod.GET})
|
||||
public @ResponseBody int closeWhite(HttpSession session,int server_id){
|
||||
@RequestMapping(value = "/toSetOpenServerTime", method = {RequestMethod.POST, RequestMethod.GET})
|
||||
public String toSetOpenServerTime(HttpSession session, ModelMap map, int id) throws Exception {
|
||||
ServerInfo serverInfo = serverInfoDao.getServerinfo(id);
|
||||
map.addAttribute("serverInfo",serverInfo);
|
||||
return "setOpenServerTime";
|
||||
}
|
||||
@RequestMapping(value = "/setOpenServerTime", method = {RequestMethod.POST, RequestMethod.GET})
|
||||
public @ResponseBody int setOpenServerTime(HttpSession session,HttpServletRequest request){
|
||||
try {
|
||||
serverInfoDao.closeServerWhite(server_id);
|
||||
return 1;
|
||||
int serverId = Integer.parseInt(request.getParameter("serverId"));
|
||||
long time = Long.parseLong(JsonUtil.date3TimeStamp(request.getParameter("openTime")));
|
||||
long zero = JsonUtil.getAppointTimeInXDay(time, 0);
|
||||
int openTime = (int) (zero / 1000);
|
||||
CServerOpenTime cServerOpenTime = serverInfoDao.getOpenServerTime(serverId);
|
||||
if (cServerOpenTime == null){
|
||||
cServerOpenTime = new CServerOpenTime();
|
||||
cServerOpenTime.setId(serverId);
|
||||
cServerOpenTime.setOpenTime(openTime);
|
||||
serverInfoDao.addOpenServerTime(cServerOpenTime);
|
||||
}else {
|
||||
cServerOpenTime.setOpenTime(openTime);
|
||||
serverInfoDao.updateOpenServerTime(cServerOpenTime);
|
||||
}
|
||||
return 0;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return 2;
|
||||
}
|
||||
}
|
||||
@RequestMapping(value = "/openWhite", method = {RequestMethod.POST, RequestMethod.GET})
|
||||
public @ResponseBody int openWhite(HttpSession session, ModelMap map, int server_id){
|
||||
try {
|
||||
serverInfoDao.openServerWhite(server_id);
|
||||
return 1;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return 2;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
package com.jmfy.dao;
|
||||
|
||||
|
||||
import com.jmfy.model.CServerOpenTime;
|
||||
import com.jmfy.model.ServerInfo;
|
||||
|
||||
import java.util.List;
|
||||
|
|
@ -15,4 +16,11 @@ public interface ServerInfoDao {
|
|||
void openServerWhite(int server_id) throws Exception;
|
||||
|
||||
void updateServerInfo(int server_id, int status,int isWhite,int isCommend) throws Exception;
|
||||
|
||||
void updateOpenServerTime(CServerOpenTime cServerOpenTime) throws Exception;
|
||||
|
||||
CServerOpenTime getOpenServerTime(int serverId) throws Exception;
|
||||
|
||||
void addOpenServerTime(CServerOpenTime cServerOpenTime) throws Exception;
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,8 +1,11 @@
|
|||
package com.jmfy.dao.impl;
|
||||
|
||||
import com.jmfy.dao.ServerInfoDao;
|
||||
import com.jmfy.model.CServerOpenTime;
|
||||
import com.jmfy.model.ServerInfo;
|
||||
import com.jmfy.redisProperties.RedisUserKey;
|
||||
import com.jmfy.utils.Connect;
|
||||
import com.jmfy.utils.RedisUtil;
|
||||
import org.springframework.data.mongodb.core.MongoTemplate;
|
||||
import org.springframework.data.mongodb.core.query.Criteria;
|
||||
import org.springframework.data.mongodb.core.query.Query;
|
||||
|
|
@ -64,4 +67,32 @@ public class ServerInfoDaoImpl implements ServerInfoDao {
|
|||
mongoTemplate.updateMulti(query, update, ServerInfo.class);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateOpenServerTime(CServerOpenTime cServerOpenTime) throws Exception {
|
||||
RedisUtil.getInstence().putObject(RedisUserKey.SERVER_OPEN_TIME_KEY, Integer.toString(cServerOpenTime.getId()), cServerOpenTime,-1);
|
||||
MongoTemplate mongoTemplate = connect.getMongoTemplete(dbName);
|
||||
Query query = new Query(Criteria.where("server_id").is(cServerOpenTime.getId()));
|
||||
Update update = new Update();
|
||||
update.set("openTime",cServerOpenTime.getOpenTime());
|
||||
mongoTemplate.updateMulti(query, update, ServerInfo.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CServerOpenTime getOpenServerTime(int serverId) throws Exception {
|
||||
CServerOpenTime cServerOpenTime = RedisUtil.getInstence().getObject(RedisUserKey.SERVER_OPEN_TIME_KEY, Integer.toString(serverId),
|
||||
CServerOpenTime.class, -1);
|
||||
if (cServerOpenTime == null) {
|
||||
MongoTemplate mongoTemplate = connect.getMongoTemplete(dbName);
|
||||
cServerOpenTime = mongoTemplate.findById(serverId, CServerOpenTime.class);
|
||||
}
|
||||
return cServerOpenTime;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addOpenServerTime(CServerOpenTime cServerOpenTime) throws Exception {
|
||||
RedisUtil.getInstence().putObject(RedisUserKey.SERVER_OPEN_TIME_KEY, Integer.toString(cServerOpenTime.getId()), cServerOpenTime,-1);
|
||||
MongoTemplate mongoTemplate = connect.getMongoTemplete(dbName);
|
||||
mongoTemplate.insert(cServerOpenTime);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -122,4 +122,14 @@ public class JsonUtil {
|
|||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
return sdf.format(new Date(Long.valueOf(seconds)));
|
||||
}
|
||||
//
|
||||
public static long getAppointTimeInXDay(long date, int hour) {
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
calendar.setTimeInMillis(date);
|
||||
calendar.set(Calendar.HOUR_OF_DAY, hour);
|
||||
calendar.set(Calendar.MINUTE, 0);
|
||||
calendar.set(Calendar.SECOND, 0);
|
||||
calendar.set(Calendar.MILLISECOND, 0);
|
||||
return calendar.getTimeInMillis();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -41,15 +41,15 @@
|
|||
<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="serverId" placeholder="服务器serverid" value="" class="input-text"/>
|
||||
<span class="SERVERID"></span>
|
||||
</div>
|
||||
</div>
|
||||
<!--<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="serverId" placeholder="服务器serverid" value="" class="input-text"/>-->
|
||||
<!--<span class="SERVERID"></span>-->
|
||||
<!--</div>-->
|
||||
<!--</div>-->
|
||||
<div class="row cl">
|
||||
<label class="form-label col-xs-4 col-sm-2">
|
||||
<span class="c-red">*</span>
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@
|
|||
<th width="200">服务器状态</th>
|
||||
<th width="200">是否白名单</th>
|
||||
<th width="200">是否推荐服</th>
|
||||
<th width="200">操作</th>
|
||||
<th width="240">操作</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
|
|
@ -62,8 +62,10 @@
|
|||
<span th:case="1" class="label label-success radius">是</span>
|
||||
</th>
|
||||
<td class="td-manage">
|
||||
<a title="修改服务器状态" href="javascript:;" th:href="@{/toServerInfoEdit(id =${obj.server_id},status = ${obj.status} ,isWhite= ${obj.isWhite})}" class="ml-5" style="text-decoration:none">
|
||||
<i class="Hui-iconfont"></i></a>
|
||||
<a title="" href="javascript:;" th:href="@{/toServerInfoEdit(id =${obj.server_id},status = ${obj.status} ,isWhite= ${obj.isWhite})}" class="ml-5" style="text-decoration:none">
|
||||
<span class="btn btn-primary radius" >修改服务器状态</span></a>
|
||||
<!--<a title="" href="javascript:;" th:href="@{/toSetOpenServerTime(id =${obj.server_id})}" class="ml-5" style="text-decoration:none">-->
|
||||
<!--<span class="btn btn-primary radius">设置开服时间</span></i></a>-->
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
|
|
@ -90,41 +92,6 @@ $('.table-sort').dataTable({
|
|||
// {"orderable":false,"aTargets":[0,0]}// 不参与排序的列
|
||||
]
|
||||
});
|
||||
/*开启白名单*/
|
||||
function picture_start(obj,server_id){
|
||||
server_id = $(obj).attr("id");
|
||||
layer.confirm('确认要开启吗?',function(){
|
||||
$(obj).parents("tr").find(".td-status").html('<a th:id="${obj.server_id}" onClick="product_stop(this)" href="javascript:;" title="关闭白名单"><span class="label label-success radius">已开启</span></a>');
|
||||
$.post("/openWhite",{"server_id":server_id},function(data){
|
||||
if (data == 1){
|
||||
$(obj).remove();
|
||||
$.post("/findServerInfo",function(){
|
||||
|
||||
});
|
||||
layer.msg('已开启!',{icon: 6,time:1000});
|
||||
}
|
||||
if (data == 2){
|
||||
layer.msg('操作失败!',{icon: 6,time:1000});
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
/*关闭白名单*/
|
||||
function product_stop(obj,server_id){
|
||||
server_id = $(obj).attr("id");
|
||||
layer.confirm('确认要关闭吗?', function (index) {
|
||||
$(obj).parents("tr").find(".td-status").html('<a th:id="${obj.server_id}" onClick="picture_start(this)" href="javascript:;" title="开启白名单"> <span class="label label-defaunt radius">已关闭</span></a>');
|
||||
$.post("/closeWhite", {"server_id": server_id}, function (data) {
|
||||
if (data == 1){
|
||||
$(obj).remove();
|
||||
layer.msg('已关闭!', {icon: 5, time: 1000});
|
||||
}
|
||||
if (data ==2){
|
||||
layer.msg('操作失败!',{icon: 6,time:1000});
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -132,7 +132,7 @@
|
|||
<dt><i class="Hui-iconfont"></i> GM管理<i class="Hui-iconfont menu_dropdown-arrow"></i></dt>
|
||||
<dd>
|
||||
<ul>
|
||||
<li><a data-href="/html/sendMail.html" data-title="发送邮件" href="javascript:;">发送邮件</a></li>
|
||||
<li><a data-href="/html/sendMail.html" data-title="单人,多人邮件" href="javascript:;">单人,多人邮件</a></li>
|
||||
<li><a data-href="/html/sendSysMail.html" data-title="全服邮件" href="javascript:;">全服邮件</a></li>
|
||||
<li><a data-href="/html/recoverItem.html" data-title="回收道具" href="javascript:;">回收道具</a></li>
|
||||
</ul>
|
||||
|
|
|
|||
|
|
@ -0,0 +1,125 @@
|
|||
<!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="../static/lib/html5shiv.js"></script>
|
||||
<script type="text/javascript" src="../static/lib/respond.min.js"></script>
|
||||
<![endif]-->
|
||||
<link rel="stylesheet" type="text/css" href="../static/h-ui/css/H-ui.min.css" />
|
||||
<link rel="stylesheet" type="text/css" href="../static/h-ui.admin/css/H-ui.admin.css" />
|
||||
<link rel="stylesheet" type="text/css" href="../static/lib/Hui-iconfont/1.0.8/iconfont.css" />
|
||||
<link rel="stylesheet" type="text/css" href="../static/h-ui.admin/skin/default/skin.css" id="skin" />
|
||||
<link rel="stylesheet" type="text/css" href="../static/h-ui.admin/css/style.css" />
|
||||
<!--[if IE 6]>
|
||||
<script type="text/javascript" src="../static/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"></i> 首页</a>
|
||||
<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('/findServerInfo');" title="刷新" ><i class="Hui-iconfont"></i></a>-->
|
||||
</nav>
|
||||
|
||||
<div class="page-container">
|
||||
<form class="form form-horizontal" th:object="${serverInfo}" 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="serverId" placeholder="" th:value="*{server_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>
|
||||
<input type="text" onfocus="WdatePicker({ dateFmt:'yyyy-MM-dd HH:mm:ss', minDate:'#F{$dp.$D(\'openTime\')||\'%y-%M-%d\'}' })" id="openTime" name="openTime" class="input-text Wdate" style="width:180px;">
|
||||
</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="button" onclick="return setOpenTime();" >
|
||||
<i class="Hui-iconfont"></i> 保存</button>
|
||||
<button class="btn btn-default radius" type="button"><a href="/findServerInfo"> 取消 </a></button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
|
||||
<!--_footer 作为公共模版分离出去-->
|
||||
<script type="text/javascript" src="../static/lib/jquery/1.9.1/jquery.min.js"></script>
|
||||
<script type="text/javascript" src="../static/lib/layer/2.4/layer.js"></script>
|
||||
<script type="text/javascript" src="../static/h-ui/js/H-ui.min.js"></script>
|
||||
<script type="text/javascript" src="../static/h-ui.admin/js/H-ui.admin.js"></script> <!--/_footer 作为公共模版分离出去-->
|
||||
|
||||
<!--请在下方写此页面业务相关的脚本-->
|
||||
<script type="text/javascript" src="../static/lib/My97DatePicker/4.8/WdatePicker.js"></script>
|
||||
<script type="text/javascript" src="../static/lib/jquery.validation/1.14.0/jquery.validate.js"></script>
|
||||
<script type="text/javascript" src="../static/lib/jquery.validation/1.14.0/validate-methods.js"></script>
|
||||
<script type="text/javascript" src="../static/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 setOpenTime() {
|
||||
var serverId = $("input[name='serverId']").val();
|
||||
var openTime = $("input[name='openTime']").val();
|
||||
if (openTime === '' || openTime == null) {
|
||||
erroCode = $('.ENDTIME');
|
||||
erroCode.html('<span style="color: red; ">开服时间不能为空!</span>');
|
||||
return false;
|
||||
}
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
data: {
|
||||
"serverId": serverId ,
|
||||
"openTime": openTime
|
||||
},
|
||||
url: "/setOpenServerTime",
|
||||
success: function (data) {
|
||||
if (data === 0) {
|
||||
layer.msg('设置开服时间成功!', {icon: 6, time: 1000});
|
||||
}
|
||||
if (data === 1) {
|
||||
layer.msg('设置开服时间失败!', {icon: 6, time: 1000});
|
||||
}
|
||||
}
|
||||
}
|
||||
)
|
||||
return true;
|
||||
}
|
||||
</script>
|
||||
<!--/请在上方写此页面业务相关的脚本-->
|
||||
</body>
|
||||
</html>
|
||||
Loading…
Reference in New Issue