正在显示
5 个修改的文件
包含
78 行增加
和
129 行删除
| @@ -435,12 +435,22 @@ function isEnglish($str) { | @@ -435,12 +435,22 @@ function isEnglish($str) { | ||
| 435 | * @method :post | 435 | * @method :post |
| 436 | * @time :2023/6/28 17:39 | 436 | * @time :2023/6/28 17:39 |
| 437 | */ | 437 | */ |
| 438 | -function characterTruncation($str,){ | ||
| 439 | - preg_match('/<main>(.*?)<\/main>/', $str, $matches); | ||
| 440 | - if (isset($matches[1])) { | ||
| 441 | - $result = $matches[1]; | ||
| 442 | - echo $result; | ||
| 443 | - } else { | ||
| 444 | - echo "未找到匹配的部分"; | ||
| 445 | - } | 438 | +function characterTruncation($str,$rule = 1){ |
| 439 | + switch ($rule){ | ||
| 440 | + case 1: | ||
| 441 | + $rule_str = '/<head>(.*?)<\/head>/'; | ||
| 442 | + break; | ||
| 443 | + case 2: | ||
| 444 | + $rule_str = '/<main>(.*?)<\/main>/'; | ||
| 445 | + break; | ||
| 446 | + case 3: | ||
| 447 | + $rule_str = '/<footer>(.*?)<\/footer>/'; | ||
| 448 | + break; | ||
| 449 | + } | ||
| 450 | + preg_match($rule_str, $str, $result); | ||
| 451 | + if (isset($result[1])) { | ||
| 452 | + $result = $result[1]; | ||
| 453 | + return $result; | ||
| 454 | + } | ||
| 455 | + return $result; | ||
| 446 | } | 456 | } |
| @@ -35,7 +35,10 @@ class ATemplateLogic extends BaseLogic | @@ -35,7 +35,10 @@ class ATemplateLogic extends BaseLogic | ||
| 35 | * @time :2023/6/28 17:13 | 35 | * @time :2023/6/28 17:13 |
| 36 | */ | 36 | */ |
| 37 | public function aTemplateSave(){ | 37 | public function aTemplateSave(){ |
| 38 | - //字符串截图 | 38 | + //字符串截取 |
| 39 | + $this->param['head_html'] = characterTruncation($this->param['html']); | ||
| 40 | + $this->param['main_html'] = characterTruncation($this->param['html'],2); | ||
| 41 | + $this->param['footer_html'] = characterTruncation($this->param['html'],3); | ||
| 39 | if(isset($this->param['id'])){ | 42 | if(isset($this->param['id'])){ |
| 40 | $rs = $this->model->edit($this->param,['id'=>$this->param['id']]); | 43 | $rs = $this->model->edit($this->param,['id'=>$this->param['id']]); |
| 41 | }else{ | 44 | }else{ |
| @@ -19,4 +19,48 @@ class ATemplateModuleLogic extends BaseLogic | @@ -19,4 +19,48 @@ class ATemplateModuleLogic extends BaseLogic | ||
| 19 | $this->model = new ATemplateModule(); | 19 | $this->model = new ATemplateModule(); |
| 20 | $this->param = $this->requestAll; | 20 | $this->param = $this->requestAll; |
| 21 | } | 21 | } |
| 22 | + | ||
| 23 | + /** | ||
| 24 | + * @remark :左侧模块列表 | ||
| 25 | + * @name :aTemplateModuleLists | ||
| 26 | + * @author :lyh | ||
| 27 | + * @method :post | ||
| 28 | + * @time :2023/6/28 18:01 | ||
| 29 | + */ | ||
| 30 | + public function aTemplateModuleLists(){ | ||
| 31 | + | ||
| 32 | + } | ||
| 33 | + | ||
| 34 | + /** | ||
| 35 | + * @remark :保存左侧模块 | ||
| 36 | + * @name :aTemplateModuleSave | ||
| 37 | + * @author :lyh | ||
| 38 | + * @method :post | ||
| 39 | + * @time :2023/6/28 18:01 | ||
| 40 | + */ | ||
| 41 | + public function aTemplateModuleSave(){ | ||
| 42 | + | ||
| 43 | + } | ||
| 44 | + | ||
| 45 | + /** | ||
| 46 | + * @remark :修改左侧模块状态 | ||
| 47 | + * @name :aTemplateModuleStatus | ||
| 48 | + * @author :lyh | ||
| 49 | + * @method :post | ||
| 50 | + * @time :2023/6/28 18:02 | ||
| 51 | + */ | ||
| 52 | + public function aTemplateModuleStatus(){ | ||
| 53 | + | ||
| 54 | + } | ||
| 55 | + | ||
| 56 | + /** | ||
| 57 | + * @remark :逻辑删除左侧模块 | ||
| 58 | + * @name :aTemplateModuleDel | ||
| 59 | + * @author :lyh | ||
| 60 | + * @method :post | ||
| 61 | + * @time :2023/6/28 18:02 | ||
| 62 | + */ | ||
| 63 | + public function aTemplateModuleDel(){ | ||
| 64 | + | ||
| 65 | + } | ||
| 22 | } | 66 | } |
| @@ -3,17 +3,15 @@ | @@ -3,17 +3,15 @@ | ||
| 3 | namespace App\Http\Requests\Aside\Template; | 3 | namespace App\Http\Requests\Aside\Template; |
| 4 | 4 | ||
| 5 | use Illuminate\Foundation\Http\FormRequest; | 5 | use Illuminate\Foundation\Http\FormRequest; |
| 6 | -use Illuminate\Validation\Rule; | ||
| 7 | 6 | ||
| 8 | /** | 7 | /** |
| 9 | - * @author:dc | ||
| 10 | - * @time 2023/5/11 14:38 | ||
| 11 | - * Class TemplateRequest | ||
| 12 | - * @package App\Http\Requests\Aside\BTemplate | 8 | + * @remark :左侧模块参数验证 |
| 9 | + * @name :ATemplateModuleRequest | ||
| 10 | + * @author :lyh | ||
| 11 | + * @time :2023/6/28 18:04 | ||
| 13 | */ | 12 | */ |
| 14 | -class TemplateRequest extends FormRequest | 13 | +class ATemplateModuleRequest extends FormRequest |
| 15 | { | 14 | { |
| 16 | - | ||
| 17 | /** | 15 | /** |
| 18 | * Determine if the user is authorized to make this request. | 16 | * Determine if the user is authorized to make this request. |
| 19 | * | 17 | * |
| @@ -31,43 +29,19 @@ class TemplateRequest extends FormRequest | @@ -31,43 +29,19 @@ class TemplateRequest extends FormRequest | ||
| 31 | */ | 29 | */ |
| 32 | public function rules() | 30 | public function rules() |
| 33 | { | 31 | { |
| 34 | - $rule = [ | ||
| 35 | - 'id' => ['required','integer'], | ||
| 36 | - 'name' => ['required'], | ||
| 37 | - 'status' => ['required',Rule::in(0,1)], | ||
| 38 | - 'is_default' => ['required',Rule::in(0,1)], | ||
| 39 | - 'sort' => ['required','integer'], | ||
| 40 | - 'thumb' => ['required'], | ||
| 41 | - 'url' => ['required'], | ||
| 42 | - 'html' => ['required'], | 32 | + return [ |
| 33 | + 'name'=>'required', | ||
| 34 | + 'image'=>'required', | ||
| 35 | + 'html'=>'required', | ||
| 43 | ]; | 36 | ]; |
| 44 | - | ||
| 45 | - // 更新场景 | ||
| 46 | - if($this->is('a/template/insert')){ | ||
| 47 | - unset($rule['id']); | ||
| 48 | - } | ||
| 49 | - | ||
| 50 | - return $rule; | ||
| 51 | } | 37 | } |
| 52 | 38 | ||
| 53 | - | ||
| 54 | - | ||
| 55 | public function messages() | 39 | public function messages() |
| 56 | { | 40 | { |
| 57 | return [ | 41 | return [ |
| 58 | - 'id.required' => 'id必须', | ||
| 59 | - 'id.integer' => 'id必须', | ||
| 60 | - | ||
| 61 | - 'name.required' => '名称必须', | ||
| 62 | - 'status.integer' => '状态错误', | ||
| 63 | - 'status.in' => '状态错误', | ||
| 64 | - 'is_default.integer' => '是否默认', | ||
| 65 | - 'is_default.in' => '是否默认', | ||
| 66 | - 'sort.required' => '排序必须', | ||
| 67 | - 'sort.integer' => '排序必须', | ||
| 68 | - 'thumb.required' => '缩略图必须', | ||
| 69 | - 'url.required' => '预览链接必须', | 42 | + 'name.required'=>'名称不能为空', |
| 43 | + 'image.required' => '图片不能为空', | ||
| 44 | + 'html.required'=>'代码不能为空', | ||
| 70 | ]; | 45 | ]; |
| 71 | } | 46 | } |
| 72 | - | ||
| 73 | } | 47 | } |
| 1 | -<?php | ||
| 2 | - | ||
| 3 | -namespace App\Http\Requests\Aside\Template; | ||
| 4 | - | ||
| 5 | -use Illuminate\Foundation\Http\FormRequest; | ||
| 6 | -use Illuminate\Validation\Rule; | ||
| 7 | - | ||
| 8 | -/** | ||
| 9 | - * 自定义模板 块 | ||
| 10 | - * @author:dc | ||
| 11 | - * @time 2023/5/29 10:57 | ||
| 12 | - * Class TemplateChunkRequest | ||
| 13 | - * @package App\Http\Requests\Aside\BTemplate | ||
| 14 | - */ | ||
| 15 | -class TemplateChunkRequest extends FormRequest | ||
| 16 | -{ | ||
| 17 | - | ||
| 18 | - /** | ||
| 19 | - * Determine if the user is authorized to make this request. | ||
| 20 | - * | ||
| 21 | - * @return bool | ||
| 22 | - */ | ||
| 23 | - public function authorize() | ||
| 24 | - { | ||
| 25 | - return true; | ||
| 26 | - } | ||
| 27 | - | ||
| 28 | - /** | ||
| 29 | - * Get the validation rules that apply to the request. | ||
| 30 | - * | ||
| 31 | - * @return array | ||
| 32 | - */ | ||
| 33 | - public function rules() | ||
| 34 | - { | ||
| 35 | - $rule = [ | ||
| 36 | - 'id' => ['required','integer'], | ||
| 37 | - 'name' => ['required'], | ||
| 38 | - 'type' => ['required'], | ||
| 39 | - 'status' => ['required',Rule::in(0,1)], | ||
| 40 | - 'sort' => ['required','integer'], | ||
| 41 | - 'thumb' => ['required'], | ||
| 42 | - 'html' => ['required'], | ||
| 43 | - 'attr' => [], | ||
| 44 | - 'images' => [], | ||
| 45 | - 'video' => [], | ||
| 46 | - ]; | ||
| 47 | - | ||
| 48 | - // 更新场景 | ||
| 49 | - if($this->is('a/template/chunk/create')){ | ||
| 50 | - unset($rule['id']); | ||
| 51 | - } | ||
| 52 | - if($this->is('b/template/chunk/create')){ | ||
| 53 | - unset($rule['id']); | ||
| 54 | - } | ||
| 55 | - | ||
| 56 | - return $rule; | ||
| 57 | - } | ||
| 58 | - | ||
| 59 | - | ||
| 60 | - | ||
| 61 | - public function messages() | ||
| 62 | - { | ||
| 63 | - return [ | ||
| 64 | - 'id.required' => 'id必须', | ||
| 65 | - 'id.integer' => 'id必须', | ||
| 66 | - | ||
| 67 | - 'name.required' => '名称必须', | ||
| 68 | - 'type.required' => '类型必须', | ||
| 69 | - 'status.integer' => '状态错误', | ||
| 70 | - 'status.in' => '状态错误', | ||
| 71 | - | ||
| 72 | - 'sort.required' => '排序必须', | ||
| 73 | - 'sort.integer' => '排序必须', | ||
| 74 | - 'thumb.required' => '缩略图必须', | ||
| 75 | - | ||
| 76 | - 'html.required' => 'html代码必须', | ||
| 77 | -// 'attr.required' => '其他必须', | ||
| 78 | - | ||
| 79 | - ]; | ||
| 80 | - } | ||
| 81 | - | ||
| 82 | -} |
-
请 注册 或 登录 后发表评论