diff --git a/Application/Admin/Controller/GameRebateController.class.php b/Application/Admin/Controller/GameRebateController.class.php index 39c621933..6347f4c68 100644 --- a/Application/Admin/Controller/GameRebateController.class.php +++ b/Application/Admin/Controller/GameRebateController.class.php @@ -123,4 +123,185 @@ class GameRebateController extends ThinkController $servers = $gameRepository->getServersByBaseGameId($gameId); return $this->ajaxReturn(['status' => 1, 'message' => '获取成功', 'data' => ['servers' => $servers]]); } + + public function simulateSpendList() + { + $params = I('get.'); + $isExport = $params['is_export'] ?? 0; + $page = $params['page'] ?? 0; + $limit = $params['limit'] ?? 0; + $baseGameId = $params['base_game_id'] ?? 0; + $serverId = $params['server_id'] ?? ''; + $roleName = $params['role_name'] ?? ''; + $userAccount = $params['user_account'] ?? ''; + $reviewStatus = $params['review_status'] ?? -1; + $sendStatus = $params['send_status'] ?? -1; + $reviewerId = $params['reviewer_id'] ?? 0; + $reviewType = $params['review_type'] ?? -1; + + $where = [ + '_string' => '1=1', + ]; + if ($baseGameId != 0) { + $where['base_game_id'] = $baseGameId; + } + if ($userAccount != '') { + $where['user_account'] = ['like', $userAccount . '%']; + } + if ($roleName != '') { + $where['role_name'] = ['like', $roleName . '%']; + } + if ($serverId != '') { + $where['server_id'] = $serverId; + } + if ($reviewStatus != -1) { + $where['review_status'] = $reviewStatus; + } + if ($sendStatus != -1) { + $where['send_status'] = $sendStatus; + } + if ($reviewerId != 0) { + $where['reviewer_id'] = $reviewerId; + } + if ($reviewType != -1) { + $where['review_type'] = $reviewType; + } + + if (I('review_time_start', '') != '') { + $where['_string'] .= ' and review_time>=' . strtotime(I('review_time_start') . ' 00:00:00'); + } + if (I('review_time_end', '') != '') { + $where['_string'] .= ' and review_time<=' . strtotime(I('review_time_end') . ' 23:59:59'); + } + + if (I('create_time_start', '') != '') { + $where['_string'] .= ' and create_time>=' . strtotime(I('create_time_start') . ' 00:00:00'); + } + if (I('create_time_end', '') != '') { + $where['_string'] .= ' and create_time<=' . strtotime(I('create_time_end') . ' 23:59:59'); + } + + /* if ($promote) { + $promoteService = new PromoteService(); + $subSql = M('user', 'tab_')->field(['id'])->where(['_string' => 'promote_id in(' . $promoteService->subInSql($promote) . ')'])->select(false); + $where['_string'] .= ' and user_id in(' . $subSql . ')'; + } */ + + $query = M('simulate_spend', 'tab_')->where($where); + + $count = 0; + $records = []; + if ($isExport == 1 || $limit == 'all') { + $records = $query->order('create_time desc')->select(); + $count = count($records); + } else { + $countQuery = clone $query; + $records = $query->order('create_time desc')->page($page, $limit)->select(); + $count = $countQuery->count(); + } + + if (count($records) > 0) { + + $users = []; + $userIds = array_column($records, 'user_id'); + $users = M('user', 'tab_')->field(['id', 'promote_account'])->where(['id' => ['in', $userIds]])->select(); + $users = index_by_column('id', $users); + + foreach ($records as $key => $record) { + $user = $users[$record['user_id']]; + $payAmount = 0; /** @todo */ + $records[$key]['pay_amount'] = $payAmount; + $records[$key]['total_amount'] = $payAmount + $record['amount']; + $records[$key]['promote_account'] = $user['promote_account']; + $records[$key]['status_text'] = $this->reviewStatusList[$record['status']]; + $records[$key]['review_time'] = $record['review_time'] > 0 ? date('Y-m-d H:i:s', $record['review_time']) : '--'; + $records[$key]['create_time'] = $record['create_time'] > 0 ? date('Y-m-d H:i:s', $record['create_time']) : '--'; + } + + if ($isExport) { + $field = [ + 'order_no' => '订单号', + 'base_game_name' => '游戏名称', + 'server_name' => '区服', + 'user_account' => '玩家账号', + 'role_id' => '角色ID', + 'role_name' => '角色名称', + 'promote_account' => '所属推广员', + 'pay_amount' => '当前累充金额', + 'amount' => '模拟发放金额', + 'total_amount' => '可触发返利功能金额', + 'create_time' => '添加时间', + 'status_text' => '审核状态', + 'review_time' => '审核时间', + 'reviewer_username' => '审核人', + 'remark' => '备注', + ]; + addOperationLog(['op_type'=>3,'key'=>getNowDate(),'op_name'=>'导出转区转游模拟发放记录','url'=>U('GameRebate/simulateSpendList'),'menu'=>'推广员-发放福利管理-' . '导出转区转游模拟发放记录']); + data2csv($records, '转区转游模拟发放', $field); + exit; + } + } + + $page = set_pagination($count, $params['limit'] == 'all' ? 99999999 : $params['limit']); + + if($page) { + $this->assign('_page', $page); + } + + $admins = M('ucenter_member', 'sys_')->field(['id', 'username'])->select(); + $baseGames = M('base_game', 'tab_')->select(); + + $gameRepository = new GameRepository(); + $this->assign('servers', $gameRepository->getServersByBaseGameId($baseGameId)); + $this->assign('admins', $admins); + $this->assign('baseGames', $baseGames); + $this->assign('reviewStatusList', []); + $this->assign('records', $records); + $this->display('records'); + } + + public function addSimulateSpend() + { + $params = I('post.'); + try { + $adminInfo = $_SESSION['onethink_admin']['user_auth']; + $handler = []; + $handler['id'] = $adminInfo['uid']; + $handler['username'] = $adminInfo['username']; + $service = new GameRebateService(); + $service->addSimulateSpend($params, $handler); + $this->ajaxReturn([ + 'status' => 1, + 'message' => '保存成功' + ]); + } catch (\Exception $e) { + $this->ajaxReturn([ + 'status' => 0, + 'message' => $e->getMessage() + ]); + } + } + + public function reviewSimulateSpend() + { + $ids = I('ids', []); + $status = I('status', 0); + try { + $adminInfo = $_SESSION['onethink_admin']['user_auth']; + $handler = []; + $handler['id'] = $adminInfo['uid']; + $handler['username'] = $adminInfo['username']; + $service = new GameRebateService(); + $service->reviewSimulateSpend($ids, $status, $handler); + $this->ajaxReturn([ + 'status' => 1, + 'message' => '操作成功' + ]); + } catch (\Exception $e) { + $this->ajaxReturn([ + 'status' => 0, + 'message' => $e->getMessage() + ]); + } + } } diff --git a/Application/Admin/View/GameRebate/simulateSpendForm.html b/Application/Admin/View/GameRebate/simulateSpendForm.html new file mode 100644 index 000000000..45870074a --- /dev/null +++ b/Application/Admin/View/GameRebate/simulateSpendForm.html @@ -0,0 +1,622 @@ + + +
+ + ++ + | +订单号 | +游戏名称 | +区服 | +账号 | +角色ID | +角色名 | +所属推广员 | +当前累充金额 | +模拟发放金额 | +可触发返利功能金额 | +添加时间 | +审核状态 | +审核时间 | +审核人 | +备注 | +aOh! 暂时还没有内容! | +
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
+ + + + + + | +{$data.order_no} | +{$data.base_game_name} | +{$data.server_name} | +{$data.user_account} | +{$data.role_id} | +{$data.role_name} | +{$data.promote_account} | + +{$data.pay_amount} | +{$data.amount} | +{$data.total_amount} | + +{$data.create_time} | ++ {$data.status_text} + | +{$data.review_time} | +{$data.reviewer_username} | +