|
|
|
|
@ -123,7 +123,7 @@ class OrdersController extends CommonController
|
|
|
|
|
* @OA\Parameter(name="keyword", in="query", @OA\Schema(type="string"), required=false, description="查询关键词"),
|
|
|
|
|
* @OA\Parameter(name="page", in="query", @OA\Schema(type="integer"), required=false, description="当前页码,默认为1"),
|
|
|
|
|
* @OA\Parameter(name="page_size", in="query", @OA\Schema(type="integer"), required=false, description="每页数量,默认为5"),
|
|
|
|
|
* @OA\Parameter(name="status", in="query", @OA\Schema(type="string"), required=false, description="订单状态:[unconfirmed=>待确认,unassigned=>待派单,ongoing=>进行中,finished=>已完成]"),
|
|
|
|
|
* @OA\Parameter(name="status", in="query", @OA\Schema(type="string"), required=false, description="订单状态:[pending=>待处理,ongoing=>进行中,finished=>已完成]"),
|
|
|
|
|
* @OA\Response(
|
|
|
|
|
* response="200",
|
|
|
|
|
* description="获取订单列表"
|
|
|
|
|
@ -148,21 +148,15 @@ class OrdersController extends CommonController
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
switch (request()->status) {
|
|
|
|
|
case "unconfirmed":
|
|
|
|
|
$model = $model
|
|
|
|
|
->where("status", Orders::STATUS_UNCONFIRMED)
|
|
|
|
|
->ofProject($this->manager->projects->pluck("id")->toArray());
|
|
|
|
|
case "pending":
|
|
|
|
|
$model = $model->whereIn("status", [Orders::STATUS_UNCONFIRMED, Orders::STATUS_UNASSIGNED]);
|
|
|
|
|
break;
|
|
|
|
|
case "unassigned":
|
|
|
|
|
case "ongoing":
|
|
|
|
|
case "finished":
|
|
|
|
|
$model = $model
|
|
|
|
|
->where("status", constant(Orders::class . "::STATUS_" . strtoupper(request()->status)))
|
|
|
|
|
->ofProject($this->manager->projects->pluck("id")->toArray());
|
|
|
|
|
$model = $model->where("status", constant(Orders::class . "::STATUS_" . strtoupper(request()->status)));
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
$model = $model
|
|
|
|
|
->ofProject($this->manager->projects->pluck("id")->toArray());
|
|
|
|
|
//do nothing
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$page_size = request()->page_size ?? 5;
|
|
|
|
|
@ -192,7 +186,7 @@ class OrdersController extends CommonController
|
|
|
|
|
{
|
|
|
|
|
$model = $this->_getOrderModel();
|
|
|
|
|
$order = $model->with([
|
|
|
|
|
"orderItems" => function($query) {
|
|
|
|
|
"orderItems" => function ($query) {
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
])->find($id);
|
|
|
|
|
|