|
|
|
@ -1190,17 +1190,29 @@ class PromoteController extends ThinkController
|
|
|
|
|
{
|
|
|
|
|
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();
|
|
|
|
|
$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'])) {
|
|
|
|
|
$promote_info['game_ids'] = [];
|
|
|
|
|
$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 {
|
|
|
|
|
$this->changeGameidToRelationGameid($promote_info['game_ids']);
|
|
|
|
|
$promote_info['game_ids'] = explode(',', $promote_info['game_ids']);
|
|
|
|
|
$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']['promote_info'] = empty($promote_info) ? '' : $promote_info;
|
|
|
|
|
|
|
|
|
|
if (empty($promote['game_ids'])) {
|
|
|
|
|
$promote['game_ids'] = [];
|
|
|
|
|
} else {
|
|
|
|
|
$this->changeGameidToRelationGameid($promote['game_ids']);
|
|
|
|
|
$promote['game_ids'] = explode(',', $promote['game_ids']);
|
|
|
|
|
}
|
|
|
|
|
$data['data']['promote_info'] = empty($promote) ? '' : $promote;
|
|
|
|
|
$data['msg'] = '请求成功';
|
|
|
|
|
$data['code'] = 1;
|
|
|
|
|
|
|
|
|
|