正在显示
2 个修改的文件
包含
13 行增加
和
11 行删除
| @@ -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'], |
| @@ -31,9 +31,10 @@ class CategoryRequest extends FormRequest | @@ -31,9 +31,10 @@ class CategoryRequest extends FormRequest | ||
| 31 | { | 31 | { |
| 32 | return [ | 32 | return [ |
| 33 | 'title'=>'required|max:50', | 33 | 'title'=>'required|max:50', |
| 34 | + 'route'=>'required', | ||
| 34 | // 'image'=>'required', | 35 | // 'image'=>'required', |
| 35 | - 'keywords'=>'max:50', | ||
| 36 | - 'describe'=>'max:200', | 36 | +// 'keywords'=>'max:50', |
| 37 | +// 'describe'=>'max:200', | ||
| 37 | ]; | 38 | ]; |
| 38 | } | 39 | } |
| 39 | 40 | ||
| @@ -42,9 +43,10 @@ class CategoryRequest extends FormRequest | @@ -42,9 +43,10 @@ class CategoryRequest extends FormRequest | ||
| 42 | return [ | 43 | return [ |
| 43 | 'title.required' => '请输入分类名称', | 44 | 'title.required' => '请输入分类名称', |
| 44 | 'title.max' => '分类名称不能超过50个字符', | 45 | 'title.max' => '分类名称不能超过50个字符', |
| 46 | + 'route.required' => '路由不能为空', | ||
| 45 | // 'image.required' => '请上传分类图片', | 47 | // 'image.required' => '请上传分类图片', |
| 46 | - 'keywords.max' => '分类关键词不能超过50个字符', | ||
| 47 | - 'describe.max' => '分类描述不能超过200个字符', | 48 | +// 'keywords.max' => '分类关键词不能超过50个字符', |
| 49 | +// 'describe.max' => '分类描述不能超过200个字符', | ||
| 48 | ]; | 50 | ]; |
| 49 | } | 51 | } |
| 50 | 52 |
-
请 注册 或 登录 后发表评论