master
ELF 4 years ago
parent 451b2b3105
commit 46fc13a91e

@ -1190,17 +1190,29 @@ class PromoteController extends ThinkController
{ {
if (IS_AJAX) { if (IS_AJAX) {
//获取所有游戏 //获取所有游戏
$game_list = M('game', 'tab_')->field('relation_game_id id,relation_game_name game_name,short')->where(['game_status'=>1,'down_port'=>1])->group("relation_game_id")->select(); $promoteId = I('id', 0, 'intval');
$promote = M('promote', 'tab_')->field('id,account,game_ids,company_id')->where(['id'=>$promoteId])->find();
$company = M('promote_company', 'tab_')->field('game_ids')->where(['id' => $promote['company_id']])->find();
$data = [];
if (!$company || $company['game_ids'] == '') {
$data['data']['game_list'] = [];
} else {
$companyGameIds = explode(',', $company['game_ids']);
$game_list = M('game', 'tab_')
->field('relation_game_id id,relation_game_name game_name,short')
->where(['game_status'=>1, 'down_port'=>1, 'id' => ['in', $companyGameIds]])
->group("relation_game_id")
->select();
$data['data']['game_list'] = empty($game_list) ? '' : $game_list; $data['data']['game_list'] = empty($game_list) ? '' : $game_list;
//获取推广员信息 }
$promote_info = M('promote', 'tab_')->field('id,account,game_ids')->where(['id'=>I('id', 0, 'intval')])->find();
if (empty($promote_info['game_ids'])) { if (empty($promote['game_ids'])) {
$promote_info['game_ids'] = []; $promote['game_ids'] = [];
} else { } else {
$this->changeGameidToRelationGameid($promote_info['game_ids']); $this->changeGameidToRelationGameid($promote['game_ids']);
$promote_info['game_ids'] = explode(',', $promote_info['game_ids']); $promote['game_ids'] = explode(',', $promote['game_ids']);
} }
$data['data']['promote_info'] = empty($promote_info) ? '' : $promote_info; $data['data']['promote_info'] = empty($promote) ? '' : $promote;
$data['msg'] = '请求成功'; $data['msg'] = '请求成功';
$data['code'] = 1; $data['code'] = 1;

@ -1113,12 +1113,16 @@ class PromoteService {
/* $gameIds = M('game', 'tab_')->getField('id', true); /* $gameIds = M('game', 'tab_')->getField('id', true);
$selfGameIds = $promote['game_ids'] == '' ? $gameIds : explode(',', $promote['game_ids']); */ $selfGameIds = $promote['game_ids'] == '' ? $gameIds : explode(',', $promote['game_ids']); */
$selfGameIds = $promote['game_ids'] == '' ? [] : explode(',', $promote['game_ids']); $topPromote = $this->getTopPromote($promote);
$topGameIds = $topPromote['game_ids'] == '' ? [] : explode(',', $topPromote['game_ids']);
$selfGameIds = $topGameIds;
// $selfGameIds = $promote['game_ids'] == '' ? [] : explode(',', $promote['game_ids']);
// $selfGameIds = array_intersect($topGameIds, $selfGameIds);
if ($promote['level'] == 1) { if ($promote['level'] == 1) {
return $selfGameIds; return $selfGameIds;
} }
$topPromote = $this->getTopPromote($promote);
if ($topPromote['child_game_permission'] == 0) { if ($topPromote['child_game_permission'] == 0) {
$gameIds = M('apply', 'tab_')->where(['offline_status' => 0, 'promote_id' => $topPromote['id']])->getField('game_id', true); $gameIds = M('apply', 'tab_')->where(['offline_status' => 0, 'promote_id' => $topPromote['id']])->getField('game_id', true);
if (empty($gameIds)) { if (empty($gameIds)) {

Loading…
Cancel
Save