From c40fbf3870b5e21e0d300ecbac361396353ffaf6 Mon Sep 17 00:00:00 2001 From: "elf@home" <360197197@qq.com> Date: Sun, 23 Aug 2020 22:25:01 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E6=B8=B8=E6=88=8F?= =?UTF-8?q?=E8=87=AA=E5=8A=A8=E6=8E=88=E6=9D=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Admin/Controller/GameController.class.php | 14 ++++++++++++++ Application/Admin/Model/GameModel.class.php | 1 + 2 files changed, 15 insertions(+) diff --git a/Application/Admin/Controller/GameController.class.php b/Application/Admin/Controller/GameController.class.php index 01e7b01cd..4757e09ba 100644 --- a/Application/Admin/Controller/GameController.class.php +++ b/Application/Admin/Controller/GameController.class.php @@ -237,6 +237,15 @@ class GameController extends ThinkController ]; $gameService->saveBaseGame($baseData); + M('promote_company', 'tab_') + ->where('1=1') + ->save(['game_ids' => ['exp', 'trim(BOTH "," FROM concat(game_ids, ",", ' . $res['relation_game_id'] . '))']]); + + $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 . ')']) + ->save(['game_ids' => ['exp', 'trim(BOTH "," FROM concat(game_ids, ",", ' . $res['id'] . '))']]); + \Think\Log::actionLog('Game/add', 'Game', 1); //操作日志 addOperationLog(array( @@ -312,6 +321,11 @@ class GameController extends ThinkController ]; $gameService->saveBaseGame($baseData); + $subSql = M('promote_company', 'tab_')->field('id')->where(['company_belong' => ['in', [1, 2]]])->select(false); + M('promote', 'tab_') + ->where(['_string' => 'company_id in (' . $subSql . ')']) + ->save(['game_ids' => ['exp', 'trim(BOTH "," FROM concat(game_ids, ",", ' . $res['id'] . '))']]); + addOperationLog(array( "op_type"=>0, "key"=>$_POST['game_name'], diff --git a/Application/Admin/Model/GameModel.class.php b/Application/Admin/Model/GameModel.class.php index fdaee470c..8bdd419b7 100644 --- a/Application/Admin/Model/GameModel.class.php +++ b/Application/Admin/Model/GameModel.class.php @@ -143,6 +143,7 @@ class GameModel extends Model{ }else{ if(!isset($data['relation_game_id'])){ $relation = M('Game','tab_')->where(array('id'=>$id))->save(array('relation_game_id'=>$id)); + $data['relation_game_id'] = $id; if(!$relation){ $this->error('关联id添加失败');//游戏添加完成 } From 34a22d65bf48a437c435f58887e59651bd12dd9d Mon Sep 17 00:00:00 2001 From: ELF <360197197@qq.com> Date: Mon, 24 Aug 2020 17:26:31 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Admin/Controller/GameController.class.php | 6 +++--- .../Admin/Controller/PromoteController.class.php | 13 ++++++++++--- 2 files changed, 13 insertions(+), 6 deletions(-) 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'])) {