作者 lyh

gx

@@ -45,18 +45,14 @@ class ReplaceHtmlController extends BaseController @@ -45,18 +45,14 @@ class ReplaceHtmlController extends BaseController
45 */ 45 */
46 public function replaceTemplateMainHtml(ReplaceHtmlLogic $logic){ 46 public function replaceTemplateMainHtml(ReplaceHtmlLogic $logic){
47 $this->request->validate([ 47 $this->request->validate([
48 - 'old_html'=>'required', 48 + 'name'=>'required',
49 'html'=>'required', 49 'html'=>'required',
50 - 'type'=>'required',  
51 - 'is_list'=>'required',  
52 - 'is_custom'=>'required', 50 + 'old_html'=>'required',
53 'project_id'=>'required', 51 'project_id'=>'required',
54 ],[ 52 ],[
55 - 'old_html.required' => '需替换的html不能为空', 53 + 'name.required' => '需替换页面标识不能为空',
56 'html.required' => 'html不能为空', 54 'html.required' => 'html不能为空',
57 - 'type.required' => '类型type不能为空',  
58 - 'is_custom.required' => '类型is_custom不能为空',  
59 - 'is_list.required' => '类型is_list不能为空', 55 + 'old_html.required' => '替换前的html不能为空',
60 'project_id.required' => 'project_id不能为空', 56 'project_id.required' => 'project_id不能为空',
61 ]); 57 ]);
62 $logic->replaceHtml(); 58 $logic->replaceHtml();
@@ -27,6 +27,17 @@ class ReplaceHtmlLogic extends BaseLogic @@ -27,6 +27,17 @@ class ReplaceHtmlLogic extends BaseLogic
27 } 27 }
28 28
29 /** 29 /**
  30 + * @remark :获取模版id
  31 + * @name :getTemplateId
  32 + * @author :lyh
  33 + * @method :post
  34 + * @time :2024/5/9 18:03
  35 + */
  36 + public function getTemplateId(){
  37 +
  38 + }
  39 +
  40 + /**
30 * @remark :替换可视化的html代码(按类型) 41 * @remark :替换可视化的html代码(按类型)
31 * @name :replaceHtml 42 * @name :replaceHtml
32 * @author :lyh 43 * @author :lyh
@@ -35,6 +46,18 @@ class ReplaceHtmlLogic extends BaseLogic @@ -35,6 +46,18 @@ class ReplaceHtmlLogic extends BaseLogic
35 */ 46 */
36 public function replaceHtml(){ 47 public function replaceHtml(){
37 ProjectServer::useProject($this->param['project_id']); 48 ProjectServer::useProject($this->param['project_id']);
  49 + $data = $this->model->sourceType();
  50 + if(!isset($data[$this->param['name']])){
  51 + $this->fail('数据错误,请联系管理员');
  52 + }
  53 + $replaceHtmlData = [
  54 + 'old_html'=>$this->param['old_html'],
  55 + 'html'=>$this->param['html'],
  56 + 'type'=>$data[$this->param['name']]['type'],
  57 + 'is_list'=>$data[$this->param['name']]['is_list'],
  58 + 'is_custom'=>$data[$this->param['name']]['is_custom'],
  59 + 'template_id'=>1
  60 + ];
38 //TODO::生成一条任务记录 61 //TODO::生成一条任务记录
39 $replaceId = $this->saveReplaceHtml($this->param); 62 $replaceId = $this->saveReplaceHtml($this->param);
40 //查询当前类型所有装修的记录 63 //查询当前类型所有装修的记录