You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

119 lines
3.4 KiB
PHP

<?php
namespace Admin\Controller;
use Base\Repository\GameRepository;
use Base\Service\GameRebateService;
use User\Api\UserApi as UserApi;
use Base\Service\PresidentDepositService;
/**
* 游戏返利
*/
class GameRebateController extends ThinkController
{
public function single()
{
$this->records('A');
}
public function accumulative()
{
$this->records('C');
}
public function daily()
{
$this->records('B');
}
public function firstPay()
{
$this->records('D');
}
public function dayAccumulative()
{
$this->records('E');
}
public function weekly()
{
$this->records('F');
}
public function records($awardType)
{
$params = I('get.');
$params['is_export'] = ($params['export'] ?? 0);
$params['page'] = ($params['p'] ?? 1);
$params['limit'] = ($params['row'] ?? 10);
$baseGameId = $params['base_game_id'] ?? 0;
$isExport = $params['is_export'] == 1;
$service = new GameRebateService();
[$records, $count] = $service->listQuery($params, $awardType);
$pageTitle = $service->typeDisplayNames[$awardType];
$pageName = $service->typeNames[$awardType];
if (count($records) > 0) {
$records = $service->listRange($records);
if ($isExport) {
$field = $service->getExportHeadings($awardType);
addOperationLog(['op_type'=>3,'key'=>getNowDate(),'op_name'=>'导出' . $pageTitle . '记录','url'=>U('GameRebate/' . $pageName),'menu'=>'推广员-发放福利管理-' . '导出' . $pageTitle . '记录']);
data2csv($records, $pageTitle, $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('pageTitle', $pageTitle);
$this->assign('pageName', $pageName);
$this->assign('awardType', $awardType);
$this->assign('servers', $gameRepository->getServersByBaseGameId($baseGameId));
$this->assign('admins', $admins);
$this->assign('baseGames', $baseGames);
$this->assign('sendStatusList', $service->sendStatusList);
$this->assign('reviewStatusList', $service->reviewStatusList);
$this->assign('records', $records);
$this->display('records');
}
public function review()
{
$ids = I('ids', []);
$status = I('status', 0);
try {
$service = new GameRebateService();
$service->review($ids, $status);
$this->ajaxReturn([
'status' => 1,
'message' => '操作成功'
]);
} catch (\Exception $e) {
$this->ajaxReturn([
'status' => 0,
'message' => $e->getMessage()
]);
}
}
public function getServers()
{
$gameId = I('game_id', 0);
$gameRepository = new GameRepository();
$servers = $gameRepository->getServersByBaseGameId($gameId);
return $this->ajaxReturn(['status' => 1, 'message' => '获取成功', 'data' => ['servers' => $servers]]);
}
}