diff --git a/Application/Admin/Common/function.php b/Application/Admin/Common/function.php index 1b51e7fd5..eca80c14c 100644 --- a/Application/Admin/Common/function.php +++ b/Application/Admin/Common/function.php @@ -610,4 +610,62 @@ function encryptIdCard($str) { $stars_str = "****"; } return substr_replace($str, $stars_str, $length-4, 4); +} + +//获取推广员资质审核状态 $type 1-获取数组 2-获取文本 +function getPromoteVerStatus($status, $type = 1) +{ + $statusList = [ + 0 => '未认证', + 1 => '审核成功', + 2 => '审核失败', + 3 => '审核中', + 4 => '修改审核中', + ]; + + $records = null; + switch ($type) { + case 1: + $records = $status; + break; + case 2: + $records = $statusList[$status] ?? '未知'; + break; + default: + $records = false; + break; + } + return $records; +} + +//获取推广员账号 +function getPromoteAccount($promoteId) +{ + $map['id'] = intval($promoteId); + return M('promote', 'tab_')->where($map)->getField('account'); +} + +//获取推广员列表 $level 0-全部 +function getPromoteByLevel($level = 0) +{ + $field = 'id, account, real_name'; + if ($level) { + $map['level'] = $level; + $promotes = M('promote', 'tab_')->field($field)->where($map)->select(); + } else { + $promotes = M('promote', 'tab_')->field($field)->select(); + } + return $promotes; +} + +//获取游戏列表 +function getAllGameList($groupByRelation = false) +{ + $field = 'id, game_name, relation_game_id, relation_game_name'; + if ($groupByRelation) { + $games = M('game', 'tab_')->field($field)->group('relation_game_id')->select(); + } else { + $games = M('game', 'tab_')->field($field)->select(); + } + return $games; } \ No newline at end of file diff --git a/Application/Admin/Controller/PromoteGameRatioController.class.php b/Application/Admin/Controller/PromoteGameRatioController.class.php index ce6b4bba8..6e358417b 100644 --- a/Application/Admin/Controller/PromoteGameRatioController.class.php +++ b/Application/Admin/Controller/PromoteGameRatioController.class.php @@ -7,6 +7,15 @@ 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() { @@ -14,22 +23,109 @@ class PromoteGameRatioController extends ThinkController $promoteAccount = $params['promote_account'] ?? ''; $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 ($promoteAccount) { - $promoteMap['account'] = $promoteAccount; + $promoteMap['account'] = trim($promoteAccount); $promoteId = M('promote', 'tab_')->where($promoteMap)->getField('id'); $promoteId = $promoteId ?? 0; $map['promote_id'] = $promoteId; } if ($gameId) { - $map['game_id'] = $gameId; + $map['game_id'] = intval($gameId); } if ($status !== '') { - $map['status'] = $status; + $map['status'] = intval($status); } $field = 'create_time, update_time'; - $query = D(self::MODEL_NAME)->getLists(); + $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']); + $thisEndTime = date('Y/m/d', $promoteGameRatio['end_time']); + } else { + $thisBeninTime = date('Y/m/d', $this->getPromoteApplyCreateTime($thisPromoteId, $thisGameId)); + $thisEndTime = '永久'; + } + $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->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; } } \ No newline at end of file diff --git a/Application/Admin/Model/PromoteGameRatioModel.class.php b/Application/Admin/Model/PromoteGameRatioModel.class.php index ea16a31f0..b6715ba2d 100644 --- a/Application/Admin/Model/PromoteGameRatioModel.class.php +++ b/Application/Admin/Model/PromoteGameRatioModel.class.php @@ -2,7 +2,10 @@ namespace Admin\Model; -class PromoteGameRatioModel extends CommentModel -{ +use Think\Model; +class PromoteGameRatioModel extends Model +{ + // 数据表前缀 + protected $tablePrefix = 'tab_'; } \ No newline at end of file diff --git a/Application/Admin/View/PromoteGameRatio/lists.html b/Application/Admin/View/PromoteGameRatio/lists.html new file mode 100644 index 000000000..b00ab7fc0 --- /dev/null +++ b/Application/Admin/View/PromoteGameRatio/lists.html @@ -0,0 +1,415 @@ + + + + + + + + + + + + + +
+ + +
+
+ +
+
+ +
+
+ +
+
+ 搜索 +
+
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + 会长ID会长账号手机号码注册时间状态身份状态已申请游戏原分成比例当前分成比例开始时间备注分成比例审核申请人确认人操作
aOh! 暂时还没有内容!
{$record.promote_id}{$record.promote_account}{$record.promote_mobile_phone}{$record.promote_create_time}{$record.promote_status_text}{$record.promote_ver_status_text}{$record.game_name}{$record.game_ratio}{$record.ratio}{$record.valid_date}{$record.remark}{$record.status_text}{$record.applicant}{$record.reviewer} + 修改 +
+
+ +
+
+ 导出 + {$_page|default=''} +
+ + + +
+ + + + + +