diff --git a/Application/Admin/Controller/BehaviorLogController.class.php b/Application/Admin/Controller/BehaviorLogController.class.php index 88e78162a..5720a6f55 100644 --- a/Application/Admin/Controller/BehaviorLogController.class.php +++ b/Application/Admin/Controller/BehaviorLogController.class.php @@ -11,25 +11,25 @@ class BehaviorLogController extends ThinkController $map = []; if (isset($params['user_account'])) { - $map['tab_pay_info.user_account'] = $params['user_account']; + $map['user_account'] = $params['user_account']; } if (isset($params['extend'])) { - $map['tab_pay_info.extend'] = $params['extend']; + $map['_string'] = 'extend = "'.$params["extend"]. '" or order_id = "'.$params["extend"] . '"'; } if (isset($params['game_name'])) { $game_id = ['in', array_column(getGameByName($params['game_name'], $params['sdk_version']), 'id')]; - $map['tab_pay_info.game_id'] = $game_id; + $map['game_id'] = $game_id; } if (isset($params['server_name'])) { $game_id = M('game', 'tab_')->where(['relation_game_name' => $params['game_name'],'sdk_version' => $params['sdk_version']])->getField('id'); $server_id = M('server', 'tab_')->where(['server_name' => $params['server_name'], 'game_id' => $game_id])->getField('server_num'); - $map['tab_pay_info.server_id'] = $server_id; + $map['server_id'] = $server_id; } if (isset($params['game_player_name'])) { - $map['tab_pay_info.game_player_name'] = $params['game_player_name']; + $map['game_player_name'] = $params['game_player_name']; } if (isset($params['game_player_id'])) { - $map['tab_pay_info.game_player_id'] = $params['game_player_id']; + $map['game_player_id'] = $params['game_player_id']; } @@ -40,7 +40,7 @@ class BehaviorLogController extends ThinkController $endDate = empty($params['timeend']) ? date('Y-m-d') : $params['timeend']; $startTime = strtotime($startDate); $endTime = strtotime($endDate) + 86399; - $map['tab_pay_info.create_time'] = array('BETWEEN', [$startTime, $endTime]); + $map['create_time'] = array('BETWEEN', [$startTime, $endTime]); if (isset($params['promote_id'])) { $promoteId = $params['promote_id']; if ($promoteId == 0) { @@ -52,13 +52,22 @@ class BehaviorLogController extends ThinkController $map['promote_id'] = ['in', $promoteIds]; } } - $data = M('pay_info', 'tab_')->field('tab_pay_info.id,tab_pay_info.user_account,extend,tab_pay_info.create_time,tab_pay_info.game_name,tab_pay_info.server_name,tab_pay_info.promote_account,tab_pay_info.order_id,tab_pay_info.game_player_id,tab_pay_info.game_player_name,price,tab_server.server_name')->join('LEFT JOIN tab_server on tab_pay_info.server_id = tab_server.server_num AND tab_pay_info.game_id = tab_server.game_id')->where($map)->order('tab_pay_info.id DESC')->page($p, $row)->select(); + // $data = M('pay_info', 'tab_')->field('tab_pay_info.id,tab_pay_info.user_account,extend,tab_pay_info.create_time,tab_pay_info.game_name,tab_pay_info.server_name,tab_pay_info.promote_account,tab_pay_info.order_id,tab_pay_info.game_player_id,tab_pay_info.game_player_name,price,tab_server.server_name')->join('LEFT JOIN tab_server on tab_pay_info.server_id = tab_server.server_num AND tab_pay_info.game_id = tab_server.game_id AND tab_pay_info.server_id <> 0')->where($map)->order('tab_pay_info.id DESC')->page($p, $row)->select(); + $data = M('pay_info', 'tab_')->where($map)->order('id DESC')->page($p, $row)->select(); foreach($data as $k => $v) { if(empty($v['extend'])) { $data[$k]['extend'] = $v['order_id']; } + if ($v['server_id'] > 0 && !empty($v['extend'])){ + $data[$k]['server_name'] = M('server', 'tab_')->where(['game_id' => $v['game_id'],'server_num' =>$v['server_id']])->getField('server_name'); + } else { + $data[$k]['server_name'] = ''; + $data[$k]['game_player_name'] = ''; + $data[$k]['game_player_id'] = ''; + + } } - $count = M('pay_info', 'tab_')->join('tab_server on tab_pay_info.server_id = tab_server.server_num AND tab_pay_info.game_id = tab_server.game_id')->where($map)->count(); + $count = M('pay_info', 'tab_')->where($map)->count(); $page = set_pagination($count, $row); if ($page) { $this->assign('_page', $page); 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; + } - +
玩家充值 - 说明:充值数据不包含当日 + 说明:玩家角色充值统计