作者 lyh

gx

@@ -55,13 +55,6 @@ class NewsCategoryLogic extends BaseLogic @@ -55,13 +55,6 @@ class NewsCategoryLogic extends BaseLogic
55 * @method 55 * @method
56 */ 56 */
57 public function add_news_category(){ 57 public function add_news_category(){
58 - $condition = [  
59 - 'name'=>$this->param['name']  
60 - ];  
61 - $info = $this->model->read($condition);  
62 - if($info !== false){  
63 - $this->fail('当前分类名称已存在');  
64 - }  
65 //参数处理 58 //参数处理
66 $this->param = $this->addParamProcessing($this->param); 59 $this->param = $this->addParamProcessing($this->param);
67 DB::beginTransaction(); 60 DB::beginTransaction();
@@ -186,8 +179,28 @@ class NewsCategoryLogic extends BaseLogic @@ -186,8 +179,28 @@ class NewsCategoryLogic extends BaseLogic
186 return $this->success($list); 179 return $this->success($list);
187 } 180 }
188 181
189 - public function verifyParam(){  
190 - 182 + /**
  183 + * @name :(验证名称是否存在)verifyParamName
  184 + * @author :lyh
  185 + * @method :post
  186 + * @time :2023/6/13 11:41
  187 + */
  188 + public function verifyParamName(){
  189 + if(isset($this->param['id'])){
  190 + $condition = [
  191 + 'id'=>['!=',$this->param['id']],
  192 + 'name'=>$this->param['name'],
  193 + ];
  194 + }else{
  195 + $condition = [
  196 + 'name'=>$this->param['name']
  197 + ];
  198 + }
  199 + $info = $this->model->read($condition);
  200 + if($info !== false){
  201 + $this->fail('当前分类名称已存在');
  202 + }
  203 + return $this->success();
191 } 204 }
192 205
193 /** 206 /**
@@ -26,7 +26,7 @@ class BlogCategoryRequest extends FormRequest @@ -26,7 +26,7 @@ class BlogCategoryRequest extends FormRequest
26 return [ 26 return [
27 'name'=>'required|max:100', 27 'name'=>'required|max:100',
28 'remark'=>'required|max:255', 28 'remark'=>'required|max:255',
29 - 'alias'=>'required|max:10', 29 + 'alias'=>'required|max:255',
30 ]; 30 ];
31 } 31 }
32 32
@@ -38,7 +38,7 @@ class BlogCategoryRequest extends FormRequest @@ -38,7 +38,7 @@ class BlogCategoryRequest extends FormRequest
38 'remark.required'=>'请填写简介', 38 'remark.required'=>'请填写简介',
39 'remark.max'=>'简介最大255字', 39 'remark.max'=>'简介最大255字',
40 'alias.required'=>'请填写别名', 40 'alias.required'=>'请填写别名',
41 - 'alias.max'=>'别名最大10字', 41 + 'alias.max'=>'别名最大255字',
42 ]; 42 ];
43 } 43 }
44 } 44 }
@@ -26,7 +26,7 @@ class NewsCategoryRequest extends FormRequest @@ -26,7 +26,7 @@ class NewsCategoryRequest extends FormRequest
26 return [ 26 return [
27 'name'=>'required|max:100', 27 'name'=>'required|max:100',
28 'remark'=>'required|max:255', 28 'remark'=>'required|max:255',
29 - 'alias'=>'required|max:10', 29 + 'alias'=>'required|max:255',
30 ]; 30 ];
31 } 31 }
32 32
@@ -38,7 +38,7 @@ class NewsCategoryRequest extends FormRequest @@ -38,7 +38,7 @@ class NewsCategoryRequest extends FormRequest
38 'remark.required'=>'请填写简介', 38 'remark.required'=>'请填写简介',
39 'remark.max'=>'简介最大255字', 39 'remark.max'=>'简介最大255字',
40 'alias.required'=>'请填写一下别名', 40 'alias.required'=>'请填写一下别名',
41 - 'alias.max'=>'别名最大10字', 41 + 'alias.max'=>'别名最大255字',
42 ]; 42 ];
43 } 43 }
44 } 44 }