From c4c62d64cb9e97c095682b8e133566f015c747fc Mon Sep 17 00:00:00 2001 From: liu <1873441552@qq.com> Date: Sat, 9 Mar 2024 16:05:20 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B4=A6=E5=8D=95=E7=AE=A1=E7=90=86=E6=97=A5?= =?UTF-8?q?=E8=B4=A6=E5=8D=95=E6=9F=A5=E8=AF=A2=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../merchant/FinancialRecordRepository.php | 23 +++++++++++++++---- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/app/common/repositories/system/merchant/FinancialRecordRepository.php b/app/common/repositories/system/merchant/FinancialRecordRepository.php index 196e4130..c395677e 100755 --- a/app/common/repositories/system/merchant/FinancialRecordRepository.php +++ b/app/common/repositories/system/merchant/FinancialRecordRepository.php @@ -37,6 +37,13 @@ class FinancialRecordRepository extends BaseRepository ,'commission_to_cloud_warehouse','commission_to_cloud_warehouse_refund', 'commission_to_store', 'commission_to_courier', 'commission_to_promoter', 'commission_to_store_refund', 'commission_to_courier_refund', 'commission_to_promoter_refund', 'auto_margin', 'auto_margin_refund', 'supply_chain', 'supply_chain_refund', 'platform_consumption', 'platform_consumption_refund', 'merchant_order', 'merchant_order_refund' ]; + public $commonFinancialMixType = [ + 'order', 'order_presell', 'order_refund', 'brokerage_one', 'brokerage_two', 'refund_brokerage_one', 'refund_brokerage_two', 'refund_order','order_platform_coupon', + 'order_svip_coupon','commission_to_service_team','commission_to_service_team_refund','commission_to_platform','commission_to_platform_refund','commission_to_village','commission_to_village_refund','commission_to_town','commission_to_town_refund' + ,'commission_to_entry_merchant','commission_to_entry_merchant_refund' + ,'commission_to_cloud_warehouse','commission_to_cloud_warehouse_refund', 'commission_to_courier', 'commission_to_store_refund', 'commission_to_courier_refund', 'commission_to_promoter_refund', 'auto_margin','supply_chain', 'supply_chain_refund', 'platform_consumption', 'platform_consumption_refund', 'merchant_order', 'merchant_order_refund' + ]; + const TYPE_CN_MAP = [ 'order' => '订单支付', 'order_presell' => '预售订单(定金)', @@ -414,7 +421,8 @@ class FinancialRecordRepository extends BaseRepository //日 if ($where['type'] == 1) { $field = Db::raw('from_unixtime(unix_timestamp(create_time),\'%Y-%m-%d\') as time'); - } else { + } + else { //月 if (!empty($where['date'])) { list($startTime, $endTime) = explode('-', $where['date']); @@ -425,12 +433,13 @@ class FinancialRecordRepository extends BaseRepository } $field = Db::raw('from_unixtime(unix_timestamp(create_time),\'%Y-%m\') as time'); } - $make = app()->make(UserBillRepository::class); +// $make = app()->make(UserBillRepository::class); $query = $this->dao->search($where)->field($field)->group("time")->order('create_time DESC'); $count = $query->count(); $list = $query->page($page, $limit)->select()->each(function ($item) use ($where, $merchant) { $key = $where['is_mer'] ? $where['is_mer'] . '_financial_record_list_' . $item['time'] : 'sys_financial_record_list_' . $item['time']; + if (($where['type'] == 1 && ($item['time'] == date('Y-m-d', time()))) || ($where['type'] == 2 && ($item['time'] == date('Y-m', time())))) { $income = ($this->countIncome($where['type'], $where, $item['time'],$merchant))['number']; $expend = ($this->countExpend($where['type'], $where, $item['time'],$merchant))['number']; @@ -440,7 +449,7 @@ class FinancialRecordRepository extends BaseRepository 'charge' => bcsub($income, $expend, 2), ]; } else { - if (!$ret = Cache::get($key)) { + if (empty(Cache::get($key))) { $income = ($this->countIncome($where['type'], $where, $item['time'],$merchant))['number']; $expend = ($this->countExpend($where['type'], $where, $item['time'],$merchant))['number']; $ret = [ @@ -449,6 +458,8 @@ class FinancialRecordRepository extends BaseRepository 'charge' => bcsub($income, $expend, 2), ]; Cache::tag('system')->set($key, $ret, 24 * 3600); + } else{ + $ret = Cache::get($key); } } $item['income'] = $ret['income']; @@ -613,7 +624,7 @@ class FinancialRecordRepository extends BaseRepository 'commission_to_courier_refund', 'supply_chain_refund', 'auto_margin', 'platform_consumption_refund']; } if ($merchant){ - switch ($merchant['type_id']) { + switch ($merchant['type_id']) {//21? case 16: $financialType1 = ['commission_to_town']; break; @@ -633,7 +644,9 @@ class FinancialRecordRepository extends BaseRepository $financialType1 = []; } - $financialType = array_merge($financialType, $financialType1); + + + $financialType = array_merge($financialType, $financialType1,$this->commonFinancialMixType); } [$data['count_order'], $data['number_order']] = $this->dao->getDataByType($type, $where, $date, $financialType); if (!empty($financialType1)){