作者 lyh

gx白帽seo前后缀

@@ -43,7 +43,10 @@ class ProjectWhiteHatAffixController extends BaseController @@ -43,7 +43,10 @@ class ProjectWhiteHatAffixController extends BaseController
43 ],[ 43 ],[
44 'project_id.required' => '项目id不能为空', 44 'project_id.required' => '项目id不能为空',
45 ]); 45 ]);
46 - $data = $this->model->read($this->map); 46 + if(isset($this->map['project_id']) && !empty($this->map['project_id'])){
  47 + $this->map['project_id'] = ['in',[0,$this->map['project_id']]];
  48 + }
  49 + $data = $this->model->list($this->map);
47 $this->response('success',Code::SUCCESS,$data); 50 $this->response('success',Code::SUCCESS,$data);
48 } 51 }
49 52
@@ -60,12 +63,12 @@ class ProjectWhiteHatAffixController extends BaseController @@ -60,12 +63,12 @@ class ProjectWhiteHatAffixController extends BaseController
60 public function save(){ 63 public function save(){
61 $this->request->validate([ 64 $this->request->validate([
62 'project_id'=>'required', 65 'project_id'=>'required',
63 - 'prefix'=>'required',  
64 - 'suffix'=>'required', 66 + 'name'=>'required',
  67 + 'type'=>'required',
65 ],[ 68 ],[
66 'project_id.required' => '项目id不能为空', 69 'project_id.required' => '项目id不能为空',
67 - 'prefix.required' => '前缀不能为空,一行一个',  
68 - 'suffix.required' => '项目id不能为空,一行一个', 70 + 'name.required' => '前缀不能为空,一行一个',
  71 + 'type.required' => '项目id不能为空,一行一个',
69 ]); 72 ]);
70 if(isset($this->param['id']) && !empty($this->param['id'])){ 73 if(isset($this->param['id']) && !empty($this->param['id'])){
71 $this->model->edit($this->param,['id'=>$this->param['id']]); 74 $this->model->edit($this->param,['id'=>$this->param['id']]);
@@ -75,4 +78,20 @@ class ProjectWhiteHatAffixController extends BaseController @@ -75,4 +78,20 @@ class ProjectWhiteHatAffixController extends BaseController
75 $this->response('success',Code::SUCCESS,['id'=>$id]); 78 $this->response('success',Code::SUCCESS,['id'=>$id]);
76 } 79 }
77 80
  81 + /**
  82 + * @remark :删除数据
  83 + * @name :del
  84 + * @author :lyh
  85 + * @method :post
  86 + * @time :2025/6/23 11:08
  87 + */
  88 + public function del(){
  89 + $this->request->validate([
  90 + 'id'=>'required',
  91 + ],[
  92 + 'id.required' => '项目id不能为空',
  93 + ]);
  94 + $data = $this->model->del(['id'=>$this->param['id']]);
  95 + $this->response('success',Code::SUCCESS,$data);
  96 + }
78 } 97 }