作者 lyh

gx

... ... @@ -64,8 +64,8 @@ class CategoryLogic extends BaseLogic
* @time :2023/8/21 17:14
*/
public function categorySave(){
DB::beginTransaction();
try {
// DB::beginTransaction();
// try {
if(isset($this->param['id']) && !empty($this->param['id'])){
$this->handleEditParam($this->param);
//是否编辑路由
... ... @@ -80,11 +80,11 @@ class CategoryLogic extends BaseLogic
$this->edit(['route'=>$route],['id'=>$id]);
//清除缓存
Common::del_user_cache('product_category',$this->user['project_id']);
DB::commit();
} catch (\Exception $e){
DB::rollBack();
$this->fail('保存失败');
}
// DB::commit();
// } catch (\Exception $e){
// DB::rollBack();
// $this->fail('保存失败');
// }
//通知更新
$notifyData = [
'project_id'=>$this->user['project_id'],
... ... @@ -149,8 +149,8 @@ class CategoryLogic extends BaseLogic
*/
public function categoryDelete(){
$ids = $this->param['ids'];
// DB::beginTransaction();
// try {
DB::beginTransaction();
try {
$productModel = new Product();
foreach ($ids as $id){
$product_info = $productModel->read(['category_id'=>['like','%,'.$id.',%']]);
... ... @@ -163,11 +163,11 @@ class CategoryLogic extends BaseLogic
}
//清除缓存
Common::del_user_cache('product_category',$this->user['project_id']);
// DB::commit();
// }catch (\Exception $e){
// DB::rollBack();
// $this->fail('删除失败');
// }
DB::commit();
}catch (\Exception $e){
DB::rollBack();
$this->fail('删除失败');
}
return $this->success();
}
... ...