作者 赵彬吉
@@ -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
@@ -198,18 +198,18 @@ class CustomModuleContentController extends BaseController @@ -198,18 +198,18 @@ class CustomModuleContentController extends BaseController
198 */ 198 */
199 public function save(CustomModuleContentLogic $logic){ 199 public function save(CustomModuleContentLogic $logic){
200 $this->request->validate([ 200 $this->request->validate([
201 - 'name'=>['required'], 201 + 'name'=>['required','max:200'],
202 'route'=>['required'], 202 'route'=>['required'],
203 'module_id'=>['required'], 203 'module_id'=>['required'],
204 // 'seo_title'=>['max:70'], 204 // 'seo_title'=>['max:70'],
205 - 'seo_keywords'=>['max:200'], 205 + 'seo_keywords'=>['max:300'],
206 'seo_description'=>['max:200'], 206 'seo_description'=>['max:200'],
207 ],[ 207 ],[
208 'name.required' => '分类名称不能为空', 208 'name.required' => '分类名称不能为空',
209 'route.required' => '分类路由不能为空', 209 'route.required' => '分类路由不能为空',
210 'module_id.required' => '所选模块id不能为空', 210 'module_id.required' => '所选模块id不能为空',
211 // 'seo_title.max' => 'SEO标题不能超过70个字符', 211 // 'seo_title.max' => 'SEO标题不能超过70个字符',
212 - 'seo_keywords.max' => 'SEO关键词不能超过200个字符', 212 + 'seo_keywords.max' => 'SEO关键词不能超过300个字符',
213 'seo_description.max' => 'SEO描述不能超过200个字符', 213 'seo_description.max' => 'SEO描述不能超过200个字符',
214 ]); 214 ]);
215 $data = $logic->contentSave(); 215 $data = $logic->contentSave();
@@ -249,13 +249,13 @@ class InquiryForwardLogic extends BaseLogic @@ -249,13 +249,13 @@ class InquiryForwardLogic extends BaseLogic
249 $num = $this->param['num'] ?? 3; 249 $num = $this->param['num'] ?? 3;
250 250
251 $model = new InquiryProjectRoute(); 251 $model = new InquiryProjectRoute();
252 - if ($this->param['type'] == 1) {  
253 - //使用全文索引搜索  
254 - $routeQuery = $model->select(['project_id', 'route'])->whereRaw("MATCH(title) AGAINST(? IN BOOLEAN MODE)", [$this->param['keywords']]);  
255 - } else { 252 +// if ($this->param['type'] == 1) {
  253 +// //使用全文索引搜索
  254 +// $routeQuery = $model->select(['project_id', 'route'])->whereRaw("MATCH(title) AGAINST(? IN BOOLEAN MODE)", [$this->param['keywords']]);
  255 +// } else {
256 //使用like查询 256 //使用like查询
257 $routeQuery = $model->select(['project_id', 'route'])->where('title', 'like', '%' . $this->param['keywords'] . '%'); 257 $routeQuery = $model->select(['project_id', 'route'])->where('title', 'like', '%' . $this->param['keywords'] . '%');
258 - } 258 +// }
259 259
260 $re_route = $routeQuery->inRandomOrder()->take(100)->get()->toArray(); 260 $re_route = $routeQuery->inRandomOrder()->take(100)->get()->toArray();
261 261
@@ -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);
@@ -153,7 +156,7 @@ class AiBlogLogic extends BaseLogic @@ -153,7 +156,7 @@ class AiBlogLogic extends BaseLogic
153 //删除路由映射 156 //删除路由映射
154 RouteMap::delRoute(RouteMap::SOURCE_AI_BLOG, $id, $this->user['project_id']); 157 RouteMap::delRoute(RouteMap::SOURCE_AI_BLOG, $id, $this->user['project_id']);
155 $this->model->del(['id'=>$id]); 158 $this->model->del(['id'=>$id]);
156 - $this->curlDelRoute(['old_route'=>$info['route']]); 159 + $this->curlDelRoute(['old_route'=>$info['route'],'path'=>'blog']);
157 } 160 }
158 Artisan::call('save_ai_blog_list', ['project_id' => $this->user['project_id']]); 161 Artisan::call('save_ai_blog_list', ['project_id' => $this->user['project_id']]);
159 }catch (\Exception $e){ 162 }catch (\Exception $e){
@@ -91,6 +91,7 @@ class AiVideoLogic extends BaseLogic @@ -91,6 +91,7 @@ class AiVideoLogic extends BaseLogic
91 //删除路由映射 91 //删除路由映射
92 RouteMap::delRoute(RouteMap::SOURCE_AI_VIDEO, $id, $this->user['project_id']); 92 RouteMap::delRoute(RouteMap::SOURCE_AI_VIDEO, $id, $this->user['project_id']);
93 $this->model->del(['id'=>$id]); 93 $this->model->del(['id'=>$id]);
  94 + $this->curlDelRoute(['old_route'=>$info['route'],'path'=>'video']);
94 } 95 }
95 }catch (\Exception $e){ 96 }catch (\Exception $e){
96 $this->fail('删除失败,请联系管理员'); 97 $this->fail('删除失败,请联系管理员');
@@ -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'])){
@@ -26,7 +26,7 @@ class AiBlogRequest extends FormRequest @@ -26,7 +26,7 @@ class AiBlogRequest extends FormRequest
26 return [ 26 return [
27 'new_title'=>'required', 27 'new_title'=>'required',
28 // 'seo_title'=>'max:70', 28 // 'seo_title'=>'max:70',
29 - 'seo_keywords'=>'max:200', 29 + 'seo_keywords'=>'max:300',
30 'seo_description'=>'max:200', 30 'seo_description'=>'max:200',
31 ]; 31 ];
32 } 32 }
@@ -36,7 +36,7 @@ class AiBlogRequest extends FormRequest @@ -36,7 +36,7 @@ class AiBlogRequest extends FormRequest
36 return [ 36 return [
37 'new_title.required' => '新标题不能为空', 37 'new_title.required' => '新标题不能为空',
38 // 'seo_title.max' => 'SEO标题不能超过70个字符', 38 // 'seo_title.max' => 'SEO标题不能超过70个字符',
39 - 'seo_keywords.max' => 'SEO关键词不能超过200个字符', 39 + 'seo_keywords.max' => 'SEO关键词不能超过300个字符',
40 'seo_description.max' => 'SEO描述不能超过200个字符', 40 'seo_description.max' => 'SEO描述不能超过200个字符',
41 ]; 41 ];
42 } 42 }
@@ -25,9 +25,9 @@ class BlogCategoryRequest extends FormRequest @@ -25,9 +25,9 @@ class BlogCategoryRequest extends FormRequest
25 { 25 {
26 return [ 26 return [
27 'name'=>'required|max:200', 27 'name'=>'required|max:200',
28 - 'seo_title'=>'max:70',  
29 - 'seo_keywords'=>'max:200',  
30 - 'seo_description'=>'max:200', 28 +// 'seo_title'=>'max:70',
  29 + 'seo_keywords'=>'max:300',
  30 + 'seo_des'=>'max:200',
31 ]; 31 ];
32 } 32 }
33 33
@@ -36,9 +36,9 @@ class BlogCategoryRequest extends FormRequest @@ -36,9 +36,9 @@ class BlogCategoryRequest extends FormRequest
36 return [ 36 return [
37 'name.required'=>'请填写名称', 37 'name.required'=>'请填写名称',
38 'name.max'=>'名称最大200字', 38 'name.max'=>'名称最大200字',
39 - 'seo_title.max' => 'SEO标题不能超过70个字符',  
40 - 'seo_keywords.max' => 'SEO关键词不能超过200个字符',  
41 - 'seo_description.max' => 'SEO描述不能超过200个字符', 39 +// 'seo_title.max' => 'SEO标题不能超过70个字符',
  40 + 'seo_keywords.max' => 'SEO关键词不能超过300个字符',
  41 + 'seo_des.max' => 'SEO描述不能超过200个字符',
42 ]; 42 ];
43 } 43 }
44 } 44 }
@@ -28,9 +28,8 @@ class BlogRequest extends FormRequest @@ -28,9 +28,8 @@ class BlogRequest extends FormRequest
28 'remark'=>'max:1000', 28 'remark'=>'max:1000',
29 'url'=>'required', 29 'url'=>'required',
30 // 'seo_title'=>'max:70', 30 // 'seo_title'=>'max:70',
31 - 'seo_keywords'=>'max:200', 31 + 'seo_keywords'=>'max:300',
32 'seo_description'=>'max:200', 32 'seo_description'=>'max:200',
33 -// 'text'=>'max:5000',  
34 ]; 33 ];
35 } 34 }
36 35
@@ -41,10 +40,9 @@ class BlogRequest extends FormRequest @@ -41,10 +40,9 @@ class BlogRequest extends FormRequest
41 'name.max'=>'名称超过最长长度200', 40 'name.max'=>'名称超过最长长度200',
42 'url.required'=>'链接不能为空', 41 'url.required'=>'链接不能为空',
43 // 'seo_title.max' => 'SEO标题不能超过70个字符', 42 // 'seo_title.max' => 'SEO标题不能超过70个字符',
44 - 'seo_keywords.max' => 'SEO关键词不能超过200个字符', 43 + 'seo_keywords.max' => 'SEO关键词不能超过300个字符',
45 'seo_description.max' => 'SEO描述不能超过200个字符', 44 'seo_description.max' => 'SEO描述不能超过200个字符',
46 'remark.max'=>'描述超过最长长度1000', 45 'remark.max'=>'描述超过最长长度1000',
47 -// 'text.max'=>'详情内容超过最大长度',  
48 ]; 46 ];
49 } 47 }
50 } 48 }
@@ -26,8 +26,8 @@ class NewsCategoryRequest extends FormRequest @@ -26,8 +26,8 @@ class NewsCategoryRequest extends FormRequest
26 return [ 26 return [
27 'name'=>'required|max:200', 27 'name'=>'required|max:200',
28 // 'seo_title'=>'max:70', 28 // 'seo_title'=>'max:70',
29 - 'seo_keywords'=>'max:200',  
30 - 'seo_description'=>'max:200', 29 + 'seo_keywords'=>'max:300',
  30 + 'seo_des'=>'max:200',
31 ]; 31 ];
32 } 32 }
33 33
@@ -37,8 +37,8 @@ class NewsCategoryRequest extends FormRequest @@ -37,8 +37,8 @@ class NewsCategoryRequest extends FormRequest
37 'name.required'=>'请填写名称', 37 'name.required'=>'请填写名称',
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关键词不能超过200个字符',  
41 - 'seo_description.max' => 'SEO描述不能超过200个字符', 40 + 'seo_keywords.max' => 'SEO关键词不能超过300个字符',
  41 + 'seo_des.max' => 'SEO描述不能超过200个字符',
42 ]; 42 ];
43 } 43 }
44 } 44 }
@@ -25,10 +25,9 @@ class NewsRequest extends FormRequest @@ -25,10 +25,9 @@ class NewsRequest extends FormRequest
25 { 25 {
26 return [ 26 return [
27 'name'=>'required|max:200', 27 'name'=>'required|max:200',
28 -// 'remark'=>'max:2000',  
29 'url'=>'required', 28 'url'=>'required',
30 // 'seo_title' => 'max:70', 29 // 'seo_title' => 'max:70',
31 - 'seo_keywords' => 'max:200', 30 + 'seo_keywords' => 'max:300',
32 'seo_description' => 'max:200', 31 'seo_description' => 'max:200',
33 ]; 32 ];
34 } 33 }
@@ -39,7 +38,6 @@ class NewsRequest extends FormRequest @@ -39,7 +38,6 @@ class NewsRequest extends FormRequest
39 'name.required'=>'请填写名称', 38 'name.required'=>'请填写名称',
40 'name.max'=>'名称超过最长长度200', 39 'name.max'=>'名称超过最长长度200',
41 'url.required'=>'链接不能为空', 40 'url.required'=>'链接不能为空',
42 -// 'remark.max'=>'描述超过最长长度2000'  
43 // 'seo_title.max' => 'SEO标题不能超过70个字符', 41 // 'seo_title.max' => 'SEO标题不能超过70个字符',
44 'seo_keywords.max' => 'SEO关键词不能超过300个字符', 42 'seo_keywords.max' => 'SEO关键词不能超过300个字符',
45 'seo_description.max' => 'SEO描述不能超过200个字符', 43 'seo_description.max' => 'SEO描述不能超过200个字符',
@@ -32,9 +32,8 @@ class CategoryRequest extends FormRequest @@ -32,9 +32,8 @@ class CategoryRequest extends FormRequest
32 return [ 32 return [
33 'title'=>'required|max:200', 33 'title'=>'required|max:200',
34 'route'=>'required', 34 'route'=>'required',
35 -// 'image'=>'required',  
36 -// 'keywords'=>'max:50',  
37 -// 'describe'=>'max:200', 35 + 'seo_keywords'=>'max:300',
  36 + 'seo_des'=>'max:200',
38 ]; 37 ];
39 } 38 }
40 39
@@ -44,9 +43,8 @@ class CategoryRequest extends FormRequest @@ -44,9 +43,8 @@ class CategoryRequest extends FormRequest
44 'title.required' => '请输入分类名称', 43 'title.required' => '请输入分类名称',
45 'title.max' => '分类名称不能超过200个字符', 44 'title.max' => '分类名称不能超过200个字符',
46 'route.required' => '路由不能为空', 45 'route.required' => '路由不能为空',
47 -// 'image.required' => '请上传分类图片',  
48 -// 'keywords.max' => '分类关键词不能超过50个字符',  
49 -// 'describe.max' => '分类描述不能超过200个字符', 46 + 'seo_keywords.max' => 'SEO关键词不能超过300个字符',
  47 + 'seo_des.max' => 'SEO描述不能超过200个字符',
50 ]; 48 ];
51 } 49 }
52 50
@@ -32,7 +32,7 @@ class KeywordRequest extends FormRequest @@ -32,7 +32,7 @@ class KeywordRequest extends FormRequest
32 return [ 32 return [
33 'title'=>'required|max:200', 33 'title'=>'required|max:200',
34 // 'seo_title'=>'max:70', 34 // 'seo_title'=>'max:70',
35 - 'seo_keywords'=>'max:200', 35 + 'seo_keywords'=>'max:300',
36 'seo_description'=>'max:200', 36 'seo_description'=>'max:200',
37 'related_news_ids'=>'array|max:2', 37 'related_news_ids'=>'array|max:2',
38 'related_blog_ids'=>'array|max:2', 38 'related_blog_ids'=>'array|max:2',
@@ -45,7 +45,7 @@ class KeywordRequest extends FormRequest @@ -45,7 +45,7 @@ class KeywordRequest extends FormRequest
45 'title.required' => '请输入关键词', 45 'title.required' => '请输入关键词',
46 'title.max' => '关键词不能超过200个字符', 46 'title.max' => '关键词不能超过200个字符',
47 // 'seo_title.max' => 'SEO标题不能超过70个字符', 47 // 'seo_title.max' => 'SEO标题不能超过70个字符',
48 - 'seo_keywords.max' => 'SEO关键词不能超过200个字符', 48 + 'seo_keywords.max' => 'SEO关键词不能超过300个字符',
49 'seo_description.max' => 'SEO描述不能超过200个字符', 49 'seo_description.max' => 'SEO描述不能超过200个字符',
50 'related_news_ids.max' => '关联新闻不能超过两条', 50 'related_news_ids.max' => '关联新闻不能超过两条',
51 'related_blog_ids.max' => '关联博客不能超过两条', 51 'related_blog_ids.max' => '关联博客不能超过两条',