|
@@ -209,7 +209,7 @@ class Room extends BaseController {
|
|
|
* @OA\Schema(
|
|
|
* @OA\Property(description="门店id", property="storeId", type="integer", default="1"),
|
|
|
* @OA\Property(description="日期(默认今天)", property="date", type="string", default="2021-04-29"),
|
|
|
- * @OA\Property(description="状态 1已开始 2已完成 3已开始和已完成", property="status", type="integer", default="1"),
|
|
|
+ * @OA\Property(description="状态 1未开始 2服务中 3已完成(多个逗号分隔)", property="status", type="integer", default="1"),
|
|
|
* required={"storeId","status"})
|
|
|
* )
|
|
|
* ),
|
|
@@ -220,20 +220,16 @@ class Room extends BaseController {
|
|
|
$input = Until::getInput();
|
|
|
$rule = [
|
|
|
'storeId|门店id' => 'require',
|
|
|
- // 'date|日期' => 'require',
|
|
|
+ //'date|日期' => 'require',
|
|
|
'status|状态' => 'require',
|
|
|
];
|
|
|
Until::check($rule, $input);
|
|
|
$where = [];
|
|
|
- if ($input['status'] == 3) {
|
|
|
- $where[] = ['as.status', 'in', [2, 3]];
|
|
|
- }
|
|
|
- if ($input['status'] == 2) {
|
|
|
- $where[] = ['as.status', '=', 2];
|
|
|
- }
|
|
|
- if ($input['status'] == 1) {
|
|
|
- $where[] = ['as.status', '=', 1];
|
|
|
+ if (!empty($input['status'])) {
|
|
|
+ $statusArr = explode(',', $input['status']);
|
|
|
+ $where[] = ['as.status', 'in', $statusArr];
|
|
|
}
|
|
|
+
|
|
|
if (empty($input['date'])) {
|
|
|
$input['date'] = date('Y-m-d');
|
|
|
}
|
|
@@ -246,26 +242,79 @@ class Room extends BaseController {
|
|
|
}
|
|
|
$list = [];
|
|
|
foreach ($rs as $v) {
|
|
|
- $productInfo = json_decode($v['product_snap'],true);
|
|
|
+ if ($v['asStatus'] == 2){
|
|
|
+ $allocateOrderStatus = 3; //服务中
|
|
|
+ }elseif ($v['asStatus'] == 3) {
|
|
|
+ $allocateOrderStatus = 4; // 服务结束
|
|
|
+ }else {
|
|
|
+ $allocateOrderStatus = 2; //未开始
|
|
|
+ }
|
|
|
+ $productInfo = json_decode($v['product_snap'], true);
|
|
|
if (empty($v['server_end_time'])) {
|
|
|
$endTime = strtotime($v['server_start_time']) + $productInfo['time'];
|
|
|
$time = $productInfo['time'];
|
|
|
} else {
|
|
|
$endTime = strtotime($v['server_end_time']);
|
|
|
- $time = (int)(($endTime - strtotime($v['server_start_time']))/60);
|
|
|
+ $time = (int)(($endTime - strtotime($v['server_start_time'])) / 60);
|
|
|
}
|
|
|
$list[$v['room_id']][] = [
|
|
|
'productName' => $productInfo['product_name'],
|
|
|
'start' => (int)((strtotime($v['server_start_time']) - strtotime($input['date'] . ' 08:00:00')) / 60),
|
|
|
'time' => $time,
|
|
|
- 'allocateOrderStatus' => $v['asStatus'] == 2 ? 3 : 4,
|
|
|
+ 'allocateOrderStatus' => $allocateOrderStatus,
|
|
|
'startTime' => date('H:i', strtotime($v['server_start_time'])),
|
|
|
'endTime' => date('H:i', $endTime),
|
|
|
- 'staffName' => $v['staff_name']
|
|
|
+ 'staffName' => $v['staff_name'],
|
|
|
+ 'orderId' => $v['order_id'],
|
|
|
+ 'name' => $v['name'],
|
|
|
+ 'realName' => $v['real_name'],
|
|
|
+ 'orderType' => $v['order_type'],
|
|
|
];
|
|
|
}
|
|
|
Until::output($list);
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * @OA\Post(path="/api/room/freeRoom",
|
|
|
+ * tags={"房间管理"},
|
|
|
+ * summary="还未分配房间",
|
|
|
+ * @OA\Parameter(name="token", in="header", description="token", @OA\Schema(type="string")),
|
|
|
+ * @OA\RequestBody(
|
|
|
+ * @OA\MediaType(
|
|
|
+ * mediaType="multipart/form-data",
|
|
|
+ * @OA\Schema(
|
|
|
+ * @OA\Property(description="门店id", property="storeId", type="integer", default="1"),
|
|
|
+ * @OA\Property(description="日期(默认今天)", property="date", type="string", default="2021-04-29"),
|
|
|
+ * required={"storeId"})
|
|
|
+ * )
|
|
|
+ * ),
|
|
|
+ * @OA\Response(response="200", description="请求成功")
|
|
|
+ * )
|
|
|
+ */
|
|
|
+ public function freeRoom() {
|
|
|
+ $input = Until::getInput();
|
|
|
+ $rule = [
|
|
|
+ 'storeId|门店id' => 'require',
|
|
|
+ //'date|日期' => 'require',
|
|
|
+ ];
|
|
|
+ Until::check($rule, $input);
|
|
|
+ $where = [];
|
|
|
+ if (empty($input['date'])) {
|
|
|
+ $input['date'] = date('Y-m-d');
|
|
|
+ }
|
|
|
+ $where[] = ['o.status', '=', 2];
|
|
|
+ $where[] = ['or.id', '=', null];
|
|
|
+ $where[] = ['o.appointment_time', 'between', [$input['date'], date('Y-m-d', strtotime('+1 day', strtotime($input['date'])))]];
|
|
|
+ $model = new OrderRoomModel();
|
|
|
+ $model->setWhere($where);
|
|
|
+ $rs = $model->getfreeRoomList();
|
|
|
+ if (empty($rs)) {
|
|
|
+ Until::output([]);
|
|
|
+ }
|
|
|
+ $list = $rs;
|
|
|
+ $count = count($rs);
|
|
|
+ Until::output(['count' => $count, 'list' => $list]);
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
}
|