diff --git a/Application/Admin/Controller/TestingResourceController.class.php b/Application/Admin/Controller/TestingResourceController.class.php index 581ecf923..7be46a84f 100644 --- a/Application/Admin/Controller/TestingResourceController.class.php +++ b/Application/Admin/Controller/TestingResourceController.class.php @@ -243,6 +243,121 @@ 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() + { + $page = I('p', 1); + $row = I('row', 10); + $params = I('get.'); + $where = $this->setDailyCountWhere($params); + $having = '1=1'; + isset($params['apply_amount_start']) && !empty($params['apply_amount_start']) && ( $having .= ' and apply_amount >=' . $params['apply_amount_start']); + isset($params['apply_amount_end']) && !empty($params['apply_amount_end']) && ( $having .= ' and apply_amount <=' . $params['apply_amount_end']); + + $isExport = $params['export'] ?? 0; + $query = 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); + $countsql = clone $query; + if(empty($isExport)){ + $dbdata= $query->page($page,$row)->select(); + $count = M()->table('('.$countsql->select(false).') a')->count(); + }else{ + $dbdata= $query->select(); + } + $repository = new TestingResourceRepository(); + $records = $repository->makeDailyCountData($dbdata); + + $pagination = set_pagination($count, $row); + $gameRepository = new GameRepository(); + $gameId = $params['game_id'] ?? 0; + $this->assign('games', $gameRepository->getChoiceGames()); + $this->assign('count', $count); + $this->assign('_page', $pagination); + $this->assign('records', $records); + $this->display(); + } + protected function setDailyCountWhere($params) + { + $where['_string'] = '1 = 1'; + isset($params['game_id']) && !empty($params['game_id']) && ($where['game_id'] = $params['game_id']); + isset($params['server_id']) && !empty($params['server_id']) && ($where['server_id'] = $params['server_id']); + if (isset($params['account']) && !empty($params['account'])) { + $user = M('user', 'tab_')->field(['id'])->where('account like "' . $params['account'] . '%"')->getField('id',true); + if (!empty($user)) { + $where['user_id'] = ['in',$user]; + } else { + $where['_string'] .= ' and 1<>1'; + return $where; + } + } + isset($params['create_time_start']) && !empty($params['create_time_start']) && ( $where['_string'] .= ' and create_time >=' . strtotime($params['create_time_start'] . ' 00:00:00')); + isset($params['create_time_end']) && !empty($params['create_time_end']) && ( $where['_string'] .= ' and create_time <=' . strtotime($params['create_time_end'] . ' 23:59:59')); + if (isset($params['role_name']) && !empty($params['role_name']) ) { + $roles = M('user_play_info', 'tab_')->where(['role_name' => ['like', "%{$params['role_name']}%"]])->getField('role_id',true); + if(!empty($roles)){ + $where['role_id'] = ["in",$roles]; + }else{ + $where['_string'] .= ' and 1<>1'; + return $where; + } + } + if (isset($params['apply_name']) && !empty($params['apply_name'])) { + $promote = M('promote', 'tab_')->where(['account' => ['like', "%{$params['apply_name']}%"]])->getField('id',true); + $applyAdmins = M('ucenter_member', 'sys_')->where(['username' => ['like', "%{$params['apply_name']}%"]])->getField('id',true); + if(empty($promote) && empty($applyAdmins)){ + $where['_string'] .= ' and 1<>1'; + return $where; + } + if(!empty($promote)){ + $promote = implode(",",$promote); + if(empty($applyAdmins)){ + $where['_string'] .= " and apply_promote_id in ({$promote })"; + }else{ + $where['_string'] .= " and ( apply_promote_id in ({$promote })"; + } + } + if(!empty($applyAdmins)){ + $applyAdmins = implode(",",$applyAdmins); + if(empty($promote)){ + $where['_string'] .= " and apply_admin_id in ({$applyAdmins}) "; + }else{ + $where['_string'] .= " or apply_admin_id in ({$applyAdmins}) )"; + } + } + } + return $where; + } + + public function orders() { diff --git a/Application/Admin/View/Index/index.html b/Application/Admin/View/Index/index.html index 936a4e2e4..e602b0d54 100644 --- a/Application/Admin/View/Index/index.html +++ b/Application/Admin/View/Index/index.html @@ -14,6 +14,9 @@ + + +
申请日期 | +角色名称 | +游戏名称 | +区服名称 | +测试账号 | +申请人 | +所属推广员 | +总申请金额 | +实发金额 | +操作 | +aOh! 暂时还没有内容! | +
---|---|---|---|---|---|---|---|---|---|
{$record.create_day_time} | +{$record.role_name} | +{$record.game_name} | +{$record.server_name} | +{$record.user_account} | +{$record.apply_username} | +{$record.promote_account} | +{$record.apply_amount} | +{$record.provide_amount} | ++ 查看 + | +