feat : order list
This commit is contained in:
@@ -24,7 +24,16 @@ use Psr\Container\NotFoundExceptionInterface;
|
||||
|
||||
class OrderListService extends BaseService
|
||||
{
|
||||
|
||||
use OssTrait;
|
||||
|
||||
/**
|
||||
* @var int 当前订单/历史订单
|
||||
*/
|
||||
CONST CURRENT_ORDER = 1;
|
||||
|
||||
CONST HISTORY_ORDER = 2;
|
||||
|
||||
/**
|
||||
* @var Order
|
||||
*/
|
||||
@@ -58,11 +67,19 @@ class OrderListService extends BaseService
|
||||
{
|
||||
$limit = (int)$this->request->input('limit', 20);
|
||||
|
||||
$type = (int)$this->request->input('type',self::CURRENT_ORDER);
|
||||
|
||||
$status = match ($type){
|
||||
self::CURRENT_ORDER => [OrderCode::WAIT_PAY,OrderCode::PAYED,OrderCode::PLAN,OrderCode::DEPART],
|
||||
self::HISTORY_ORDER => [OrderCode::FINISH,OrderCode::CANCEL,OrderCode::FINISH_REFUND,OrderCode::UNCOMPLETED_REFUND]
|
||||
};
|
||||
|
||||
$orderList = $this->orderModel
|
||||
->where('user_id', $this->userId)
|
||||
->when($this->request->input('status'), function ($query) {
|
||||
$query->where('status', $this->request->input('status'));
|
||||
})
|
||||
->whereIn('status', $status)
|
||||
// ->when($this->request->input('status'), function ($query) {
|
||||
// $query->where('status', $this->request->input('status'));
|
||||
// })
|
||||
->select([
|
||||
'id',
|
||||
'order_sno',
|
||||
|
||||
Reference in New Issue
Block a user