From 410a3cda1b4f151a9fe5bd681999c7cf5e98866d Mon Sep 17 00:00:00 2001 From: chenxiaojun <956334972@qq.com> Date: Thu, 19 Dec 2019 17:58:54 +0800 Subject: [PATCH 1/4] =?UTF-8?q?=E7=AE=A1=E7=90=86=E5=90=8E=E5=8F=B0>?= =?UTF-8?q?=E6=8E=A8=E5=B9=BF=E5=91=98=E7=AE=A1=E7=90=86>=E5=85=AC?= =?UTF-8?q?=E4=BC=9A=E5=88=86=E6=88=90=E7=AE=A1=E7=90=86--=E6=9B=B4?= =?UTF-8?q?=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../PromoteGameRatioController.class.php | 77 ++++++++++++++----- .../View/PromoteGameRatio/applyRatio.html | 71 +++++++++++------ .../Admin/View/PromoteGameRatio/lists.html | 2 +- Application/Common/Common/extend.php | 50 +++++++++++- Data/update.sql | 4 +- 5 files changed, 156 insertions(+), 48 deletions(-) diff --git a/Application/Admin/Controller/PromoteGameRatioController.class.php b/Application/Admin/Controller/PromoteGameRatioController.class.php index c08d958a8..05bedf223 100644 --- a/Application/Admin/Controller/PromoteGameRatioController.class.php +++ b/Application/Admin/Controller/PromoteGameRatioController.class.php @@ -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) ? '' . $thisStatusText . '' : $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; } } \ No newline at end of file diff --git a/Application/Admin/View/PromoteGameRatio/applyRatio.html b/Application/Admin/View/PromoteGameRatio/applyRatio.html index 069e7c047..c941573b0 100644 --- a/Application/Admin/View/PromoteGameRatio/applyRatio.html +++ b/Application/Admin/View/PromoteGameRatio/applyRatio.html @@ -19,6 +19,9 @@ .tabcon1711 .form_unit { margin-left: 2px; } + .tabcon1711 .mustmark { + margin-left:-7px; + } - +
玩家充值 - 说明:充值数据不包含当日 + 说明:玩家角色充值统计