账单管理日账单查询修改
This commit is contained in:
parent
5e33bfa9a4
commit
c4c62d64cb
@ -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)){
|
||||
|
Loading…
x
Reference in New Issue
Block a user