|
|
|
@ -3,8 +3,10 @@ |
|
|
|
namespace App\Service\v3\Implementations; |
|
|
|
|
|
|
|
use App\Constants\v3\OrderState; |
|
|
|
use App\Constants\v3\OrderType; |
|
|
|
use App\Model\v3\OrderMain; |
|
|
|
use App\Model\v3\Order; |
|
|
|
use App\Model\v3\ShoppingCart; |
|
|
|
use App\Service\v3\Interfaces\OrderListServiceInterface; |
|
|
|
use Hyperf\Paginator\Paginator; |
|
|
|
|
|
|
|
@ -30,10 +32,7 @@ class OrderListService implements OrderListServiceInterface |
|
|
|
{ |
|
|
|
$builder = OrderMain::query() |
|
|
|
->with(['orderGoods', 'market']) |
|
|
|
->where([ |
|
|
|
['user_id','=',$userId], |
|
|
|
['type','=',1] |
|
|
|
]); |
|
|
|
->where(['user_id' => $userId, 'type' => OrderType::ONLINE]); |
|
|
|
switch ($tab) { |
|
|
|
case 'all': |
|
|
|
break; |
|
|
|
@ -143,4 +142,17 @@ class OrderListService implements OrderListServiceInterface |
|
|
|
$orders = $paginate->toArray(); |
|
|
|
return ['has_more_pages' => $paginate->hasMorePages(), 'orders' => $orders['data']]; |
|
|
|
} |
|
|
|
|
|
|
|
public function offlineByUser($userId, $page=1, $pagesize=10) |
|
|
|
{ |
|
|
|
$builder = OrderMain::query() |
|
|
|
->with(['orders' => function($query) { |
|
|
|
$query->with('store'); |
|
|
|
}]) |
|
|
|
->where(['user_id' => $userId, 'type' => OrderType::OFFLINE]); |
|
|
|
|
|
|
|
$paginate = $builder->paginate($pagesize); |
|
|
|
$orders = $paginate->toArray(); |
|
|
|
return ['has_more_pages' => $paginate->hasMorePages(), 'orders' => $orders['data']]; |
|
|
|
} |
|
|
|
} |