正在显示
9 个修改的文件
包含
24 行增加
和
1 行删除
| @@ -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 |
| @@ -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'])){ |
-
请 注册 或 登录 后发表评论