|
|
@ -24,21 +24,51 @@ class GameDivideController extends BaseController
|
|
|
|
$modelList = ['游戏管理', $metaTitle];
|
|
|
|
$modelList = ['游戏管理', $metaTitle];
|
|
|
|
$this->verifyPasswordView($modelList);
|
|
|
|
$this->verifyPasswordView($modelList);
|
|
|
|
|
|
|
|
|
|
|
|
$map['tab_game.online_status'] = 1;//开发者游戏上线状态
|
|
|
|
$time = time();
|
|
|
|
$map['tab_game.down_port'] = 1;//游戏端口 第三方接口不能申请
|
|
|
|
$promoteId = $loginPromote['id'];
|
|
|
|
$map['tab_game.game_status'] = 1;//游戏状态
|
|
|
|
if ($loginPromote['level'] != 1) {
|
|
|
|
|
|
|
|
$chain = explode('/', trim($loginPromote['chain'], '/'));
|
|
|
|
|
|
|
|
$promoteId = empty($chain[0]) ? 0 : intval($chain[0]);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
$promoteGameRatiosMap['promote_id'] = $promoteId;
|
|
|
|
|
|
|
|
$promoteGameRatiosMap['status'] = 1;
|
|
|
|
|
|
|
|
$promoteGameRatiosMap['begin_time'] = ['elt', $time];
|
|
|
|
|
|
|
|
$promoteGameRatiosWhere['_string'] = "end_time = 0 or end_time >= $time";
|
|
|
|
|
|
|
|
$promoteGameRatiosMap['_complex'] = $promoteGameRatiosWhere;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$map['online_status'] = 1;//开发者游戏上线状态
|
|
|
|
|
|
|
|
$map['down_port'] = 1;//游戏端口 第三方接口不能申请
|
|
|
|
|
|
|
|
$map['game_status'] = 1;//游戏状态
|
|
|
|
empty(I('relation_game_id')) || $map['relation_game_id'] = I('relation_game_id');
|
|
|
|
empty(I('relation_game_id')) || $map['relation_game_id'] = I('relation_game_id');
|
|
|
|
empty(I('sdk_version')) || $map['sdk_version'] = I('sdk_version');
|
|
|
|
empty(I('sdk_version')) || $map['sdk_version'] = I('sdk_version');
|
|
|
|
empty(I('server_type')) || $map['server_type'] = I('server_type');
|
|
|
|
empty(I('server_type')) || $map['server_type'] = I('server_type');
|
|
|
|
|
|
|
|
|
|
|
|
$minRatio = floatval(I('min_ratio', 0));
|
|
|
|
$minRatio = I('min_ratio', '');
|
|
|
|
$maxRatio = floatval(I('max_ratio', 0));
|
|
|
|
$maxRatio = I('max_ratio', '');
|
|
|
|
if (!empty($minRatio) && empty($maxRatio)) {
|
|
|
|
if (!empty($minRatio) || !empty($maxRatio)) {
|
|
|
|
$map['ratio'] = ['egt', $minRatio];
|
|
|
|
$promoteGameRatiosNotInMap = $promoteGameRatiosMap;
|
|
|
|
} elseif (empty($minRatio) && !empty($maxRatio)) {
|
|
|
|
if (!empty($minRatio) && empty($maxRatio)) {
|
|
|
|
$map['ratio'] = ['elt', $maxRatio];
|
|
|
|
$promoteGameRatiosMap['ratio'] = ['egt', $minRatio];
|
|
|
|
} elseif (!empty($minRatio) && !empty($maxRatio)) {
|
|
|
|
$map['ratio'] = ['egt', $minRatio];
|
|
|
|
$map['ratio'] = ['between', [$minRatio, $maxRatio]];
|
|
|
|
} elseif (empty($minRatio) && !empty($maxRatio)) {
|
|
|
|
|
|
|
|
$promoteGameRatiosMap['ratio'] = ['elt', $maxRatio];
|
|
|
|
|
|
|
|
$map['ratio'] = ['elt', $maxRatio];
|
|
|
|
|
|
|
|
} elseif (!empty($minRatio) && !empty($maxRatio)) {
|
|
|
|
|
|
|
|
$promoteGameRatiosMap['ratio'] = ['between', [$minRatio, $maxRatio]];
|
|
|
|
|
|
|
|
$map['ratio'] = ['between', [$minRatio, $maxRatio]];
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$promoteGameRatioIds = M('promote_game_ratio', 'tab_')->where($promoteGameRatiosMap)->getField('game_id', true);
|
|
|
|
|
|
|
|
$promoteGameRatioNotInIds = M('promote_game_ratio', 'tab_')->where($promoteGameRatiosNotInMap)->getField('game_id', true);
|
|
|
|
|
|
|
|
if (!empty($promoteGameRatioIds)) {
|
|
|
|
|
|
|
|
$whereOr['id'] = ['not in', $promoteGameRatioNotInIds];
|
|
|
|
|
|
|
|
$whereOr['ratio'] = $map['ratio'];
|
|
|
|
|
|
|
|
$where['id'] = ['in', $promoteGameRatioIds];
|
|
|
|
|
|
|
|
$where['_logic'] = 'or';
|
|
|
|
|
|
|
|
$where['_complex'] = $whereOr;
|
|
|
|
|
|
|
|
$map['_complex'] = $where;
|
|
|
|
|
|
|
|
unset($map['ratio']);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
$page = intval(I('get.p', 0));
|
|
|
|
$page = intval(I('get.p', 0));
|
|
|
@ -53,21 +83,28 @@ class GameDivideController extends BaseController
|
|
|
|
$data = M('Game', 'tab_')
|
|
|
|
$data = M('Game', 'tab_')
|
|
|
|
->field('id,icon,game_name,game_type_name,sdk_version,server_type,discount,ratio')
|
|
|
|
->field('id,icon,game_name,game_type_name,sdk_version,server_type,discount,ratio')
|
|
|
|
->where($map)
|
|
|
|
->where($map)
|
|
|
|
->order('sort desc')
|
|
|
|
->order('id desc')
|
|
|
|
->page($page, $row)
|
|
|
|
->page($page, $row)
|
|
|
|
->select();
|
|
|
|
->select();
|
|
|
|
$count = M('Game', 'tab_')
|
|
|
|
$count = M('Game', 'tab_')
|
|
|
|
->where($map)
|
|
|
|
->where($map)
|
|
|
|
->count();
|
|
|
|
->count();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!empty($data)) {
|
|
|
|
|
|
|
|
$promoteGameRatios = M('promote_game_ratio', 'tab_')->where($promoteGameRatiosMap)->getField('game_id, ratio', true);
|
|
|
|
|
|
|
|
foreach ($data as &$list) {
|
|
|
|
|
|
|
|
$list['ratio'] = isset($promoteGameRatios[$list['id']]) ? $promoteGameRatios[$list['id']] : $list['ratio'];
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//分页
|
|
|
|
//分页
|
|
|
|
$parameter['p'] = I('get.p', 1);
|
|
|
|
$parameter['p'] = I('get.p', 1);
|
|
|
|
$parameter['row'] = I('get.row');
|
|
|
|
$parameter['row'] = I('get.row');
|
|
|
|
empty(I('relation_game_id')) || $parameter['relation_game_id'] = I('relation_game_id');
|
|
|
|
empty(I('relation_game_id')) || $parameter['relation_game_id'] = I('relation_game_id');
|
|
|
|
empty(I('sdk_version')) || $parameter['sdk_version'] = I('sdk_version');
|
|
|
|
empty(I('sdk_version')) || $parameter['sdk_version'] = I('sdk_version');
|
|
|
|
empty(I('server_type')) || $parameter['server_type'] = I('server_type');
|
|
|
|
empty(I('server_type')) || $parameter['server_type'] = I('server_type');
|
|
|
|
empty($minRatio) || $parameter['min_ratio'] = $minRatio;
|
|
|
|
($minRatio === '') || $parameter['min_ratio'] = $minRatio;
|
|
|
|
empty($maxRatio) || $parameter['max_ratio'] = $maxRatio;
|
|
|
|
($maxRatio === '') || $parameter['max_ratio'] = $maxRatio;
|
|
|
|
|
|
|
|
|
|
|
|
$page = set_pagination($count, $row, $parameter);
|
|
|
|
$page = set_pagination($count, $row, $parameter);
|
|
|
|
if ($page) {
|
|
|
|
if ($page) {
|
|
|
|