From 2ae18e951c4716a8bd06caaf5ab92e80fb62251c Mon Sep 17 00:00:00 2001 From: mkm <727897186@qq.com> Date: Sat, 29 Jun 2024 16:49:16 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=A2=9E=E5=8A=A0=E6=94=AF=E4=BB=98?= =?UTF-8?q?=E9=80=9A=E7=9F=A5=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../UserProductStorageController.php | 46 +++++++++++++++++++ .../UserProductStorageLogic.php | 10 +++- 2 files changed, 55 insertions(+), 1 deletion(-) create mode 100644 app/api/controller/user_product_storage/UserProductStorageController.php diff --git a/app/api/controller/user_product_storage/UserProductStorageController.php b/app/api/controller/user_product_storage/UserProductStorageController.php new file mode 100644 index 000000000..806a56204 --- /dev/null +++ b/app/api/controller/user_product_storage/UserProductStorageController.php @@ -0,0 +1,46 @@ +dataLists(new UserProductStorageLists()); + } + + /** + * 预约 + */ + public function reservation(){ + + $params=$this->request->post(); + $info=$params['info']; + $uid=$this->userId; + $store_id=$params['store_id']; + $times=$params['times']; + UserProductStorageLogic::supply($info,$uid,$store_id,0,$times); + if(UserProductStorageLogic::hasError()){ + return $this->fail(UserProductStorageLogic::getError()); + } + return $this->success('操作成功'); + } +} \ No newline at end of file diff --git a/app/common/logic/user_product_storage/UserProductStorageLogic.php b/app/common/logic/user_product_storage/UserProductStorageLogic.php index ed775d912..27d4c9cff 100644 --- a/app/common/logic/user_product_storage/UserProductStorageLogic.php +++ b/app/common/logic/user_product_storage/UserProductStorageLogic.php @@ -39,10 +39,13 @@ class UserProductStorageLogic extends BaseLogic /** * 出库 */ - public static function supply($data,$uid,$store_id){ + public static function supply($data,$uid,$store_id,$status=1,$times=''){ Db::startTrans(); try { $data_log=[]; + if($times!=''){ + $times=strtotime($times); + } foreach ($data as $k=>$v){ $find=UserProductStorage::where('uid',$uid)->where('product_id',$v['product_id'])->find(); if($find){ @@ -62,6 +65,11 @@ class UserProductStorageLogic extends BaseLogic $data_log[$k]['store_id']=$store_id; $data_log[$k]['financial_pm']=0; $data_log[$k]['nums']=$v['nums']; + $data_log[$k]['times']=$times; + $data_log[$k]['status']=$status; + }else{ + self::setError('没有查询到该商品'); + return false; } } (new UserProductStorageLog())->saveAll($data_log);