From 26ccc9c4504a8e412fddb28ebdda5bae04ce8bc6 Mon Sep 17 00:00:00 2001 From: chenzhi Date: Mon, 22 Jun 2020 20:26:49 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E4=BC=98=E5=8C=96=E5=AF=BC=E5=87=BA?= =?UTF-8?q?=E6=9D=83=E9=99=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controller/CompanyGameRatioController.class.php | 4 ++-- .../Admin/Controller/OldCountController.class.php | 12 ++++++++++++ Application/Admin/View/CompanyGameRatio/index.html | 2 -- Application/Admin/View/CompanyGameRatio/lists.html | 2 -- Application/Admin/View/CompanyRelation/index.html | 2 -- Application/Admin/View/CompanyRelation/lists.html | 2 -- 6 files changed, 14 insertions(+), 10 deletions(-) diff --git a/Application/Admin/Controller/CompanyGameRatioController.class.php b/Application/Admin/Controller/CompanyGameRatioController.class.php index 968f39e3d..7ffc2a342 100644 --- a/Application/Admin/Controller/CompanyGameRatioController.class.php +++ b/Application/Admin/Controller/CompanyGameRatioController.class.php @@ -39,7 +39,7 @@ class CompanyGameRatioController extends AdminController if(isset($params['company_id'])){ $where['m.company_id'] = $params['company_id']; } - $this->checkListOrCountAuthRestMap($where); + // $this->checkListOrCountAuthRestMap($where); $gameres = M("game","tab_")->field("tab_game.relation_game_id,tab_game.relation_game_name,IF(tab_game.original_package_name='','未配置',tab_game.original_package_name) original_package_name,tab_game_type.type_name game_type_name")->where($gamewhere)->join("tab_game_type on tab_game.game_type_id = tab_game_type.id")->group("tab_game.relation_game_id")->select(false); $dbres = M("company_game_ratio","tab_") @@ -136,7 +136,7 @@ class CompanyGameRatioController extends AdminController $where['m.status'] = $params['status']; } //TODO:未计算公司类型 - $this->checkListOrCountAuthRestMap($where); + // $this->checkListOrCountAuthRestMap($where); $gameres = M("game","tab_")->field("tab_game.relation_game_id,tab_game.relation_game_name,IF(tab_game.original_package_name='','未配置',tab_game.original_package_name) original_package_name,tab_game_type.type_name game_type_name")->where($gamewhere)->join("tab_game_type on tab_game.game_type_id = tab_game_type.id")->group("tab_game.relation_game_id")->select(false); $dbres = M("company_game_ratio_log","tab_") ->alias('m') diff --git a/Application/Admin/Controller/OldCountController.class.php b/Application/Admin/Controller/OldCountController.class.php index 5602108ec..af7739fe6 100644 --- a/Application/Admin/Controller/OldCountController.class.php +++ b/Application/Admin/Controller/OldCountController.class.php @@ -9,6 +9,18 @@ namespace Admin\Controller; */ class OldCountController extends \Think\Controller { + /** + * 新的游戏比例后的数据迁移 + * 重复执行将会叠加数据,请勿重复执行 + */ + // public function PromoteToCompanyRatioInit() + // { + // //获取旧数据 + // $oldres = M("promote_game_ratio","tab_")->field("promote_id,relation_game_id,ratio,turnover_ratio,begin_time,end_time")->group("promote_id,relation_game_id")->select(); + + // dd($oldres); + // } + /** * 财务分类汇总统计旧数据聚合 */ diff --git a/Application/Admin/View/CompanyGameRatio/index.html b/Application/Admin/View/CompanyGameRatio/index.html index 2633ac58a..b0985781f 100644 --- a/Application/Admin/View/CompanyGameRatio/index.html +++ b/Application/Admin/View/CompanyGameRatio/index.html @@ -157,10 +157,8 @@
- 导出 - {$_page|default=''}
diff --git a/Application/Admin/View/CompanyGameRatio/lists.html b/Application/Admin/View/CompanyGameRatio/lists.html index 3aa06cbf2..f1553d7de 100644 --- a/Application/Admin/View/CompanyGameRatio/lists.html +++ b/Application/Admin/View/CompanyGameRatio/lists.html @@ -214,10 +214,8 @@
- 导出 - {$_page|default=''}
diff --git a/Application/Admin/View/CompanyRelation/index.html b/Application/Admin/View/CompanyRelation/index.html index 27f727a81..eb9bf0acb 100644 --- a/Application/Admin/View/CompanyRelation/index.html +++ b/Application/Admin/View/CompanyRelation/index.html @@ -155,10 +155,8 @@
- 导出 - {$_page|default=''}
diff --git a/Application/Admin/View/CompanyRelation/lists.html b/Application/Admin/View/CompanyRelation/lists.html index 782f0779b..997e76d31 100644 --- a/Application/Admin/View/CompanyRelation/lists.html +++ b/Application/Admin/View/CompanyRelation/lists.html @@ -228,10 +228,8 @@
- 导出 - {$_page|default=''}
From bffc9a32f1c8cc6948eca0953bbd119fb4a5b9ad Mon Sep 17 00:00:00 2001 From: chenzhi Date: Mon, 22 Jun 2020 20:42:44 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E6=95=B0=E6=8D=AE=E8=BF=81=E7=A7=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controller/OldCountController.class.php | 35 +++++++++++++++---- 1 file changed, 28 insertions(+), 7 deletions(-) diff --git a/Application/Admin/Controller/OldCountController.class.php b/Application/Admin/Controller/OldCountController.class.php index af7739fe6..52e7500f8 100644 --- a/Application/Admin/Controller/OldCountController.class.php +++ b/Application/Admin/Controller/OldCountController.class.php @@ -13,13 +13,34 @@ class OldCountController extends \Think\Controller * 新的游戏比例后的数据迁移 * 重复执行将会叠加数据,请勿重复执行 */ - // public function PromoteToCompanyRatioInit() - // { - // //获取旧数据 - // $oldres = M("promote_game_ratio","tab_")->field("promote_id,relation_game_id,ratio,turnover_ratio,begin_time,end_time")->group("promote_id,relation_game_id")->select(); - - // dd($oldres); - // } + public function PromoteToCompanyRatioInit() + { + //获取旧数据 + $oldres = M("promote_game_ratio","tab_")->field("promote_id,relation_game_id,ratio,turnover_ratio,begin_time,end_time")->group("promote_id,relation_game_id")->select(); + $adddata = []; + $CompanyGameRatio = M("company_game_ratio","tab_"); + foreach ($oldres as $k => &$v) { + $comoany_id = $this->promoteIdToCompanyId($v['promote_id']); + unset($v['promote_id']); + $v['company_id'] = $comoany_id ; + $adddata[$comoany_id] = $v; + } + foreach($adddata as $k => &$v){ + $map = [ + "company_id"=>$v['company_id'], + "relation_game_id"=>$v['relation_game_id'] + ]; + $cres = $CompanyGameRatio->where($map)->find(); + if(empty($cres)){ + $CompanyGameRatio->add($v); + } + } + echo "PromoteToCompanyRatioInit success"; + } + protected function promoteIdToCompanyId($promote_id) + { + return M("promote","tab_")->field("company_id")->where("id='{$promote_id}'")->find()['company_id']; + } /** * 财务分类汇总统计旧数据聚合