作者 赵彬吉
... ... @@ -1590,7 +1590,7 @@ if (!function_exists('httpGetSsl')) {
}
/**
* @remark :截取自付出啊
* @remark :截取字符串
* @name :truncate_words
* @author :lyh
* @method :post
... ...
... ... @@ -198,18 +198,18 @@ class CustomModuleContentController extends BaseController
*/
public function save(CustomModuleContentLogic $logic){
$this->request->validate([
'name'=>['required'],
'name'=>['required','max:200'],
'route'=>['required'],
'module_id'=>['required'],
// 'seo_title'=>['max:70'],
'seo_keywords'=>['max:200'],
'seo_keywords'=>['max:300'],
'seo_description'=>['max:200'],
],[
'name.required' => '分类名称不能为空',
'route.required' => '分类路由不能为空',
'module_id.required' => '所选模块id不能为空',
// 'seo_title.max' => 'SEO标题不能超过70个字符',
'seo_keywords.max' => 'SEO关键词不能超过200个字符',
'seo_keywords.max' => 'SEO关键词不能超过300个字符',
'seo_description.max' => 'SEO描述不能超过200个字符',
]);
$data = $logic->contentSave();
... ...
... ... @@ -249,13 +249,13 @@ class InquiryForwardLogic extends BaseLogic
$num = $this->param['num'] ?? 3;
$model = new InquiryProjectRoute();
if ($this->param['type'] == 1) {
//使用全文索引搜索
$routeQuery = $model->select(['project_id', 'route'])->whereRaw("MATCH(title) AGAINST(? IN BOOLEAN MODE)", [$this->param['keywords']]);
} else {
// if ($this->param['type'] == 1) {
// //使用全文索引搜索
// $routeQuery = $model->select(['project_id', 'route'])->whereRaw("MATCH(title) AGAINST(? IN BOOLEAN MODE)", [$this->param['keywords']]);
// } else {
//使用like查询
$routeQuery = $model->select(['project_id', 'route'])->where('title', 'like', '%' . $this->param['keywords'] . '%');
}
// }
$re_route = $routeQuery->inRandomOrder()->take(100)->get()->toArray();
... ...
... ... @@ -58,6 +58,9 @@ class AiBlogLogic extends BaseLogic
if(!empty($this->param['image'])){
$this->param['image'] = str_replace_url($this->param['image']);
}
if(!isset($this->param['seo_title']) || empty($this->param['seo_title'])){
$this->param['seo_title'] = truncate_text($this->param['new_title'],70);
}
$this->param['route'] = RouteMap::setRoute($this->param['route'], RouteMap::SOURCE_AI_BLOG, $this->param['id'], $this->user['project_id']);
$anchor = $this->param['anchor'] ?? [];
$this->param['anchor'] = json_encode($anchor,true);
... ... @@ -153,7 +156,7 @@ class AiBlogLogic extends BaseLogic
//删除路由映射
RouteMap::delRoute(RouteMap::SOURCE_AI_BLOG, $id, $this->user['project_id']);
$this->model->del(['id'=>$id]);
$this->curlDelRoute(['old_route'=>$info['route']]);
$this->curlDelRoute(['old_route'=>$info['route'],'path'=>'blog']);
}
Artisan::call('save_ai_blog_list', ['project_id' => $this->user['project_id']]);
}catch (\Exception $e){
... ...
... ... @@ -91,6 +91,7 @@ class AiVideoLogic extends BaseLogic
//删除路由映射
RouteMap::delRoute(RouteMap::SOURCE_AI_VIDEO, $id, $this->user['project_id']);
$this->model->del(['id'=>$id]);
$this->curlDelRoute(['old_route'=>$info['route'],'path'=>'video']);
}
}catch (\Exception $e){
$this->fail('删除失败,请联系管理员');
... ...
... ... @@ -30,6 +30,9 @@ class BlogCategoryLogic extends BaseLogic
public function categorySave(){
//验证名称是否存在
$this->verifyParamName($this->param['name']);
if(!isset($this->param['seo_title']) || empty($this->param['seo_title'])){
$this->param['seo_title'] = truncate_text($this->param['name'],70);
}
DB::beginTransaction();
try {
if(isset($this->param['id']) && !empty($this->param['id'])){
... ...
... ... @@ -201,6 +201,9 @@ class BlogLogic extends BaseLogic
$this->fail('发布时间需大于当天');
}
}
if(!isset($param['seo_title']) || empty($param['seo_title'])){
$param['seo_title'] = truncate_text($param['name'],70);
}
return $this->success($param);
}
... ...
... ... @@ -234,6 +234,9 @@ class CustomModuleContentLogic extends BaseLogic
$param['video']['video_image'] = str_replace_url($param['video']['video_image']);
$param['video'] = Arr::a2s($param['video'] ?? []);
}
if(!isset($param['seo_title']) || empty($param['seo_title'])){
$param['seo_title'] = truncate_text($param['name'],70);
}
return $this->success($param);
}
... ...
... ... @@ -49,6 +49,9 @@ class NewsCategoryLogic extends BaseLogic
if(isset($param['image']) && !empty($param['image'])){
$param['image'] = str_replace_url($param['image']);
}
if(!isset($param['seo_title']) || empty($param['seo_title'])){
$param['seo_title'] = truncate_text($param['name'],70);
}
return $this->success($param);
}
/**
... ...
... ... @@ -225,6 +225,9 @@ class NewsLogic extends BaseLogic
if(isset($param['related_product_id'])){
$param['related_product_id'] = implode(',',$param['related_product_id']);
}
if(!isset($param['seo_title']) || empty($param['seo_title'])){
$param['seo_title'] = truncate_text($param['name'],70);
}
return $this->success($param);
}
... ...
... ... @@ -157,6 +157,9 @@ class CategoryLogic extends BaseLogic
}else{
$param['cate_tak'] = json_encode([]);;
}
if(!isset($param['seo_title']) || empty($param['seo_title'])){
$param['seo_title'] = truncate_text($param['title'],70);
}
return $this->success($param);
}
... ...
... ... @@ -123,6 +123,8 @@ class KeywordLogic extends BaseLogic
}
if(!empty($param['seo_title'])){
$param['seo_title'] = ucfirst($param['seo_title']);
}else{
$param['seo_title'] = truncate_text($param['title'],70);
}
$param['first_word'] = $this->model->first_word($param['title']);
return $param;
... ...
... ... @@ -392,6 +392,9 @@ class ProductLogic extends BaseLogic
$param['attr_id'] = Arr::arrToSet($param['attr_id'] ?? '');
$param['describe'] = Arr::a2s($param['describe'] ?? []);
$param['describe_id'] = Arr::arrToSet($param['describe_id'] ?? '');
if(!isset($param['seo_mate']['seo_title']) || empty($param['seo_mate']['seo_title'])){
$param['seo_mate']['seo_title'] = truncate_text($param['title'],70);
}
$param['seo_mate'] = Arr::a2s($param['seo_mate'] ?? []);
$param['related_product_id'] = Arr::arrToSet($param['related_product_id'] ?? '');
if(isset($param['icon'])){
... ...
... ... @@ -26,7 +26,7 @@ class AiBlogRequest extends FormRequest
return [
'new_title'=>'required',
// 'seo_title'=>'max:70',
'seo_keywords'=>'max:200',
'seo_keywords'=>'max:300',
'seo_description'=>'max:200',
];
}
... ... @@ -36,7 +36,7 @@ class AiBlogRequest extends FormRequest
return [
'new_title.required' => '新标题不能为空',
// 'seo_title.max' => 'SEO标题不能超过70个字符',
'seo_keywords.max' => 'SEO关键词不能超过200个字符',
'seo_keywords.max' => 'SEO关键词不能超过300个字符',
'seo_description.max' => 'SEO描述不能超过200个字符',
];
}
... ...
... ... @@ -25,9 +25,9 @@ class BlogCategoryRequest extends FormRequest
{
return [
'name'=>'required|max:200',
'seo_title'=>'max:70',
'seo_keywords'=>'max:200',
'seo_description'=>'max:200',
// 'seo_title'=>'max:70',
'seo_keywords'=>'max:300',
'seo_des'=>'max:200',
];
}
... ... @@ -36,9 +36,9 @@ class BlogCategoryRequest extends FormRequest
return [
'name.required'=>'请填写名称',
'name.max'=>'名称最大200字',
'seo_title.max' => 'SEO标题不能超过70个字符',
'seo_keywords.max' => 'SEO关键词不能超过200个字符',
'seo_description.max' => 'SEO描述不能超过200个字符',
// 'seo_title.max' => 'SEO标题不能超过70个字符',
'seo_keywords.max' => 'SEO关键词不能超过300个字符',
'seo_des.max' => 'SEO描述不能超过200个字符',
];
}
}
... ...
... ... @@ -28,9 +28,8 @@ class BlogRequest extends FormRequest
'remark'=>'max:1000',
'url'=>'required',
// 'seo_title'=>'max:70',
'seo_keywords'=>'max:200',
'seo_keywords'=>'max:300',
'seo_description'=>'max:200',
// 'text'=>'max:5000',
];
}
... ... @@ -41,10 +40,9 @@ class BlogRequest extends FormRequest
'name.max'=>'名称超过最长长度200',
'url.required'=>'链接不能为空',
// 'seo_title.max' => 'SEO标题不能超过70个字符',
'seo_keywords.max' => 'SEO关键词不能超过200个字符',
'seo_keywords.max' => 'SEO关键词不能超过300个字符',
'seo_description.max' => 'SEO描述不能超过200个字符',
'remark.max'=>'描述超过最长长度1000',
// 'text.max'=>'详情内容超过最大长度',
];
}
}
... ...
... ... @@ -26,8 +26,8 @@ class NewsCategoryRequest extends FormRequest
return [
'name'=>'required|max:200',
// 'seo_title'=>'max:70',
'seo_keywords'=>'max:200',
'seo_description'=>'max:200',
'seo_keywords'=>'max:300',
'seo_des'=>'max:200',
];
}
... ... @@ -37,8 +37,8 @@ class NewsCategoryRequest extends FormRequest
'name.required'=>'请填写名称',
'name.max'=>'名称最大100字',
// 'seo_title.max' => 'SEO标题不能超过70个字符',
'seo_keywords.max' => 'SEO关键词不能超过200个字符',
'seo_description.max' => 'SEO描述不能超过200个字符',
'seo_keywords.max' => 'SEO关键词不能超过300个字符',
'seo_des.max' => 'SEO描述不能超过200个字符',
];
}
}
... ...
... ... @@ -25,10 +25,9 @@ class NewsRequest extends FormRequest
{
return [
'name'=>'required|max:200',
// 'remark'=>'max:2000',
'url'=>'required',
// 'seo_title' => 'max:70',
'seo_keywords' => 'max:200',
'seo_keywords' => 'max:300',
'seo_description' => 'max:200',
];
}
... ... @@ -39,7 +38,6 @@ class NewsRequest extends FormRequest
'name.required'=>'请填写名称',
'name.max'=>'名称超过最长长度200',
'url.required'=>'链接不能为空',
// 'remark.max'=>'描述超过最长长度2000'
// 'seo_title.max' => 'SEO标题不能超过70个字符',
'seo_keywords.max' => 'SEO关键词不能超过300个字符',
'seo_description.max' => 'SEO描述不能超过200个字符',
... ...
... ... @@ -32,9 +32,8 @@ class CategoryRequest extends FormRequest
return [
'title'=>'required|max:200',
'route'=>'required',
// 'image'=>'required',
// 'keywords'=>'max:50',
// 'describe'=>'max:200',
'seo_keywords'=>'max:300',
'seo_des'=>'max:200',
];
}
... ... @@ -44,9 +43,8 @@ class CategoryRequest extends FormRequest
'title.required' => '请输入分类名称',
'title.max' => '分类名称不能超过200个字符',
'route.required' => '路由不能为空',
// 'image.required' => '请上传分类图片',
// 'keywords.max' => '分类关键词不能超过50个字符',
// 'describe.max' => '分类描述不能超过200个字符',
'seo_keywords.max' => 'SEO关键词不能超过300个字符',
'seo_des.max' => 'SEO描述不能超过200个字符',
];
}
... ...
... ... @@ -32,7 +32,7 @@ class KeywordRequest extends FormRequest
return [
'title'=>'required|max:200',
// 'seo_title'=>'max:70',
'seo_keywords'=>'max:200',
'seo_keywords'=>'max:300',
'seo_description'=>'max:200',
'related_news_ids'=>'array|max:2',
'related_blog_ids'=>'array|max:2',
... ... @@ -45,7 +45,7 @@ class KeywordRequest extends FormRequest
'title.required' => '请输入关键词',
'title.max' => '关键词不能超过200个字符',
// 'seo_title.max' => 'SEO标题不能超过70个字符',
'seo_keywords.max' => 'SEO关键词不能超过200个字符',
'seo_keywords.max' => 'SEO关键词不能超过300个字符',
'seo_description.max' => 'SEO描述不能超过200个字符',
'related_news_ids.max' => '关联新闻不能超过两条',
'related_blog_ids.max' => '关联博客不能超过两条',
... ...