|
|
|
@ -13,17 +13,17 @@ declare (strict_types=1); |
|
|
|
|
namespace app\store\model; |
|
|
|
|
|
|
|
|
|
use app\api\service\User as UserService; |
|
|
|
|
use app\common\enum\payment\Method; |
|
|
|
|
use app\common\model\Order as OrderModel; |
|
|
|
|
use app\common\service\Order as OrderService; |
|
|
|
|
use app\common\service\order\Refund as RefundService; |
|
|
|
|
use app\common\service\order\Printer as PrinterService; |
|
|
|
|
use app\common\enum\order\{ |
|
|
|
|
DataType as DataTypeEnum, |
|
|
|
|
use app\common\enum\order\{DataType as DataTypeEnum, |
|
|
|
|
DeliveryType, |
|
|
|
|
PayStatus as PayStatusEnum, |
|
|
|
|
OrderStatus as OrderStatusEnum, |
|
|
|
|
ReceiptStatus as ReceiptStatusEnum, |
|
|
|
|
DeliveryStatus as DeliveryStatusEnum |
|
|
|
|
}; |
|
|
|
|
DeliveryStatus as DeliveryStatusEnum}; |
|
|
|
|
use app\common\library\helper; |
|
|
|
|
use cores\exception\BaseException; |
|
|
|
|
|
|
|
|
@ -121,7 +121,7 @@ class Order extends OrderModel |
|
|
|
|
// 设置订单类型条件 |
|
|
|
|
$dataTypeFilter = $this->getFilterDataType($param['dataType']); |
|
|
|
|
// 获取数据列表 |
|
|
|
|
$query = $this->with(['goods.image', 'user.avatar', 'address', 'delivery']) |
|
|
|
|
$query = $this |
|
|
|
|
->alias('order') |
|
|
|
|
->field('order.*') |
|
|
|
|
->leftJoin('user', 'user.user_id = order.user_id') |
|
|
|
@ -133,8 +133,10 @@ class Order extends OrderModel |
|
|
|
|
// $query = $query->whereOr($filterOr); |
|
|
|
|
$query = $query->where($filterOr); |
|
|
|
|
} |
|
|
|
|
// 加载关联订单数据 |
|
|
|
|
$list = $query->order(['order.create_time' => 'desc']) |
|
|
|
|
->paginate(10); |
|
|
|
|
$list = static::preload($list, ['goods.image', 'user.avatar', 'address', 'delivery'], true); |
|
|
|
|
return $list; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -197,7 +199,8 @@ class Order extends OrderModel |
|
|
|
|
} |
|
|
|
|
// 起止时间 |
|
|
|
|
if (!empty($params['betweenTime'])) { |
|
|
|
|
$times = between_time($params['betweenTime']); |
|
|
|
|
$betweenTime = explode(',', $params['betweenTime']); |
|
|
|
|
$times = between_time($betweenTime); |
|
|
|
|
$filter[] = ['order.create_time', '>=', $times['start_time']]; |
|
|
|
|
$filter[] = ['order.create_time', '<', $times['end_time'] + 86400]; |
|
|
|
|
} |
|
|
|
|