优化首页提醒

master
chenzhi 4 years ago
parent 2658c50c3a
commit 13d0c6fa59

@ -243,6 +243,32 @@ class TestingResourceController extends ThinkController
$this->assign('records', $records);
$this->display();
}
public function dailyCountTip()
{
$tipApply = 10000;
$params = [
'create_time_start'=>date("Y-m-d",strtotime("-1 day")),
'create_time_end'=>date("Y-m-d",time()),
];
$where = $this->setDailyCountWhere($params);
$having = 'apply_amount >= '.$tipApply;
$dbdata = M('testing_resource_batch','tab_')
->where($where)->field("FROM_UNIXTIME(create_time,'%Y-%m-%d') as create_day_time,user_id,role_id,game_id,apply_promote_id,apply_admin_id,verify_admin_id,sum(apply_amount) apply_amount,sum(provide_amount) provide_amount")
->group("role_id,game_id,create_day_time")
->order("create_day_time desc")
->having($having)
->select();
$repository = new TestingResourceRepository();
$records = $repository->makeDailyCountTipData($dbdata);
//获取跳转连接
$jumpParm = [
'apply_amount_start'=>$tipApply,
'create_time_start'=>$params['create_time_start'],
'create_time_end'=>$params['create_time_end']
];
$jumpUrl = U("TestingResource/dailyCount",$jumpParm);
$this->ajaxReturn(['status'=>1,'count'=>count($records),'list'=>$records,'jump'=>$jumpUrl]);
}
//每日统计
public function dailyCount()
{

@ -14,6 +14,9 @@
<script src="__JS__/kendo.dataviz.min.js"></script>
<script src="__JS__/kendo.timezones.min.js"></script>
<script src="__STATIC__/layer/layer.js" type="text/javascript"></script>
<script src="__STATIC__/juicer-min.js" type="text/javascript"></script>
<script src="__STATIC__/js.cookie.min.js" type="text/javascript"></script>
<!-- 主体 -->
<div id="indexMain" class="index-main">
<!-- 插件块 -->
@ -261,14 +264,173 @@
</div>
</div>
</div>
<div id="TestingTipShow"></div>
<script id="TestingTipTpl" type="text/template">
<div style="width: 100vw;height:100vh;padding: 0;position: absolute;top: 0;z-index: 9999;background-color:rgba(0,0,0,.6);right: 1px;">
<div class="layui-layer layui-layer-hui" style="width:800px;height:480px;z-index: 19891015; top:28%; left:50%;margin-left: -400px;border-radius: 2%;background-color:white;color: #0a001f;">
<div style="padding: 15px 30px 15px 20px;font-size: 18px;">资源申请预警</div>
<div class="layui-layer-content" style="font-size: 16px;color: red;text-align: left;">昨日至今部分资源号在单个游戏单个区服中当日申请资源已达到1万请前往处理。资源号见下表</div>
<div class="layui-layer-content" style="font-size: 22px;padding: 5px 25px;height: 200px;overflow-x:hidden;overflow-y:scroll">
<div class="data_list">
<div class="">
<table>
<!-- 表头 -->
<thead>
<tr>
<th>游戏名称</th>
<th>区服名称</th>
<th>角色名称</th>
<th>测试账号</th>
<th>申请金额</th>
</tr>
</thead>
<!-- 列表 -->
<tbody>
{@each tip_list as item}
<tr>
<td>${item.game_name}</td>
<td>${item.server_name}</td>
<td>${item.role_name}</td>
<td>${item.user_account}</td>
<td>${item.apply_amount}</td>
</tr>
{@/each}
</tbody>
</table>
</div>
</div>
</div>
<div style="padding: 30px 0 0 30px;">
<p><input type="checkbox" name="ignore" value="1" /> 以上资源号本日不再进行预警提示!</p>
</div>
<div style="text-align: right;margin-top: 20px">
<div style="font-size: 28px;display: inline-block;">
<div class="search_list" style="justify-content:flex-end;width:100%;">
<div class="input-list" style="float: right;">
<a class="sch-btn" href="javascript:;" style="width: 150px;background: white;border: 1px solid black;color: black" id="testingTipBack">返回</a>
</div>
</div>
</div>
<div style="padding: 0 20px 0 0;font-size: 28px;display: inline-block;">
<div class="search_list" style="justify-content:flex-end;width:100%;">
<div class="input-list" style="float: right;">
<a class="sch-btn" href="javascript:;" style="width: 150px;" id="goDailyCount">确认修改</a>
</div>
</div>
</div>
</div>
</div>
</div>
</script>
</block>
<block name="script">
<script>
//支付信息更新类
var TestingTip = {
defaultData:{
tip_list:[],
count:0,
ignore_list:[],
jump:''
}
,data : {}
,dataInit(){
this.setDayKey();
this.getLocalIgnoe();
var url = "{:U('TestingResource/dailyCountTip')}";
$.get(url,function(rep){
console.log(rep)
if(rep.status == 1){
if(rep.count > 0){
TestingTip.data.jump = rep.jump
TestingTip.makeData(rep.list)
TestingTip.display()
}
}
})
}
,setDayKey(){
var d = new Date();
this.data.daykey = 'index-tip-ignore-'+d.getFullYear()+"-"+d.getMonth()+1+"-"+d.getDate();;
}
,getLocalIgnoe(){
var ignore_list = Cookies.get(this.data.daykey);
if(!ignore_list){
this.data.ignore_list = this.defaultData.ignore_list;
return;
}
if(ignore_list.length > 1){
this.data.ignore_list = ignore_list.split(',');
}
}
,setLocalIgnoe(){
//获取key
var keys =Object.keys(this.data.tip_list);
var ignore_list = this.data.ignore_list;
ignore_list = ignore_list.concat(keys).join(",");
const ckey = this.data.daykey;
Cookies.set(ckey, ignore_list, { expires: 2 });
}
,removeLocalIgnoe(){
Cookies.remove(this.data.daykey);
}
,makeData(data){
const iglists = this.data.ignore_list;
const icount = this.data.ignore_list.length;
for (let index = 0; index < icount; index++) {
const element = iglists[index];
if(data.hasOwnProperty(element)){
delete data[element];
}
}
this.data.count = Object.keys(data).length;
this.data.tip_list = data;
}
,display(){
if(this.data.count > 0){
var tpl = $("#TestingTipTpl").html();
var html = juicer(tpl, TestingTip.data);
$("#TestingTipShow").html(html);
this.event();
}
}
,remove(){
TestingTip.data = TestingTip.defaultData;
$("#TestingTipShow").html('');
}
,getIsIgnore(){
var flag = false;
$('input[name="ignore"]:checked').each(function(index, element) {
flag = true;
});
return flag;
}
,event(){
$("#goDailyCount,#testingTipBack").off("click");
$("#goDailyCount").on("click",function() {
if(TestingTip.getIsIgnore()){
TestingTip.setLocalIgnoe();
}
window.location.href = TestingTip.data.jump;
})
$("#testingTipBack").on("click",function() {
if(TestingTip.getIsIgnore()){
TestingTip.setLocalIgnoe();
}
TestingTip.remove();
})
}
}
</script>
<script>
var datelist;
$(function() {
TestingTip.dataInit();
//点击时间显示日历 begin
$(".js-pt-calendar").click(function(){
$(".js-show-calendar").toggle();

@ -267,7 +267,39 @@ class TestingResourceRepository
];
}
return $records;
}
public function makeDailyCountTipData($items)
{
$result = $this->getBatchesRelations($items);
$roles = $result['roles'];
$applyPromotes = $result['applyPromotes'];
$users = $result['users'];
$promotes = $result['promotes'];
$verifyAdmins = $result['verifyAdmins'];
$applyAdmins = $result['applyAdmins'];
//获取申请人
$records = [];
foreach ($items as $batch) {
$roleKey = $this->getGameRoleId($batch['game_id'], $batch['role_id']);
$role = isset($roles[$roleKey]) ? $roles[$roleKey] : null;
$user = $users[$batch['user_id']] ?? null;
$applyPromote = $applyPromotes[$batch['apply_promote_id']] ?? null;
$promote = $user && isset($promotes[$user['promote_id']]) ? $promotes[$user['promote_id']] : null;
$verifyAdmin = $verifyAdmins[$batch['verify_admin_id']] ?? null;
$applyAdmin = $applyAdmins[$batch['apply_admin_id']] ?? null;
$records[$roleKey] = [
'create_day_time' => $batch['create_day_time'],
'role_name' => $role ? $role['role_name'] : '--',
'game_name' => $role ? $role['game_name'] : '--',
'server_name' => $role ? $role['server_name'] : '--',
'user_account' => $role ?$role['user_account'] : '--',
'apply_username' => $applyPromote ? $applyPromote['account'] . '[推广员]' : ($applyAdmin ? $applyAdmin['username'] . '[管理员]' : ''),
'promote_account' => $promote['account'],
'apply_amount' => $batch['apply_amount'],
'provide_amount' => $batch['provide_amount'],
];
}
return $records;
}

Loading…
Cancel
Save