generated from root/miduo_server
公会列表管理2.0
parent
29a180288c
commit
0cadc110e4
|
|
@ -41,22 +41,38 @@ public class GuildController {
|
|||
@Resource
|
||||
private CUserDao cUserDao;
|
||||
|
||||
@RequestMapping(value = "/initGuildList",method = {RequestMethod.POST, RequestMethod.GET})
|
||||
public String initGuildList(ModelMap map){
|
||||
try {
|
||||
List<ServerInfo> serverInfo = serverInfoDao.getAllServerInfo();
|
||||
map.addAttribute("serverInfo",serverInfo);
|
||||
}
|
||||
catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return "guildListManager";
|
||||
}
|
||||
|
||||
/***
|
||||
* 公会列表管理界面
|
||||
* @param map
|
||||
* @param timely 1:立即更新 2:读取缓存
|
||||
* @param serverId
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = "/guildListManager",method = {RequestMethod.POST, RequestMethod.GET})
|
||||
public String guildListManager(ModelMap map,Integer timely){
|
||||
public String guildListManager(ModelMap map,String serverId){
|
||||
long start = DateUtil.now();
|
||||
try {
|
||||
ArrayList<GsGuildInfoBeanVo> guildList = new ArrayList<>();
|
||||
List<ServerInfo> serverInfo = serverInfoDao.getAllServerInfo();
|
||||
for (ServerInfo info : serverInfo) {
|
||||
List<GsGuildInfoBeanVo> guildVoList = gsGuildDao.getGuildVoList(Integer.parseInt(info.getServer_id()),timely);
|
||||
List<GsGuildInfoBeanVo> guildList = new ArrayList<>();
|
||||
// 参数
|
||||
String[] split = serverId.split(",");
|
||||
|
||||
for (String s : split) {
|
||||
List<GsGuildInfoBeanVo> guildVoList = gsGuildDao.getGuildVoList(Integer.parseInt(s),2);
|
||||
guildList.addAll(guildVoList);
|
||||
}
|
||||
map.addAttribute("serverInfo",serverInfo);
|
||||
map.addAttribute("guildList",guildList);
|
||||
}
|
||||
catch (Exception e) {
|
||||
|
|
@ -101,11 +117,7 @@ public class GuildController {
|
|||
// 拼接消息
|
||||
String cmd;
|
||||
String head = "updateguild "+guildId;
|
||||
Map<Integer, GsGuildInfoBeanVo> voMap = GsGuildDaoImpl.guildVoMap.get(serverId);
|
||||
GsGuildInfoBeanVo beanVo = voMap.get(guildId);
|
||||
if (beanVo == null){
|
||||
return 2;
|
||||
}
|
||||
|
||||
int send;
|
||||
switch (type){
|
||||
case 1:
|
||||
|
|
@ -116,7 +128,6 @@ public class GuildController {
|
|||
System.out.printf("修改公会名称报错,错误id:{%d} \n",send);
|
||||
return 4;
|
||||
}
|
||||
beanVo.setName(content);
|
||||
break;
|
||||
case 2:
|
||||
// 修改公会宣言
|
||||
|
|
@ -126,7 +137,6 @@ public class GuildController {
|
|||
System.out.printf("修改公会宣言报错,错误id:{%d} \n",send);
|
||||
return 4;
|
||||
}
|
||||
beanVo.setAnnounce(content);
|
||||
break;
|
||||
case 3:
|
||||
// 解散公会
|
||||
|
|
@ -136,7 +146,6 @@ public class GuildController {
|
|||
System.out.printf("删除报错,错误id:{%d} \n",send);
|
||||
return 4;
|
||||
}
|
||||
voMap.remove(guildId);
|
||||
break;
|
||||
default:
|
||||
System.out.printf("公会操作失败,传递参数为: guildId:{%d}, type:{%d}, serverId{%d}, content{%s}",guildId,type,serverId,content);
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ public class GsGuildDaoImpl implements GsGuildDao {
|
|||
|
||||
public static Map<Integer,Map<Integer,GsGuildInfoBeanVo>> guildVoMap = new HashMap<>();
|
||||
|
||||
public static Map<Integer,Long> guildVoByTime = new HashMap<>();
|
||||
private static Map<Integer,Long> guildVoByTime = new HashMap<>();
|
||||
|
||||
@Override
|
||||
public List<GsGuildInfoBean> getGuildList(int serverId) throws Exception {
|
||||
|
|
@ -50,18 +50,6 @@ public class GsGuildDaoImpl implements GsGuildDao {
|
|||
|
||||
@Override
|
||||
public List<GsGuildInfoBeanVo> getGuildVoList(int serverId, int timely) throws Exception {
|
||||
long now = DateUtil.now();
|
||||
// 不着急获取
|
||||
if (timely == 2){
|
||||
Map<Integer, GsGuildInfoBeanVo> beanVo = guildVoMap.getOrDefault(serverId, new HashMap<>());
|
||||
Long time = guildVoByTime.getOrDefault(serverId,0L);
|
||||
// 一小时内读取缓存
|
||||
boolean isTime = (now - time) < DateUtil.ONE_HOUR;
|
||||
if (!beanVo.isEmpty() && isTime){
|
||||
return new ArrayList<>(beanVo.values());
|
||||
}
|
||||
}
|
||||
|
||||
// 立即获取
|
||||
String dbName = MongoName.getMongoDBName(serverId);
|
||||
MongoTemplate mongoTemplate = connect.getMongoTemplete(dbName);
|
||||
|
|
@ -75,10 +63,6 @@ public class GsGuildDaoImpl implements GsGuildDao {
|
|||
getGuildMember(beanVo);
|
||||
map.put(beanVo.getId(),beanVo);
|
||||
}
|
||||
|
||||
guildVoMap.put(serverId,map);
|
||||
guildVoByTime.put(serverId,now);
|
||||
|
||||
return new ArrayList<>(map.values());
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,29 @@
|
|||
$(function () {
|
||||
// 模糊搜素
|
||||
$('#InputsWrapper select').searchableSelect();
|
||||
|
||||
// 下拉框多选
|
||||
init();
|
||||
|
||||
function init() {
|
||||
initInfo();
|
||||
}
|
||||
|
||||
function initInfo() {
|
||||
$(window).on('load', function () {
|
||||
|
||||
$('.selectpicker').selectpicker({
|
||||
// 'selectedText': 'cat',
|
||||
noneSelectedText: '请选择',
|
||||
noneResultsText: '没有找到匹配的组织 {0}'
|
||||
});
|
||||
|
||||
$('.selectpicker').selectpicker('refresh');
|
||||
|
||||
// 检测浏览器的方法由用户自行决定
|
||||
if (/Android|webOS|iPhone|iPad|iPod|BlackBerry/i.test(navigator.userAgent)) {
|
||||
$('.selectpicker').selectpicker('mobile');
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
|
@ -17,12 +17,18 @@
|
|||
<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"/>
|
||||
<link rel="stylesheet" type="text/css" href="bulletFrame/css/bullet.css"/>
|
||||
|
||||
<!-- 多选框 -->
|
||||
<link href="../static/searchableSelect/css/jquery.searchableSelect.css" rel="stylesheet" type="text/css">
|
||||
<link rel="stylesheet" type="text/css" href="http://www.jq22.com/jquery/bootstrap-3.3.4.css">
|
||||
<link href="../static/bootstrap/css/bootstrap-select.css" rel="stylesheet">
|
||||
|
||||
<script type="text/javascript" src="lib/DD_belatedPNG_0.0.8a-min.js"></script>
|
||||
<script>DD_belatedPNG.fix('*');</script>
|
||||
<title>公会列表管理</title>
|
||||
</head>
|
||||
<body>
|
||||
<nav class="breadcrumb">
|
||||
<nav class="breadcrumb" style="height: 50px;">
|
||||
<i class="Hui-iconfont"></i> 首页
|
||||
<span class="c-gray en">></span> gm管理
|
||||
<span class="c-gray en">></span> 公会列表管理
|
||||
|
|
@ -30,12 +36,22 @@
|
|||
href="javascript:location.replace(location.href);" title="刷新"><i class="Hui-iconfont"></i></a>
|
||||
</nav>
|
||||
<h2 class="mt-20" style="text-align: center"><span style="color:red;">公会列表管理</span></h2>
|
||||
<div class="page-container" style="text-align: center">
|
||||
<div class="page-container" style="text-align: center;v">
|
||||
<div class="text-c">
|
||||
<div style="text-align: left;">
|
||||
<!--多选服务器-->
|
||||
<select name="serverId" class="selectpicker" id="serverId" multiple
|
||||
data-live-search="true"
|
||||
data-width="300px"
|
||||
data-actions-box="true">
|
||||
<option th:each="server:${serverInfo}" th:value="${server.server_id}"
|
||||
th:text="${server.name}"></option>
|
||||
</select>
|
||||
<button class="btn btn-primary" type="button" onclick="selectGuilds()">搜索</button>
|
||||
</div>
|
||||
<!-- 表单 -->
|
||||
<div class="mt-20">
|
||||
<a class="btn btn-success radius" href="/guildListManager?timely=1" style="float: right;margin-left: 5px;">立即更新</a>
|
||||
|
||||
<!-- <a class="btn btn-success radius" href="/guildListManager?timely=1" style="float: right;margin-left: 5px;">立即更新</a>-->
|
||||
<table id="lawtable" class="table table-border table-bordered table-bg table-hover table-sort table-responsive">
|
||||
<thead>
|
||||
<tr class="text-c">
|
||||
|
|
@ -51,25 +67,25 @@
|
|||
<tbody>
|
||||
<tr th:each="obj:${guildList}">
|
||||
<!--<td><input type="checkbox" value="" name=""/></td>-->
|
||||
<td th:text="${obj.id}" style="text-align: center;"></td>
|
||||
<td th:text="${obj.serverId}" style="text-align: center;"></td>
|
||||
<td th:text="${obj.name}" style="text-align: center;"></td>
|
||||
<td th:text="${obj.announce}" style="text-align: center;"></td>
|
||||
<td th:text="${obj.getCreateTimeStr()}" style="text-align: center;"></td>
|
||||
<td th:text="${obj.id}" style="text-align: center;padding-top: 16px"></td>
|
||||
<td th:text="${obj.serverId}" style="text-align: center;padding-top: 16px"></td>
|
||||
<td th:text="${obj.name}" style="text-align: center;padding-top: 16px"></td>
|
||||
<td th:text="${obj.announce}" style="text-align: center;padding-top: 16px"></td>
|
||||
<td th:text="${obj.getCreateTimeStr()}" style="text-align: center;padding-top: 16px"></td>
|
||||
<td style="text-align: center;">
|
||||
<button type="button" th:name="${obj.id}" th:id="'modalBtn_'+${obj.id}" class="btn btn-primary"
|
||||
<button type="button" th:name="${obj.id}" th:id="'modalBtn_'+${obj.id}" class="btn btn-success"
|
||||
onclick="memberInfo(this.name)">
|
||||
<i class="Hui-iconfont"></i> 成员信息
|
||||
</button>
|
||||
<button type="button" th:id="${obj.id}" class="btn btn-primary"
|
||||
<button type="button" th:id="${obj.id}" class="btn btn-success"
|
||||
onclick="return updateGuildInfo(this.id,3)">
|
||||
<i class="Hui-iconfont"></i> 解散公会
|
||||
</button>
|
||||
<button type="button" th:id="${obj.id}" class="btn btn-primary"
|
||||
<button type="button" th:id="${obj.id}" class="btn btn-success"
|
||||
onclick="return updateGuildInfo(this.id,1)">
|
||||
<i class="Hui-iconfont"></i> 修改公会名称
|
||||
</button>
|
||||
<button type="button" th:id="${obj.id}" class="btn btn-primary"
|
||||
<button type="button" th:id="${obj.id}" class="btn btn-success"
|
||||
onclick="return updateGuildInfo(this.id,2)">
|
||||
<i class="Hui-iconfont"></i> 修改公会宣言
|
||||
</button>
|
||||
|
|
@ -82,7 +98,7 @@
|
|||
<h2 th:text="${obj.name}"></h2>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<table id="membetTable" class="table table-border table-bordered table-bg table-hover table-sort2 table-responsive">
|
||||
<table id="memberTable" class="table table-border table-bordered table-bg table-hover table-sort2 table-responsive">
|
||||
<thead>
|
||||
<tr class="text-c">
|
||||
<!--<th width="25"><input type="checkbox" name="" value=""/></th>-->
|
||||
|
|
@ -122,11 +138,16 @@
|
|||
<script type="text/javascript" src="h-ui.admin/js/H-ui.admin.js"></script> <!--/_footer 作为公共模版分离出去-->
|
||||
<script type="text/javascript" src="bulletFrame/js/map.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>
|
||||
|
||||
<!-- 多选框 -->
|
||||
<script src="../static/bootstrap/js/bootstrap-select.js"></script>
|
||||
<script type="text/javascript" src="../static/searchableSelect/js/jquery.searchableSelect.js"></script>
|
||||
<script src="searchableSelect/js/initBootstrap.js"></script>
|
||||
|
||||
<script type="text/javascript">
|
||||
$('.table-sort').dataTable({
|
||||
"aaSorting": [[4, "desc"]],//默认第几个排序
|
||||
|
|
@ -148,6 +169,16 @@
|
|||
]
|
||||
});
|
||||
|
||||
// 查询公会
|
||||
function selectGuilds() {
|
||||
var serverId = $("#serverId").val().toString();
|
||||
if (serverId === '' || serverId == null) {
|
||||
alert("服务器id不能为空");
|
||||
return false;
|
||||
}
|
||||
window.location.href = '/guildListManager?serverId='+serverId;
|
||||
}
|
||||
|
||||
// 成员信息
|
||||
function memberInfo(id){
|
||||
// 获取弹窗元素
|
||||
|
|
@ -235,8 +266,8 @@
|
|||
url: "/updateGuildInfo",
|
||||
success: function (data) {
|
||||
if (data === 1) {
|
||||
layer.msg('操作成功!', {icon: 6, time: 1000});
|
||||
location.reload();
|
||||
layer.msg('操作成功!', {icon: 6, time: 3000});
|
||||
setTimeout(window.location.reload(),1000);
|
||||
}
|
||||
if (data === 0) {
|
||||
layer.msg('操作失败!', {icon: 6, time: 1000});
|
||||
|
|
|
|||
|
|
@ -62,7 +62,9 @@
|
|||
class="Hui-iconfont menu_dropdown-arrow"></i></dt>
|
||||
<dd>
|
||||
<ul>
|
||||
<li th:if="${#lists.contains(pos.powers,101)}"><a data-href="findMemberList" data-title="会员列表" href="javascript:;">用户列表</a></li>
|
||||
<li th:if="${#lists.contains(pos.powers,101)}">
|
||||
<a data-href="findMemberList" data-title="会员列表" href="javascript:;">用户列表</a>
|
||||
</li>
|
||||
</ul>
|
||||
</dd>
|
||||
</dl>
|
||||
|
|
@ -130,7 +132,7 @@
|
|||
href="javascript:;">添加白名单账号英雄</a></li>
|
||||
<li th:if="${#lists.contains(pos.powers,410)} "><a data-href="packageInfoList" data-title="频道管理"
|
||||
href="javascript:;">频道管理</a></li>
|
||||
<li th:if="${#lists.contains(pos.powers,413)} "><a data-href="guildListManager?timely=2" data-title="公会列表管理"
|
||||
<li th:if="${#lists.contains(pos.powers,413)} "><a data-href="initGuildList" data-title="公会列表管理"
|
||||
href="javascript:;">公会列表管理</a></li>
|
||||
</ul>
|
||||
</dd>
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@
|
|||
<p>1、序列号管理->礼包码生成: 添加自定义礼包码</p>
|
||||
<p>ps: 自定义礼包码的"单角色使用数量"和"CDK数量"必须为1</p>
|
||||
<p>2、gm管理->公会列表管理: 添加公会信息查看和修改</p>
|
||||
<p>ps: 公会列表的获取很慢!很慢!很慢!,如非必要,请勿点击"立即更新"按钮(正常每小时更新一次)</p>
|
||||
<p>ps: 公会列表强烈不建议一次性获取多个服务器,那将会很慢很慢!</p>
|
||||
</div>
|
||||
<footer class="footer mt-20">
|
||||
</footer>
|
||||
|
|
|
|||
Loading…
Reference in New Issue