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);