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.
153 lines
6.4 KiB
PHP
153 lines
6.4 KiB
PHP
<?php
|
|
|
|
namespace Admin\Controller;
|
|
|
|
use Think\Controller;
|
|
|
|
class PromoteGameRatioController extends ThinkController
|
|
{
|
|
const MODEL_NAME = 'promote_game_ratio';
|
|
const STATUS_REFUSE = -1;
|
|
const STATUS_WAIT = 0;
|
|
const STATUS_PASS = 1;
|
|
|
|
public static $statusList = [
|
|
self::STATUS_REFUSE => '审核未通过',
|
|
self::STATUS_WAIT => '待审核',
|
|
self::STATUS_PASS => '已审核',
|
|
];
|
|
|
|
public function lists()
|
|
{
|
|
$params = I('get.');
|
|
$promoteId = $params['promote_id'] ?? 0;
|
|
$gameId = $params['game_id'] ?? 0;
|
|
$status = $params['status'] ?? '';
|
|
$page = $params['p'] ? intval($params['p']) : 1;
|
|
$row = $params['row'] ? intval($params['row']) : 10;
|
|
|
|
$map['_string'] = '1 = 1';
|
|
if ($promoteId) {
|
|
$map['promote_id'] = intval($promoteId);
|
|
}
|
|
if ($gameId) {
|
|
$map['game_id'] = intval($gameId);
|
|
}
|
|
if ($status !== '') {
|
|
$map['status'] = intval($status);
|
|
}
|
|
|
|
$field = 'create_time, update_time';
|
|
$promoteGameRatios = D(self::MODEL_NAME)->field($field, true)
|
|
->where($map)
|
|
->page($page, $row)
|
|
->order('update_time desc, id desc')
|
|
->select();
|
|
$count = D(self::MODEL_NAME)->where($map)->count();
|
|
|
|
$records = [];
|
|
if ($promoteGameRatios) {
|
|
$promoteIds = array_column($promoteGameRatios, 'promote_id');
|
|
$gameIds = array_column($promoteGameRatios, 'game_id');
|
|
$promoteFiled = 'id, account, mobile_phone, create_time, status, ver_status';
|
|
$gameFiled = 'id, game_name, ratio';
|
|
$promotes = M('promote', 'tab_')->where(array('id' => ['in', $promoteIds]))->getField($promoteFiled, true);
|
|
$games = M('game', 'tab_')->where(array('id' => ['in', $gameIds]))->getField($gameFiled, true);
|
|
|
|
foreach ($promoteGameRatios as $promoteGameRatio) {
|
|
$thisPromoteId = $promoteGameRatio['promote_id'];
|
|
$thisGameId = $promoteGameRatio['game_id'];
|
|
$issetPromote = isset($promotes[$thisPromoteId]);
|
|
$issetGame = isset($games[$thisGameId]);
|
|
$thisPromoteAccount = '未知';
|
|
$thisPromoteMobilePhone = '未知';
|
|
$thisPromoteCreateTime = '未知';
|
|
$thisPromoteStatus = '未知';
|
|
$thisPromoteVerStatus = '未知';
|
|
$thisGameName = '未知';
|
|
$thisGameRatio = '0.00';
|
|
$thisApplicant = getPromoteAccount($promoteGameRatio['applicant_id']);
|
|
$thisReviewer = $promoteGameRatio['reviewer_id'] ? getPromoteAccount($promoteGameRatio['reviewer_id']) : '待确认';
|
|
if ($promoteGameRatio['ratio'] > 0) {
|
|
$thisBeninTime = date('Y/m/d', $promoteGameRatio['begin_time']);
|
|
} else {
|
|
$thisBeninTime = date('Y/m/d', $this->getPromoteApplyCreateTime($thisPromoteId, $thisGameId));
|
|
}
|
|
$thisEndTime = $promoteGameRatio['end_time'] ? date('Y/m/d', $promoteGameRatio['end_time']) : '永久';
|
|
$validDate = $thisBeninTime . ' - ' . $thisEndTime;
|
|
if ($issetPromote) {
|
|
$thisPromoteAccount = $promotes[$thisPromoteId]['account'];
|
|
$thisPromoteMobilePhone = $promotes[$thisPromoteId]['mobile_phone'];
|
|
$thisPromoteCreateTime = date('Y-m-d H:i:s', $promotes[$thisPromoteId]['create_time']);
|
|
$thisPromoteStatus = get_status_title($promotes[$thisPromoteId]['status']);
|
|
$thisPromoteStatus = $thisPromoteStatus ?? '未知';
|
|
$thisPromoteVerStatus = getPromoteVerStatus($promotes[$thisPromoteId]['status'], 2);
|
|
}
|
|
if ($issetGame) {
|
|
$thisGameName = $games[$thisGameId]['game_name'];
|
|
$thisGameRatio = $games[$thisGameId]['ratio'];
|
|
$thisGameRatio = $thisGameRatio ?? '0.00';
|
|
}
|
|
|
|
$records[] = [
|
|
'id' => $promoteGameRatio['id'],
|
|
'promote_id' => $promoteGameRatio['promote_id'],
|
|
'promote_account' => $thisPromoteAccount,
|
|
'promote_mobile_phone' => $thisPromoteMobilePhone,
|
|
'promote_create_time' => $thisPromoteCreateTime,
|
|
'promote_status_text' => $thisPromoteStatus,
|
|
'promote_ver_status_text' => $thisPromoteVerStatus,
|
|
'game_name' => $thisGameName,
|
|
'game_ratio' => $thisGameRatio . '%',
|
|
'ratio' => $promoteGameRatio['ratio'] . '%',
|
|
'valid_date' => $validDate,
|
|
'remark' => $promoteGameRatio['remark'],
|
|
'status_text' => self::$statusList[$promoteGameRatio['status']],
|
|
'applicant' => $thisApplicant ?? '未知',
|
|
'reviewer' => $thisReviewer ?? '未知',
|
|
];
|
|
}
|
|
}
|
|
|
|
$this->assign('records', $records);
|
|
$this->assign('count', $count);
|
|
$this->assign('gameList', getAllGameList());
|
|
$this->assign('promoteList', getPromoteByLevel(1));
|
|
$this->assign('statusList', self::$statusList);
|
|
$this->meta_title = '公会分成管理';
|
|
$this->display();
|
|
}
|
|
|
|
public function applyRatio()
|
|
{
|
|
if ($_POST) {
|
|
|
|
} else {
|
|
$params = I('get.');
|
|
$id = $params['id'] ?? 0;
|
|
$id = intval($id);
|
|
if ($id) {
|
|
$field = 'promote_id, game_id, ratio, begin_time, end_time, remark';
|
|
$map['id'] = $id;
|
|
$promoteGameRatio = D(self::MODEL_NAME)->field($field)->where($map)->find();
|
|
if (empty($promoteGameRatio)) {
|
|
$this->error('数据异常');
|
|
}
|
|
$this->assign('record', $promoteGameRatio);
|
|
}
|
|
|
|
$this->assign('gameList', getAllGameList());
|
|
$this->assign('promoteList', getPromoteByLevel(1));
|
|
$this->meta_title = '游戏分成比例申请';
|
|
$this->display();
|
|
}
|
|
}
|
|
|
|
private function getPromoteApplyCreateTime($promoteId, $gameId)
|
|
{
|
|
$map['promote_id'] = $promoteId;
|
|
$map['game_id'] = $gameId;
|
|
$createTime = $apply = M('apply', 'tab_')->where($map)->getField('apply_time');
|
|
return $createTime;
|
|
}
|
|
} |