diff --git a/Application/Admin/Controller/DepositController.class.php b/Application/Admin/Controller/DepositController.class.php index c2824467c..af749d832 100644 --- a/Application/Admin/Controller/DepositController.class.php +++ b/Application/Admin/Controller/DepositController.class.php @@ -89,7 +89,7 @@ class DepositController extends ThinkController { $sort = $data_order==3?'desc':'asc'; $map['order'] = $data_order_type.' '.$sort; } - + D(self::model_name)->addSubsiteWhere($map); $map1=$map; $map1['pay_status']=1; @@ -97,8 +97,12 @@ class DepositController extends ThinkController { $total=null_to_0(D(self::model_name)->where($map1)->sum('pay_amount')); - $ttotal=null_to_0(D(self::model_name)->where('payed_time'.total(1))->where(array('pay_status'=>1))->sum('pay_amount')); - $ytotal=null_to_0(D(self::model_name)->where('payed_time'.total(5))->where(array('pay_status'=>1))->sum('pay_amount')); + + $otherMap = ["pay_status"=>1]; + D(self::model_name)->addSubsiteWhere($otherMap); + + $ttotal=null_to_0(D(self::model_name)->where('payed_time'.total(1))->where($otherMap)->sum('pay_amount')); + $ytotal=null_to_0(D(self::model_name)->where('payed_time'.total(5))->where($otherMap)->sum('pay_amount')); $this->assign('total',$total); $this->assign('ttotal',$ttotal); $this->assign('ytotal',$ytotal); diff --git a/Application/Admin/Controller/ExportController.class.php b/Application/Admin/Controller/ExportController.class.php index b7d925114..cebf54414 100644 --- a/Application/Admin/Controller/ExportController.class.php +++ b/Application/Admin/Controller/ExportController.class.php @@ -1430,6 +1430,7 @@ class ExportController extends Controller $map['merchant_id'] = $_REQUEST['merchant_id']; unset($_REQUEST['merchant_id']); } + D('Deposit')->addSubsiteWhere($map); $map1 = $map; $map1['pay_status'] = 1; diff --git a/Application/Admin/Model/DepositModel.class.php b/Application/Admin/Model/DepositModel.class.php index 08a0a3209..741fbcbe5 100644 --- a/Application/Admin/Model/DepositModel.class.php +++ b/Application/Admin/Model/DepositModel.class.php @@ -36,11 +36,6 @@ class DepositModel extends Model { public function __construct($name = '', $tablePrefix = '', $connection = '') { /* 设置默认的表前缀 */ $this->tablePrefix ='tab_'; - if(is_subsiteTable("tab_spend")){ - //修改连接 - $this->connection = SUBSITE_DB; - $connection = SUBSITE_DB; - } /* 执行构造方法 */ parent::__construct($name, $tablePrefix, $connection); } @@ -56,7 +51,20 @@ class DepositModel extends Model { } - + /** + * 添加子站点条件 + * @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; + } + } /*