From 4fdb94c617ab6dc7d09665d7717d253df1cd0f25 Mon Sep 17 00:00:00 2001 From: chenzhi Date: Fri, 25 Dec 2020 14:33:47 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E8=AE=A2=E5=8D=95=E6=9F=A5?= =?UTF-8?q?=E8=AF=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controller/SpendController.class.php | 4 +++- Application/Admin/Model/SpendModel.class.php | 23 +++++++++++++------ jbc.php => wm.php | 6 ++--- 3 files changed, 22 insertions(+), 11 deletions(-) rename jbc.php => wm.php (82%) diff --git a/Application/Admin/Controller/SpendController.class.php b/Application/Admin/Controller/SpendController.class.php index 21cc11748..90934283f 100644 --- a/Application/Admin/Controller/SpendController.class.php +++ b/Application/Admin/Controller/SpendController.class.php @@ -131,9 +131,11 @@ class SpendController extends ThinkController // $map1 = $map; // } $this->checkListOrCountAuthRestMap($map,["extend", "pay_order_number", "user_account"]); + D("Spend")->addSubsiteWhere($map); + $map1 = $map; $map1['pay_status'] = 1; - $total = null_to_0(SM(self::model_name)->where($map1)->sum('pay_amount')); + $total = null_to_0(M(self::model_name,"tab_")->where($map1)->sum('pay_amount')); $this->assign('total', $total); $this->meta_title = $this->m_title = '游戏充值'; $this->assign('commonset', M('Kuaijieicon')->where(['url' => 'Spend/lists', 'status' => 1])->find()); diff --git a/Application/Admin/Model/SpendModel.class.php b/Application/Admin/Model/SpendModel.class.php index 4ef667a17..619a5adb5 100644 --- a/Application/Admin/Model/SpendModel.class.php +++ b/Application/Admin/Model/SpendModel.class.php @@ -51,11 +51,6 @@ class SpendModel extends Model { /* 设置默认的表前缀 */ $this->tablePrefix = 'tab_'; - if(is_subsiteTable("tab_spend")){ - //修改连接 - $this->connection = SUBSITE_DB; - $connection = SUBSITE_DB; - } /* 执行构造方法 */ parent::__construct($name, $tablePrefix, $connection); } @@ -71,6 +66,20 @@ class SpendModel extends Model $create_time = I('post.create_time'); return $create_time ? strtotime($create_time) : NOW_TIME; } + /** + * 添加子站点条件 + * @param [arrary] $map + * @param string $alias spend数据库别名 + * @return void + */ + public function addSubsiteWhere(&$map,$alias='') + { + $field = "partner_type"; + !empty($alias) && $field = $alias.".".$field; + if(IS_SUBSITE){ + $map[$field] = PARTNER_TYPE; + } + } public function amdin_account() { @@ -895,7 +904,7 @@ class SpendModel extends Model }else{ $map['s.game_id'] = '-1'; } - $data = SM("Spend","tab_") + $data = M("Spend","tab_") ->alias('s') ->index('game_time') ->where(['s.pay_status' => 1]) @@ -937,7 +946,7 @@ class SpendModel extends Model $map['s.game_id'] = ['in', $gameIds]; } - $data = SM("Spend","tab_") + $data = M("Spend","tab_") ->alias('s') ->index('game_time') ->field(" diff --git a/jbc.php b/wm.php similarity index 82% rename from jbc.php rename to wm.php index a9d560325..ab8dd2e59 100644 --- a/jbc.php +++ b/wm.php @@ -35,12 +35,12 @@ define ( 'RUNTIME_PATH', './Runtime/' ); * 项目配置 */ $JBC_DB_CONFIG = include_once APP_PATH."/Common/Conf/env.php"; -$JBC_DB_CONFIG = $JBC_DB_CONFIG['SUBSITE_DB_CONFIG']['JBC_DB_CONFIG']; +$JBC_DB_CONFIG = $JBC_DB_CONFIG['SUBSITE_DB_CONFIG']['WM_DB_CONFIG']; define ( 'IS_SUBSITE', true); define ( 'PARTNER_TYPE', 2); -define ( 'SUBSITE_NAME', "jbc"); +define ( 'SUBSITE_NAME', "wm"); define ( 'SUBSITE_DB', $JBC_DB_CONFIG ); -define ( 'SUBSITE_INDEX', "jbc.php" );//子站点路口,影响session +define ( 'SUBSITE_INDEX', "wm.php" );//子站点路口,影响session /** * 引入核心入口