作者 lyh

gx

@@ -64,8 +64,8 @@ class CategoryLogic extends BaseLogic @@ -64,8 +64,8 @@ class CategoryLogic extends BaseLogic
64 * @time :2023/8/21 17:14 64 * @time :2023/8/21 17:14
65 */ 65 */
66 public function categorySave(){ 66 public function categorySave(){
67 - DB::beginTransaction();  
68 - try { 67 +// DB::beginTransaction();
  68 +// try {
69 if(isset($this->param['id']) && !empty($this->param['id'])){ 69 if(isset($this->param['id']) && !empty($this->param['id'])){
70 $this->handleEditParam($this->param); 70 $this->handleEditParam($this->param);
71 //是否编辑路由 71 //是否编辑路由
@@ -80,11 +80,11 @@ class CategoryLogic extends BaseLogic @@ -80,11 +80,11 @@ class CategoryLogic extends BaseLogic
80 $this->edit(['route'=>$route],['id'=>$id]); 80 $this->edit(['route'=>$route],['id'=>$id]);
81 //清除缓存 81 //清除缓存
82 Common::del_user_cache('product_category',$this->user['project_id']); 82 Common::del_user_cache('product_category',$this->user['project_id']);
83 - DB::commit();  
84 - } catch (\Exception $e){  
85 - DB::rollBack();  
86 - $this->fail('保存失败');  
87 - } 83 +// DB::commit();
  84 +// } catch (\Exception $e){
  85 +// DB::rollBack();
  86 +// $this->fail('保存失败');
  87 +// }
88 //通知更新 88 //通知更新
89 $notifyData = [ 89 $notifyData = [
90 'project_id'=>$this->user['project_id'], 90 'project_id'=>$this->user['project_id'],
@@ -149,8 +149,8 @@ class CategoryLogic extends BaseLogic @@ -149,8 +149,8 @@ class CategoryLogic extends BaseLogic
149 */ 149 */
150 public function categoryDelete(){ 150 public function categoryDelete(){
151 $ids = $this->param['ids']; 151 $ids = $this->param['ids'];
152 -// DB::beginTransaction();  
153 -// try { 152 + DB::beginTransaction();
  153 + try {
154 $productModel = new Product(); 154 $productModel = new Product();
155 foreach ($ids as $id){ 155 foreach ($ids as $id){
156 $product_info = $productModel->read(['category_id'=>['like','%,'.$id.',%']]); 156 $product_info = $productModel->read(['category_id'=>['like','%,'.$id.',%']]);
@@ -163,11 +163,11 @@ class CategoryLogic extends BaseLogic @@ -163,11 +163,11 @@ class CategoryLogic extends BaseLogic
163 } 163 }
164 //清除缓存 164 //清除缓存
165 Common::del_user_cache('product_category',$this->user['project_id']); 165 Common::del_user_cache('product_category',$this->user['project_id']);
166 -// DB::commit();  
167 -// }catch (\Exception $e){  
168 -// DB::rollBack();  
169 -// $this->fail('删除失败');  
170 -// } 166 + DB::commit();
  167 + }catch (\Exception $e){
  168 + DB::rollBack();
  169 + $this->fail('删除失败');
  170 + }
171 return $this->success(); 171 return $this->success();
172 } 172 }
173 173