From bd11fa040a68b0782223bc236be687c21b9d7d37 Mon Sep 17 00:00:00 2001 From: yangsai Date: Sat, 2 Nov 2024 18:48:03 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8F=91=E7=8E=B0=E5=86=B2=E7=AA=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controller/cashier/Table.php | 3 ++- app/controller/cashier/User.php | 25 +++++++++++++++++++------ 2 files changed, 21 insertions(+), 7 deletions(-) diff --git a/app/controller/cashier/Table.php b/app/controller/cashier/Table.php index 106926e6f..8598daaab 100644 --- a/app/controller/cashier/Table.php +++ b/app/controller/cashier/Table.php @@ -51,6 +51,7 @@ class Table extends AuthController if(!empty($yuyue)){ $v2['yingxiaojingli'] = db::name('user')->where('uid', $yuyue['admin_id'])->value('nickname') ?? '无'; $v2['yuyueshijian'] = $yuyue['yuding_date'] . ' ' . $yuyue['come_date']; + $v2['phone'] = $yuyue['phone']; } } @@ -257,7 +258,7 @@ class Table extends AuthController $partakeService->del(['collate_code_id' => $tableId]); /** @var TableQrcodeServices $qrcodeService */ $qrcodeService = app()->make(TableQrcodeServices::class); - $qrcodeService->update($qrcodeId, ['is_use' => 0, 'eat_number' => 0, 'order_time' => 0]); + $qrcodeService->update($qrcodeId, ['is_use' => 0, 'eat_number' => 0, 'order_time' => 0,'kaibao'=>0]); if ($oid) { /** @var StoreOrderServices $orderService */ $orderService = app()->make(StoreOrderServices::class); diff --git a/app/controller/cashier/User.php b/app/controller/cashier/User.php index 2fd649a40..4265b78b9 100644 --- a/app/controller/cashier/User.php +++ b/app/controller/cashier/User.php @@ -295,7 +295,7 @@ class User extends AuthController } //台桌预定 - public function tableYuDing($wtable_id, $wremark, $wphone, $wyuding_date,$come_date,$store_id) + public function tableYuDing($wtable_id, $wremark, $wphone, $wyuding_date,$come_date,$store_id,$admin_id) { $post['table_id'] = $wtable_id; @@ -304,6 +304,7 @@ class User extends AuthController $post['come_date'] = $come_date; $post['remark'] = $wremark; $post['store_id'] = $store_id; + $post['admin_id'] = $admin_id; $post['create'] = time(); //校验这个桌子有无在使用 @@ -336,10 +337,11 @@ class User extends AuthController */ public function swithUser(Request $request) { - //wmc api + //wmc api1 //预定 $wtable_id = $request->post('wtable_id', 0); - if (!empty($wtable_id)) { + $kaibao = $request->post('kaibao', 0); + if (!empty($wtable_id&&empty($kaibao))) { $ttttt = Db::name('table_qrcode')->where('id',$wtable_id)->where('is_use',0)->find(); if(!$ttttt){ @@ -351,18 +353,29 @@ class User extends AuthController $wyuding_date = $request->post('wyuding_date', 0); $come_date = $request->post('come_date', 0); $store_id = $request->post('store_id', 1); + $admin_id = $request->post('admin_id', 0); - - if (empty($wremark) || empty($wphone) || empty($wyuding_date) || empty($come_date)) { + if (empty($wyuding_date) || empty($come_date)) { return $this->fail('请填写完整参数'); } else { - $res = $this->tableYuDing($wtable_id, $wremark, $wphone, $wyuding_date,$come_date,$store_id); + $res = $this->tableYuDing($wtable_id, $wremark, $wphone, $wyuding_date,$come_date,$store_id,$admin_id); if ($res) { return $this->success('预定成功'); } } return $this->fail('预定失败'); + }else if($kaibao){ + if($kaibao==1){ + if(Db::name('table_qrcode')->update(['id' => $wtable_id, 'kaibao' => 1,'is_use'=>2])){ + return $this->success('开台成功'); + } + }else if($kaibao==2){ + if(Db::name('table_qrcode')->update(['id' => $wtable_id, 'kaibao' => 0,'is_use'=>0])){ + return $this->success('清台成功'); + } + } + return $this->fail('操作失败'); }