From c137a10c8f0d5e2e27a4157968f4512bae95d0de Mon Sep 17 00:00:00 2001 From: chenzhi Date: Wed, 19 Aug 2020 18:38:14 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E6=B8=B8=E6=88=8F=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E8=B7=9F=E9=9A=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controller/OldCountController.class.php | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/Application/Admin/Controller/OldCountController.class.php b/Application/Admin/Controller/OldCountController.class.php index b9bde1856..1ba51b2b5 100644 --- a/Application/Admin/Controller/OldCountController.class.php +++ b/Application/Admin/Controller/OldCountController.class.php @@ -9,6 +9,24 @@ namespace Admin\Controller; */ class OldCountController extends \Think\Controller { + + public function changeCompanyGameidToPromoteGameid() + { + //默认设为 + $Promote = M("Promote","tab_"); + $PromoteCompany = M("promote_company","tab_"); + $p_res = $PromoteCompany->field("id,game_ids")->select(); + + foreach ($p_res as $k => $v) { + if(!empty($v['game_ids'])){ + $savedata =["company_id"=>$v['id'] ]; + $savedata['game_ids'] = $this->changeRelationGameidToGameid($v['game_ids']); + $Promote->save($savedata); + } + } + echo "changeCompanyGameidToPromoteGameid success"; + } + /** * 公会关系及游戏迁移 * 1. 迁移 公会company_relation到公司 @@ -50,6 +68,16 @@ class OldCountController extends \Think\Controller return implode(",",array_column($rid,'relation_game_id')); } } + protected function changeRelationGameidToGameid($ids,$type=false) + { + $rid = M('game', 'tab_')->field('id')->where(["relation_game_id"=>["in",$ids]])->select(); + if($type){ + return array_column($rid,'id'); + }else{ + return implode(",",array_column($rid,'id')); + } + + } /** * 优化旧表数值,新表需要将 开票税点及渠道费 * 100