|
|
|
@ -66,15 +66,13 @@ class PromoteGameRatioController extends ThinkController
|
|
|
|
|
$thisPromoteVerStatus = '未知';
|
|
|
|
|
$thisGameName = '未知';
|
|
|
|
|
$thisGameRatio = '0.00';
|
|
|
|
|
$thisLastRatio = $promoteGameRatio['last_ratio'];
|
|
|
|
|
$thisLastRatioStatus = $promoteGameRatio['last_ratio_status'];
|
|
|
|
|
$thisStatusText = self::$statusList[$promoteGameRatio['status']];
|
|
|
|
|
$thisStatusText = ($promoteGameRatio['status'] == -1) ? '<span style="color: red;">' . $thisStatusText . '</span>' : $thisStatusText;
|
|
|
|
|
$thisApplicant = getPromoteAccount($promoteGameRatio['applicant_id']);
|
|
|
|
|
$thisReviewer = $promoteGameRatio['reviewer_id'] ? getPromoteAccount($promoteGameRatio['reviewer_id']) : '待确认';
|
|
|
|
|
if ($promoteGameRatio['ratio'] > 0 && $promoteGameRatio['begin_time']) {
|
|
|
|
|
$thisBeninTime = date('Y/m/d', $promoteGameRatio['begin_time']);
|
|
|
|
|
} else {
|
|
|
|
|
$thisBeninTime = date('Y/m/d', $this->getPromoteApplyCreateTime($thisPromoteId, $thisGameId));
|
|
|
|
|
}
|
|
|
|
|
$thisBeninTime = date('Y/m/d', $promoteGameRatio['begin_time']);
|
|
|
|
|
$thisEndTime = $promoteGameRatio['end_time'] ? date('Y/m/d', $promoteGameRatio['end_time']) : '永久';
|
|
|
|
|
$validDate = $thisBeninTime . ' - ' . $thisEndTime;
|
|
|
|
|
if ($issetPromote) {
|
|
|
|
@ -100,7 +98,7 @@ class PromoteGameRatioController extends ThinkController
|
|
|
|
|
'promote_status_text' => $thisPromoteStatus,
|
|
|
|
|
'promote_ver_status_text' => $thisPromoteVerStatus,
|
|
|
|
|
'game_name' => $thisGameName,
|
|
|
|
|
'game_ratio' => $thisGameRatio . '%',
|
|
|
|
|
'last_ratio' => (($thisLastRatioStatus == 1) ? $thisLastRatio : $thisGameRatio) . '%',
|
|
|
|
|
'ratio' => $promoteGameRatio['ratio'] . '%',
|
|
|
|
|
'valid_date' => $validDate,
|
|
|
|
|
'remark' => $promoteGameRatio['remark'],
|
|
|
|
@ -129,8 +127,11 @@ class PromoteGameRatioController extends ThinkController
|
|
|
|
|
if ($_POST) {
|
|
|
|
|
$params = I('post.');
|
|
|
|
|
$time = time();
|
|
|
|
|
if (empty($params['begin_time'])) {
|
|
|
|
|
$this->error('请选择开始时间');
|
|
|
|
|
}
|
|
|
|
|
$save['ratio'] = $params['ratio'] ?? 0;
|
|
|
|
|
$save['begin_time'] = $params['begin_time'] ? strtotime($params['begin_time']) : 0;
|
|
|
|
|
$save['begin_time'] = strtotime($params['begin_time']);
|
|
|
|
|
$save['end_time'] = $params['end_time'] ? strtotime($params['end_time']) : 0;
|
|
|
|
|
$save['remark'] = $params['remark'] ?? '';
|
|
|
|
|
$save['status'] = 0;
|
|
|
|
@ -140,6 +141,10 @@ class PromoteGameRatioController extends ThinkController
|
|
|
|
|
if (empty($promoteGameRatio)) {
|
|
|
|
|
$this->error('参数异常');
|
|
|
|
|
}
|
|
|
|
|
if ($promoteGameRatio['status'] == 1) {
|
|
|
|
|
$save['last_ratio'] = $promoteGameRatio['ratio'];
|
|
|
|
|
$save['last_ratio_status'] = 1;
|
|
|
|
|
}
|
|
|
|
|
$save['id'] = intval($params['id']);
|
|
|
|
|
$result = D(self::MODEL_NAME)->save($save);
|
|
|
|
|
} else {//新增
|
|
|
|
@ -176,19 +181,22 @@ class PromoteGameRatioController extends ThinkController
|
|
|
|
|
$metaTitle = '游戏分成比例申请';
|
|
|
|
|
if ($id) {
|
|
|
|
|
$metaTitle .= '--修改';
|
|
|
|
|
$field = 'id, promote_id, game_id, ratio, begin_time, end_time, remark';
|
|
|
|
|
$map['id'] = $id;
|
|
|
|
|
$promoteGameRatio = D(self::MODEL_NAME)->field($field)->where($map)->find();
|
|
|
|
|
$promoteGameRatio = D(self::MODEL_NAME)->where($map)->find();
|
|
|
|
|
if (empty($promoteGameRatio)) {
|
|
|
|
|
$this->error('数据异常');
|
|
|
|
|
}
|
|
|
|
|
$promoteGameRatio['begin_time'] = $promoteGameRatio['begin_time'] ? date('Y-m-d', $promoteGameRatio['begin_time']) : '';
|
|
|
|
|
$promoteGameRatio['end_time'] = $promoteGameRatio['end_time'] ? date('Y-m-d', $promoteGameRatio['end_time']) : '';
|
|
|
|
|
$gameRatio = M('game', 'tab_')->where(array(['id' => $promoteGameRatio['game_id']]))->getField('ratio');
|
|
|
|
|
$gameRatio = ($gameRatio ?? '0.00') . '%';
|
|
|
|
|
if ($promoteGameRatio['last_ratio_status'] == 1) {
|
|
|
|
|
$lastRatio = $promoteGameRatio['last_ratio'];
|
|
|
|
|
} else {
|
|
|
|
|
$gameRatio = M('game', 'tab_')->where(array(['id' => $promoteGameRatio['game_id']]))->getField('ratio');
|
|
|
|
|
$lastRatio = ($gameRatio ?? '0.00') . '%';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$this->assign('record', $promoteGameRatio);
|
|
|
|
|
$this->assign('gameRatio', $gameRatio);
|
|
|
|
|
$this->assign('lastRatio', $lastRatio);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$this->assign('gameList', getAllGameList());
|
|
|
|
@ -245,20 +253,51 @@ class PromoteGameRatioController extends ThinkController
|
|
|
|
|
return $reviewRule;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function getGameRatio()
|
|
|
|
|
public function getPromoteGameRatio()
|
|
|
|
|
{
|
|
|
|
|
$promoteId = I('post.promote_id', 0);
|
|
|
|
|
$promoteId = intval($promoteId);
|
|
|
|
|
$gameId = I('post.game_id', 0);
|
|
|
|
|
$gameId = intval($gameId);
|
|
|
|
|
$gameRatio = '';
|
|
|
|
|
$record['last_ratio'] = '';
|
|
|
|
|
$status = 0;
|
|
|
|
|
if ($promoteId || $gameId) {
|
|
|
|
|
if ($promoteId && $gameId) {
|
|
|
|
|
$map['promote_id'] = $promoteId;
|
|
|
|
|
$map['game_id'] = $gameId;
|
|
|
|
|
$record = D(self::MODEL_NAME)->where($map)->find();
|
|
|
|
|
if ($record) {
|
|
|
|
|
$status = 2;
|
|
|
|
|
$record['begin_time'] = date('Y-m-d', $record['begin_time']);
|
|
|
|
|
$record['end_time'] = empty($record['end_time']) ? '' : date('Y-m-d', $record['end_time']);
|
|
|
|
|
if ($record['last_ratio_status'] == 0) {
|
|
|
|
|
$record['last_ratio'] = $this->getGameRatio($gameId);
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
$status = 1;
|
|
|
|
|
$record['last_ratio'] = $this->getGameRatio($gameId);
|
|
|
|
|
}
|
|
|
|
|
} elseif ($gameId) {
|
|
|
|
|
$status = 1;
|
|
|
|
|
$record['last_ratio'] = $this->getGameRatio($gameId);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
$data = [
|
|
|
|
|
'status' => $status,
|
|
|
|
|
'record' => $record,
|
|
|
|
|
];
|
|
|
|
|
$this->ajaxReturn($data);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function getGameRatio($gameId)
|
|
|
|
|
{
|
|
|
|
|
$gameId = intval($gameId);
|
|
|
|
|
$gameRatio = '0.00';
|
|
|
|
|
if ($gameId) {
|
|
|
|
|
$map['id'] = $gameId;
|
|
|
|
|
$gameRatio = M('game', 'tab_')->where($map)->getField('ratio');
|
|
|
|
|
$gameRatio = ($gameRatio ?? '0.00') . '%';
|
|
|
|
|
}
|
|
|
|
|
$data = [
|
|
|
|
|
'status' => 1,
|
|
|
|
|
'ratio' => $gameRatio,
|
|
|
|
|
];
|
|
|
|
|
$this->ajaxReturn($data);
|
|
|
|
|
return $gameRatio;
|
|
|
|
|
}
|
|
|
|
|
}
|