You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

39 lines
1.0 KiB

<?php
namespace App\Service\v3\Implementations;
use App\Constants\v3\OrderState;
use App\Model\v3\Order;
use \App\Service\v3\Interfaces\OrderStatisticsServiceInterface;
class OrderStatisticsService implements OrderStatisticsServiceInterface
{
public function do()
{
// TODO: Implement do() method.
}
public function check()
{
// TODO: Implement check() method.
}
public function undo()
{
// TODO: Implement undo() method.
}
public function countOrder($storeId,$type,$startTime = '',$endTime = '')
{
$builder = Order::join('lanzu_order_main','lanzu_order_main.global_order_id','lanzu_order.order_main_id')
->where('lanzu_order.store_id',$storeId);
if(!empty($startTime) && !empty($endTime)){
$builder->whereBetween('lanzu_order_main.created_at',[$startTime,$endTime]);
}
$count = $builder->whereIn('lanzu_order_main.state', OrderState::FINISH)
->where('type',$type)
->count();
return $count;
}
}