文件地址:
app/services/statistic/OrderStatisticServices.php
一、方法名:getBasic
代码:
$data['refund_price'] = $orderService->sum(['paid' => 1, 'pid' => 0, 'is_refund' => 1, 'refund_reason_time' => explode('-',$where['time'])], 'refund_price', true);
$data['refund_count'] = $orderService->count(['paid' => 1, 'pid' => 0, 'is_refund' => 1, 'refund_reason_time' => explode('-',$where['time'])]);
如下图
二、方法名:trend
代码:
$refund_price = array_column($storeOrder->getProductTrend($time, $timeType, 'refund_reason_time', 'sum(pay_price)', 'refund'), 'num', 'days');
$refund_count = array_column($storeOrder->getProductTrend($time, $timeType, 'refund_reason_time', 'count(id)', 'refund'), 'num', 'days');
如下图:
三、文件地址:app/model/order/StoreOrder.php
添加搜索器
public function searchRefundReasonTimeAttr($query, $value)
{
if($value !== ''){
if(is_array($value)){
$query->whereBetween('refund_reason_time', [strtotime($value[0]), strtotime($value[1]) + 86400]);
}else{
$query->where('refund_reason_time', $value);
}
}
}
如下图: