作者 李宇航

合并分支 'lyh-server' 到 'master'

Lyh server



查看合并请求 !2890
@@ -1590,7 +1590,7 @@ if (!function_exists('httpGetSsl')) { @@ -1590,7 +1590,7 @@ if (!function_exists('httpGetSsl')) {
1590 } 1590 }
1591 1591
1592 /** 1592 /**
1593 - * @remark :截取自付出啊 1593 + * @remark :截取字符串
1594 * @name :truncate_words 1594 * @name :truncate_words
1595 * @author :lyh 1595 * @author :lyh
1596 * @method :post 1596 * @method :post
@@ -58,6 +58,9 @@ class AiBlogLogic extends BaseLogic @@ -58,6 +58,9 @@ class AiBlogLogic extends BaseLogic
58 if(!empty($this->param['image'])){ 58 if(!empty($this->param['image'])){
59 $this->param['image'] = str_replace_url($this->param['image']); 59 $this->param['image'] = str_replace_url($this->param['image']);
60 } 60 }
  61 + if(!isset($this->param['seo_title']) || empty($this->param['seo_title'])){
  62 + $this->param['seo_title'] = truncate_text($this->param['new_title'],70);
  63 + }
61 $this->param['route'] = RouteMap::setRoute($this->param['route'], RouteMap::SOURCE_AI_BLOG, $this->param['id'], $this->user['project_id']); 64 $this->param['route'] = RouteMap::setRoute($this->param['route'], RouteMap::SOURCE_AI_BLOG, $this->param['id'], $this->user['project_id']);
62 $anchor = $this->param['anchor'] ?? []; 65 $anchor = $this->param['anchor'] ?? [];
63 $this->param['anchor'] = json_encode($anchor,true); 66 $this->param['anchor'] = json_encode($anchor,true);
@@ -30,6 +30,9 @@ class BlogCategoryLogic extends BaseLogic @@ -30,6 +30,9 @@ class BlogCategoryLogic extends BaseLogic
30 public function categorySave(){ 30 public function categorySave(){
31 //验证名称是否存在 31 //验证名称是否存在
32 $this->verifyParamName($this->param['name']); 32 $this->verifyParamName($this->param['name']);
  33 + if(!isset($this->param['seo_title']) || empty($this->param['seo_title'])){
  34 + $this->param['seo_title'] = truncate_text($this->param['name'],70);
  35 + }
33 DB::beginTransaction(); 36 DB::beginTransaction();
34 try { 37 try {
35 if(isset($this->param['id']) && !empty($this->param['id'])){ 38 if(isset($this->param['id']) && !empty($this->param['id'])){
@@ -201,6 +201,9 @@ class BlogLogic extends BaseLogic @@ -201,6 +201,9 @@ class BlogLogic extends BaseLogic
201 $this->fail('发布时间需大于当天'); 201 $this->fail('发布时间需大于当天');
202 } 202 }
203 } 203 }
  204 + if(!isset($param['seo_title']) || empty($param['seo_title'])){
  205 + $param['seo_title'] = truncate_text($param['name'],70);
  206 + }
204 return $this->success($param); 207 return $this->success($param);
205 } 208 }
206 209
@@ -234,6 +234,9 @@ class CustomModuleContentLogic extends BaseLogic @@ -234,6 +234,9 @@ class CustomModuleContentLogic extends BaseLogic
234 $param['video']['video_image'] = str_replace_url($param['video']['video_image']); 234 $param['video']['video_image'] = str_replace_url($param['video']['video_image']);
235 $param['video'] = Arr::a2s($param['video'] ?? []); 235 $param['video'] = Arr::a2s($param['video'] ?? []);
236 } 236 }
  237 + if(!isset($param['seo_title']) || empty($param['seo_title'])){
  238 + $param['seo_title'] = truncate_text($param['name'],70);
  239 + }
237 return $this->success($param); 240 return $this->success($param);
238 } 241 }
239 242
@@ -49,6 +49,9 @@ class NewsCategoryLogic extends BaseLogic @@ -49,6 +49,9 @@ class NewsCategoryLogic extends BaseLogic
49 if(isset($param['image']) && !empty($param['image'])){ 49 if(isset($param['image']) && !empty($param['image'])){
50 $param['image'] = str_replace_url($param['image']); 50 $param['image'] = str_replace_url($param['image']);
51 } 51 }
  52 + if(!isset($param['seo_title']) || empty($param['seo_title'])){
  53 + $param['seo_title'] = truncate_text($param['name'],70);
  54 + }
52 return $this->success($param); 55 return $this->success($param);
53 } 56 }
54 /** 57 /**
@@ -225,6 +225,9 @@ class NewsLogic extends BaseLogic @@ -225,6 +225,9 @@ class NewsLogic extends BaseLogic
225 if(isset($param['related_product_id'])){ 225 if(isset($param['related_product_id'])){
226 $param['related_product_id'] = implode(',',$param['related_product_id']); 226 $param['related_product_id'] = implode(',',$param['related_product_id']);
227 } 227 }
  228 + if(!isset($param['seo_title']) || empty($param['seo_title'])){
  229 + $param['seo_title'] = truncate_text($param['name'],70);
  230 + }
228 return $this->success($param); 231 return $this->success($param);
229 } 232 }
230 233
@@ -157,6 +157,9 @@ class CategoryLogic extends BaseLogic @@ -157,6 +157,9 @@ class CategoryLogic extends BaseLogic
157 }else{ 157 }else{
158 $param['cate_tak'] = json_encode([]);; 158 $param['cate_tak'] = json_encode([]);;
159 } 159 }
  160 + if(!isset($param['seo_title']) || empty($param['seo_title'])){
  161 + $param['seo_title'] = truncate_text($param['title'],70);
  162 + }
160 return $this->success($param); 163 return $this->success($param);
161 } 164 }
162 165
@@ -123,6 +123,8 @@ class KeywordLogic extends BaseLogic @@ -123,6 +123,8 @@ class KeywordLogic extends BaseLogic
123 } 123 }
124 if(!empty($param['seo_title'])){ 124 if(!empty($param['seo_title'])){
125 $param['seo_title'] = ucfirst($param['seo_title']); 125 $param['seo_title'] = ucfirst($param['seo_title']);
  126 + }else{
  127 + $param['seo_title'] = truncate_text($param['title'],70);
126 } 128 }
127 $param['first_word'] = $this->model->first_word($param['title']); 129 $param['first_word'] = $this->model->first_word($param['title']);
128 return $param; 130 return $param;
@@ -392,6 +392,9 @@ class ProductLogic extends BaseLogic @@ -392,6 +392,9 @@ class ProductLogic extends BaseLogic
392 $param['attr_id'] = Arr::arrToSet($param['attr_id'] ?? ''); 392 $param['attr_id'] = Arr::arrToSet($param['attr_id'] ?? '');
393 $param['describe'] = Arr::a2s($param['describe'] ?? []); 393 $param['describe'] = Arr::a2s($param['describe'] ?? []);
394 $param['describe_id'] = Arr::arrToSet($param['describe_id'] ?? ''); 394 $param['describe_id'] = Arr::arrToSet($param['describe_id'] ?? '');
  395 + if(!isset($param['seo_mate']['seo_title']) || empty($param['seo_mate']['seo_title'])){
  396 + $param['seo_mate']['seo_title'] = truncate_text($param['title'],70);
  397 + }
395 $param['seo_mate'] = Arr::a2s($param['seo_mate'] ?? []); 398 $param['seo_mate'] = Arr::a2s($param['seo_mate'] ?? []);
396 $param['related_product_id'] = Arr::arrToSet($param['related_product_id'] ?? ''); 399 $param['related_product_id'] = Arr::arrToSet($param['related_product_id'] ?? '');
397 if(isset($param['icon'])){ 400 if(isset($param['icon'])){
@@ -27,7 +27,7 @@ class BlogCategoryRequest extends FormRequest @@ -27,7 +27,7 @@ class BlogCategoryRequest extends FormRequest
27 'name'=>'required|max:200', 27 'name'=>'required|max:200',
28 // 'seo_title'=>'max:70', 28 // 'seo_title'=>'max:70',
29 'seo_keywords'=>'max:300', 29 'seo_keywords'=>'max:300',
30 - 'seo_description'=>'max:200', 30 + 'seo_des'=>'max:200',
31 ]; 31 ];
32 } 32 }
33 33
@@ -38,7 +38,7 @@ class BlogCategoryRequest extends FormRequest @@ -38,7 +38,7 @@ class BlogCategoryRequest extends FormRequest
38 'name.max'=>'名称最大200字', 38 'name.max'=>'名称最大200字',
39 // 'seo_title.max' => 'SEO标题不能超过70个字符', 39 // 'seo_title.max' => 'SEO标题不能超过70个字符',
40 'seo_keywords.max' => 'SEO关键词不能超过300个字符', 40 'seo_keywords.max' => 'SEO关键词不能超过300个字符',
41 - 'seo_description.max' => 'SEO描述不能超过200个字符', 41 + 'seo_des.max' => 'SEO描述不能超过200个字符',
42 ]; 42 ];
43 } 43 }
44 } 44 }
@@ -27,7 +27,7 @@ class NewsCategoryRequest extends FormRequest @@ -27,7 +27,7 @@ class NewsCategoryRequest extends FormRequest
27 'name'=>'required|max:200', 27 'name'=>'required|max:200',
28 // 'seo_title'=>'max:70', 28 // 'seo_title'=>'max:70',
29 'seo_keywords'=>'max:300', 29 'seo_keywords'=>'max:300',
30 - 'seo_description'=>'max:200', 30 + 'seo_des'=>'max:200',
31 ]; 31 ];
32 } 32 }
33 33
@@ -38,7 +38,7 @@ class NewsCategoryRequest extends FormRequest @@ -38,7 +38,7 @@ class NewsCategoryRequest extends FormRequest
38 'name.max'=>'名称最大100字', 38 'name.max'=>'名称最大100字',
39 // 'seo_title.max' => 'SEO标题不能超过70个字符', 39 // 'seo_title.max' => 'SEO标题不能超过70个字符',
40 'seo_keywords.max' => 'SEO关键词不能超过300个字符', 40 'seo_keywords.max' => 'SEO关键词不能超过300个字符',
41 - 'seo_description.max' => 'SEO描述不能超过200个字符', 41 + 'seo_des.max' => 'SEO描述不能超过200个字符',
42 ]; 42 ];
43 } 43 }
44 } 44 }
@@ -33,7 +33,7 @@ class CategoryRequest extends FormRequest @@ -33,7 +33,7 @@ class CategoryRequest extends FormRequest
33 'title'=>'required|max:200', 33 'title'=>'required|max:200',
34 'route'=>'required', 34 'route'=>'required',
35 'seo_keywords'=>'max:300', 35 'seo_keywords'=>'max:300',
36 - 'seo_description'=>'max:200', 36 + 'seo_des'=>'max:200',
37 ]; 37 ];
38 } 38 }
39 39
@@ -44,7 +44,7 @@ class CategoryRequest extends FormRequest @@ -44,7 +44,7 @@ class CategoryRequest extends FormRequest
44 'title.max' => '分类名称不能超过200个字符', 44 'title.max' => '分类名称不能超过200个字符',
45 'route.required' => '路由不能为空', 45 'route.required' => '路由不能为空',
46 'seo_keywords.max' => 'SEO关键词不能超过300个字符', 46 'seo_keywords.max' => 'SEO关键词不能超过300个字符',
47 - 'seo_description.max' => 'SEO描述不能超过200个字符', 47 + 'seo_des.max' => 'SEO描述不能超过200个字符',
48 ]; 48 ];
49 } 49 }
50 50