generated from root/miduo_server
开服时间展示
parent
1e0a26a274
commit
9f3e1d5c58
|
|
@ -1,7 +1,15 @@
|
|||
package com.jmfy.controller;
|
||||
|
||||
import ch.qos.logback.core.util.TimeUtil;
|
||||
import com.jmfy.dao.ServerInfoDao;
|
||||
import com.jmfy.model.CServerOpenTime;
|
||||
import com.jmfy.model.ServerInfo;
|
||||
import com.jmfy.model.vo.ServerInfoVo;
|
||||
import com.jmfy.redisProperties.GlobalsDef;
|
||||
import com.jmfy.redisProperties.RedisUserKey;
|
||||
import com.jmfy.utils.JsonUtil;
|
||||
import com.jmfy.utils.RedisUtil;
|
||||
import org.springframework.data.redis.core.TimeoutUtils;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.ModelMap;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
|
@ -23,7 +31,23 @@ public class ServerInfoController {
|
|||
@RequestMapping(value = "/findServerInfo", method = {RequestMethod.POST, RequestMethod.GET})
|
||||
public String loginVerify(HttpSession session, ModelMap map) throws Exception {
|
||||
List<ServerInfo> serverInfos = serverInfoDao.getAllServerInfo();
|
||||
map.addAttribute("serverInfos", serverInfos);
|
||||
List<ServerInfoVo> serverInfoVos = new ArrayList<>();
|
||||
for (ServerInfo serverInfo :serverInfos){
|
||||
ServerInfoVo serverInfoVo = new ServerInfoVo();
|
||||
serverInfoVo.setServer_id(serverInfo.getServer_id());
|
||||
serverInfoVo.setName(serverInfo.getName());
|
||||
serverInfoVo.setStatus(serverInfo.getStatus());
|
||||
serverInfoVo.setIsWhite(serverInfo.getIsWhite());
|
||||
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)));
|
||||
}else{
|
||||
serverInfoVo.setOpen_time(JsonUtil.timeStamp2Date(String.valueOf(serverInfo.getOpen_time() *1000)));
|
||||
}
|
||||
serverInfoVos.add(serverInfoVo);
|
||||
}
|
||||
map.addAttribute("serverInfos", serverInfoVos);
|
||||
return "findServerInfo";
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,31 @@
|
|||
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="c_server_open_time")
|
||||
public class CServerOpenTime {
|
||||
|
||||
@Id
|
||||
private int id; // serverId
|
||||
|
||||
@Field(value = "openTime")
|
||||
private int openTime; // 精确到秒的时间戳
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(int id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public int getOpenTime() {
|
||||
return openTime;
|
||||
}
|
||||
|
||||
public void setOpenTime(int openTime) {
|
||||
this.openTime = openTime;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,34 @@
|
|||
package com.jmfy.model.vo;
|
||||
|
||||
public class ServerInfoVo{
|
||||
|
||||
public int server_id;
|
||||
|
||||
public String name;
|
||||
|
||||
public String open_time ;
|
||||
|
||||
public int status;
|
||||
|
||||
public int isWhite;
|
||||
|
||||
public void setServer_id(int server_id) {
|
||||
this.server_id = server_id;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public void setOpen_time(String open_time) {
|
||||
this.open_time = open_time;
|
||||
}
|
||||
|
||||
public void setStatus(int status) {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
public void setIsWhite(int isWhite) {
|
||||
this.isWhite = isWhite;
|
||||
}
|
||||
}
|
||||
|
|
@ -15,6 +15,9 @@ public class RedisUserKey {
|
|||
|
||||
public final static String Ban_Chat = "Ban_Chat";
|
||||
|
||||
|
||||
public final static String SERVER_OPEN_TIME_KEY = "Server_Open_Time_Key";
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -55,10 +55,10 @@
|
|||
<div th: th:switch="${powersVo.adminList}">
|
||||
<div th:case="0">
|
||||
<dl id="menu-member">
|
||||
<dt><i class="Hui-iconfont"></i> 会员管理<i class="Hui-iconfont menu_dropdown-arrow"></i></dt>
|
||||
<dt><i class="Hui-iconfont"></i> 用户管理<i class="Hui-iconfont menu_dropdown-arrow"></i></dt>
|
||||
<dd>
|
||||
<ul>
|
||||
<li><a data-href="findmemberlist" data-title="会员列表" href="javascript:;">会员列表</a></li>
|
||||
<li><a data-href="findmemberlist" data-title="会员列表" href="javascript:;">用户列表</a></li>
|
||||
</ul>
|
||||
</dd>
|
||||
</dl>
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@
|
|||
<title>用户管理</title>
|
||||
</head>
|
||||
<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></nav>
|
||||
<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></nav>
|
||||
<div class="page-container">
|
||||
<div class="cl pd-5 bg-1 bk-gray mt-20">
|
||||
<a class="btn btn-primary radius" href="/html/member-add.html">
|
||||
|
|
|
|||
Loading…
Reference in New Issue