$orderId])->find(); if (empty($order)) { throw new ApiException('无此订单'); } if ($order['status'] != 2) { throw new ApiException('订单必须是支付状态'); } $rs = $allocateModel::where(['order_id' => $orderId])->find(); if (empty($rs)) { throw new ApiException('该服务还没分配职员'); } else { if ($rs['status'] == 3) { throw new ApiException('该服务已完成'); } if ($rs['status'] == 2) { throw new ApiException('该服务正在进行'); } } $orderRoomRs = $roomOrder::where(['order_id' =>$orderId])->find(); if ($orderRoomRs === null) { throw new ApiException('请分配房间'); } if (!empty($this->adminId)) { $opId = $this->adminId; $opType = 'admin'; } else { $opId = Until::$userId; $opType = 'xcx'; } (new RoomModel())::where(['id' => $orderRoomRs['room_id']])->update(['room_server_status' => 2]); $allocateModel::where(['id' => $rs['id']])->update(['status' => 2, 'start_id' => $opId, 'op_type' => $opType, 'server_start_time' => date('Y-m-d H:i:s')]); (new StaffModel())::where(['id' => $rs['staff_id']])->update(['server_status' => 3]); } public static function getStaffByCode(string $braceletCode) { $staffModel = new Staffmodel(); $staffInfo = $staffModel::where(['bracelet_code' => $braceletCode,'status' => Staffmodel::NORMAL])->find(); $staffInfo = Until::modelToArray($staffInfo); if (empty($staffInfo)) { throw new apiexception('无此职员'); } return $staffInfo; } public static function getRoomByCode(string $roomCode) { $model = new RoomModel(); $roomInfo = $model::where(['clock_code' => $roomCode,'status' => StaffModel::NORMAL])->find(); $roomInfo = Until::modelToArray($roomInfo); if (empty($roomInfo) || empty($roomInfo['store_id'])) { throw new ApiException('无此门店'); } return $roomInfo; } }