|
@@ -132,19 +132,14 @@ class Order extends BaseController {
|
|
|
$statusFilter = [1 => '未支付', 2 => '已支付', 3 => '已关闭', 4 => '已删除'];
|
|
|
|
|
|
foreach ($data['list'] as &$one) {
|
|
|
-
|
|
|
-
|
|
|
- if ($one['status'] == 2) {
|
|
|
- if ($one['allocateStatus'] == 1) {
|
|
|
- $one['allocateOrderStatus'] = 2; //分配职员完成 可开始服务
|
|
|
- } elseif ($one['allocateStatus'] == 2) {
|
|
|
- $one['allocateOrderStatus'] = 3; //服务中 可结束服务
|
|
|
- } elseif ($one['allocateStatus'] == 3) {
|
|
|
- $one['allocateOrderStatus'] = 3; //服务结束
|
|
|
- } else {
|
|
|
- $one['allocateOrderStatus'] = 1; //还没分配职员 可分配职员 不可开始服务
|
|
|
- }
|
|
|
-
|
|
|
+ if ($one['allocateStatus'] == 1) {
|
|
|
+ $one['allocateOrderStatus'] = 2; //分配职员完成 可开始服务
|
|
|
+ } elseif ($one['allocateStatus'] == 2) {
|
|
|
+ $one['allocateOrderStatus'] = 3; //服务中 可结束服务
|
|
|
+ } elseif ($one['allocateStatus'] == 3) {
|
|
|
+ $one['allocateOrderStatus'] = 3; //服务结束
|
|
|
+ } else {
|
|
|
+ $one['allocateOrderStatus'] = 1; //还没分配职员 可分配职员 不可开始服务
|
|
|
}
|
|
|
|
|
|
$one['productList'] = $product[$one['id']] ?? [];
|
|
@@ -387,7 +382,7 @@ class Order extends BaseController {
|
|
|
* mediaType="multipart/form-data",
|
|
|
* @OA\Schema(
|
|
|
* @OA\Property(description="订单id", property="orderId", type="integer", default="1"),
|
|
|
- * required={"orderId","staffId"})
|
|
|
+ * required={"orderId"})
|
|
|
* )
|
|
|
* ),
|
|
|
* @OA\Response(response="200", description="请求成功")
|
|
@@ -400,7 +395,15 @@ class Order extends BaseController {
|
|
|
];
|
|
|
Until::check($rule, $input);
|
|
|
$allocateModel = new AllocateModel();
|
|
|
- $rs = $allocateModel::where(['order_id' => (int)$input['orderId'], 'staff_id' => $input['staffId'],'status' => 2])->find();
|
|
|
+ $model = new OrderModel();
|
|
|
+ $order = $model::where(['id' => $input['orderId']])->find();
|
|
|
+ if (empty($order)) {
|
|
|
+ throw new ApiException('无此订单');
|
|
|
+ }
|
|
|
+ if ($order['status'] != 2) {
|
|
|
+ throw new ApiException('订单必须是支付状态');
|
|
|
+ }
|
|
|
+ $rs = $allocateModel::where(['order_id' => (int)$input['orderId']])->find();
|
|
|
if (empty($rs)) {
|
|
|
throw new ApiException('该服务还没分配职员');
|
|
|
} else {
|
|
@@ -425,7 +428,7 @@ class Order extends BaseController {
|
|
|
* mediaType="multipart/form-data",
|
|
|
* @OA\Schema(
|
|
|
* @OA\Property(description="订单id", property="orderId", type="integer", default="1"),
|
|
|
- * required={"orderId","staffId"})
|
|
|
+ * required={"orderId"})
|
|
|
* )
|
|
|
* ),
|
|
|
* @OA\Response(response="200", description="请求成功")
|
|
@@ -439,7 +442,7 @@ class Order extends BaseController {
|
|
|
Until::check($rule, $input);
|
|
|
$model = new OrderModel();
|
|
|
$allocateModel = new AllocateModel();
|
|
|
- $rs = $allocateModel::where(['order_id' => (int)$input['orderId'], 'staff_id' => $input['staffId'],'status' => 2])->find();
|
|
|
+ $rs = $allocateModel::where(['order_id' => (int)$input['orderId']])->find();
|
|
|
if (empty($rs)) {
|
|
|
throw new ApiException('该服务还没分配职员');
|
|
|
} else {
|