|
|
@ -35,6 +35,7 @@ class OrderStatisticsService implements OrderStatisticsServiceInterface |
|
|
$goodsTable = ApplicationContext::getContainer()->get(OrderGoods::class)->getTable(); |
|
|
$goodsTable = ApplicationContext::getContainer()->get(OrderGoods::class)->getTable(); |
|
|
|
|
|
|
|
|
$builder = OrderMain::query() |
|
|
$builder = OrderMain::query() |
|
|
|
|
|
->selectRaw('COUNT(DISTINCT '.$mainTable.'.id) AS count') |
|
|
->join($childTable, ''.$childTable.'.order_main_id', '=', ''.$mainTable.'.global_order_id') |
|
|
->join($childTable, ''.$childTable.'.order_main_id', '=', ''.$mainTable.'.global_order_id') |
|
|
->where([''.$childTable.'.store_id' => $storeId, ''.$mainTable.'.type' => $type]) |
|
|
->where([''.$childTable.'.store_id' => $storeId, ''.$mainTable.'.type' => $type]) |
|
|
->whereIn(''.$mainTable.'.state', array_merge(OrderState::FINISH, [OrderState::REFUNDED,OrderState::REFUND_REFUSE])); |
|
|
->whereIn(''.$mainTable.'.state', array_merge(OrderState::FINISH, [OrderState::REFUNDED,OrderState::REFUND_REFUSE])); |
|
|
@ -52,7 +53,7 @@ class OrderStatisticsService implements OrderStatisticsServiceInterface |
|
|
$builder = $builder->where(''.$mainTable.'.created_at', '<=', $endTime); |
|
|
$builder = $builder->where(''.$mainTable.'.created_at', '<=', $endTime); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
return $builder->count(); |
|
|
|
|
|
|
|
|
return $builder->first()->count; |
|
|
|
|
|
|
|
|
// $builder = Order::join('lanzu_order_main','lanzu_order_main.global_order_id','lanzu_order.order_main_id')
|
|
|
// $builder = Order::join('lanzu_order_main','lanzu_order_main.global_order_id','lanzu_order.order_main_id')
|
|
|
// ->where('lanzu_order.store_id',$storeId);
|
|
|
// ->where('lanzu_order.store_id',$storeId);
|
|
|
|