diff --git a/Application/Admin/Controller/PromoteGameRatioController.class.php b/Application/Admin/Controller/PromoteGameRatioController.class.php index 05bedf223..d8ea7d936 100644 --- a/Application/Admin/Controller/PromoteGameRatioController.class.php +++ b/Application/Admin/Controller/PromoteGameRatioController.class.php @@ -130,6 +130,11 @@ class PromoteGameRatioController extends ThinkController if (empty($params['begin_time'])) { $this->error('请选择开始时间'); } + if (!empty($params['end_time'])) { + if (strtotime($params['end_time']) < strtotime($params['begin_time'])) { + $this->error('结束时间不得小于开始时间'); + } + } $save['ratio'] = $params['ratio'] ?? 0; $save['begin_time'] = strtotime($params['begin_time']); $save['end_time'] = $params['end_time'] ? strtotime($params['end_time']) : 0; diff --git a/Application/Common/Common/extend.php b/Application/Common/Common/extend.php index a47c1b93e..476064d0d 100644 --- a/Application/Common/Common/extend.php +++ b/Application/Common/Common/extend.php @@ -1081,7 +1081,7 @@ function is_check_account($account){ } //获取游戏cp比例 -function getGameSelleRatio($gameId = null, $promoteId = null, $field = 'id') +function getGameSelleRatio($promoteId = null, $gameId = null, $field = 'id') { $promoteGameRatio = getGameSelleRatioByPromote($promoteId, $gameId); if ($promoteGameRatio === false) { @@ -1102,8 +1102,21 @@ function getGameSelleRatioByPromote($promoteId = null, $gameId = null) if (empty($promoteId) || empty($gameId)) { return false; } - $map['promote_id'] = intval($promoteId); - $map['game_id'] = intval($gameId); + + $promoteId = intval($promoteId); + $gameId = intval($gameId); + $promote = M('promote', 'tab_')->find($promoteId); + + if (empty($promote)) { + return false; + } + if ($promote['level'] != 1) { + $chain = explode('/', trim($promote['chain'], '/')); + $promoteId = empty($chain[0]) ? 0 : intval($chain[0]); + } + + $map['promote_id'] = $promoteId; + $map['game_id'] = $gameId; $promoteGameRatio = M('promote_game_ratio', 'tab_')->where($map)->find(); if (empty($promoteGameRatio) || $promoteGameRatio['status'] != 1) {