master
ELF 4 years ago
parent c40fbf3870
commit 34a22d65bf

@ -243,7 +243,7 @@ class GameController extends ThinkController
$subSql = M('promote_company', 'tab_')->field('id')->where(['company_belong' => ['not in', [1, 2]]])->select(false); $subSql = M('promote_company', 'tab_')->field('id')->where(['company_belong' => ['not in', [1, 2]]])->select(false);
M('promote', 'tab_') M('promote', 'tab_')
->where(['_string' => 'company_id in (' . $subSql . ')']) ->where(['_string' => 'company_id in (' . $subSql . ') or company_id=0'])
->save(['game_ids' => ['exp', 'trim(BOTH "," FROM concat(game_ids, ",", ' . $res['id'] . '))']]); ->save(['game_ids' => ['exp', 'trim(BOTH "," FROM concat(game_ids, ",", ' . $res['id'] . '))']]);
\Think\Log::actionLog('Game/add', 'Game', 1); \Think\Log::actionLog('Game/add', 'Game', 1);
@ -321,9 +321,9 @@ class GameController extends ThinkController
]; ];
$gameService->saveBaseGame($baseData); $gameService->saveBaseGame($baseData);
$subSql = M('promote_company', 'tab_')->field('id')->where(['company_belong' => ['in', [1, 2]]])->select(false); $subSql = M('promote_company', 'tab_')->field('id')->where(['company_belong' => ['not in', [1, 2]]])->select(false);
M('promote', 'tab_') M('promote', 'tab_')
->where(['_string' => 'company_id in (' . $subSql . ')']) ->where(['_string' => 'company_id in (' . $subSql . ') or company_id=0'])
->save(['game_ids' => ['exp', 'trim(BOTH "," FROM concat(game_ids, ",", ' . $res['id'] . '))']]); ->save(['game_ids' => ['exp', 'trim(BOTH "," FROM concat(game_ids, ",", ' . $res['id'] . '))']]);
addOperationLog(array( addOperationLog(array(

@ -1231,16 +1231,23 @@ class PromoteController extends ThinkController
$promote = M('promote', 'tab_')->field('id,account,game_ids,company_id')->where(['id'=>$promoteId])->find(); $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(); $company = M('promote_company', 'tab_')->field('game_ids')->where(['id' => $promote['company_id']])->find();
$data = []; $data = [];
if (!$company || $company['game_ids'] == '') { if (is_null($company)) {
$games = 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($games) ? '' : $games;
} elseif ($company['game_ids'] == '') {
$data['data']['game_list'] = []; $data['data']['game_list'] = [];
} else { } else {
$companyGameIds = explode(',', $company['game_ids']); $companyGameIds = explode(',', $company['game_ids']);
$game_list = M('game', 'tab_') $games = M('game', 'tab_')
->field('relation_game_id id,relation_game_name game_name,short') ->field('relation_game_id id,relation_game_name game_name,short')
->where(['game_status'=>1, 'down_port'=>1, 'id' => ['in', $companyGameIds]]) ->where(['game_status'=>1, 'down_port'=>1, 'id' => ['in', $companyGameIds]])
->group("relation_game_id") ->group("relation_game_id")
->select(); ->select();
$data['data']['game_list'] = empty($game_list) ? '' : $game_list; $data['data']['game_list'] = empty($games) ? '' : $games;
} }
if (empty($promote['game_ids'])) { if (empty($promote['game_ids'])) {

Loading…
Cancel
Save