|
@@ -124,8 +124,8 @@ class ProductLogic extends BaseLogic |
|
@@ -124,8 +124,8 @@ class ProductLogic extends BaseLogic |
|
124
|
* @time :2023/8/21 17:11
|
124
|
* @time :2023/8/21 17:11
|
|
125
|
*/
|
125
|
*/
|
|
126
|
public function productDelete(){
|
126
|
public function productDelete(){
|
|
127
|
-// DB::beginTransaction();
|
|
|
|
128
|
-// try {
|
127
|
+ DB::beginTransaction();
|
|
|
|
128
|
+ try {
|
|
129
|
foreach ($this->param['ids'] as $k => $id) {
|
129
|
foreach ($this->param['ids'] as $k => $id) {
|
|
130
|
$info = $this->model->read(['id'=>$id]);
|
130
|
$info = $this->model->read(['id'=>$id]);
|
|
131
|
if($info['status'] == Product::STATUS_RECYCLE){
|
131
|
if($info['status'] == Product::STATUS_RECYCLE){
|
|
@@ -138,12 +138,11 @@ class ProductLogic extends BaseLogic |
|
@@ -138,12 +138,11 @@ class ProductLogic extends BaseLogic |
|
138
|
$this->model->edit(['status'=>Product::STATUS_RECYCLE],['id'=>$id]);
|
138
|
$this->model->edit(['status'=>Product::STATUS_RECYCLE],['id'=>$id]);
|
|
139
|
}
|
139
|
}
|
|
140
|
}
|
140
|
}
|
|
141
|
-// DB::commit();
|
|
|
|
142
|
-// }catch (\Exception $e){
|
|
|
|
143
|
-// DB::rollBack();
|
|
|
|
144
|
-// $this->fail('删除失败');
|
|
|
|
145
|
-// }
|
|
|
|
146
|
-
|
141
|
+ DB::commit();
|
|
|
|
142
|
+ }catch (\Exception $e){
|
|
|
|
143
|
+ DB::rollBack();
|
|
|
|
144
|
+ $this->fail('删除失败');
|
|
|
|
145
|
+ }
|
|
147
|
return $this->success();
|
146
|
return $this->success();
|
|
148
|
}
|
147
|
}
|
|
149
|
|
148
|
|