diff --git a/Application/Admin/Controller/GameController.class.php b/Application/Admin/Controller/GameController.class.php index 4757e09ba..dd76ed3a7 100644 --- a/Application/Admin/Controller/GameController.class.php +++ b/Application/Admin/Controller/GameController.class.php @@ -243,7 +243,7 @@ class GameController extends ThinkController $subSql = M('promote_company', 'tab_')->field('id')->where(['company_belong' => ['not in', [1, 2]]])->select(false); 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'] . '))']]); \Think\Log::actionLog('Game/add', 'Game', 1); @@ -321,9 +321,9 @@ class GameController extends ThinkController ]; $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_') - ->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'] . '))']]); addOperationLog(array( diff --git a/Application/Admin/Controller/PromoteController.class.php b/Application/Admin/Controller/PromoteController.class.php index 0fdb2ba6c..ad2028986 100644 --- a/Application/Admin/Controller/PromoteController.class.php +++ b/Application/Admin/Controller/PromoteController.class.php @@ -1231,16 +1231,23 @@ class PromoteController extends ThinkController $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'] == '') { + 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'] = []; } else { $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') ->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($games) ? '' : $games; } if (empty($promote['game_ids'])) {