|
|
@@ -2712,6 +2712,7 @@ class NewsService implements NewsServiceInterface
|
|
|
})
|
|
|
->where('book.status', 2)
|
|
|
->where('book.img_url', '!=', '')
|
|
|
+ ->where('book.website_id', $website['website_id'])
|
|
|
->leftJoin('website_category', function ($join) use ($website) {
|
|
|
$join->on('book.cat_id', '=', 'website_category.category_id')
|
|
|
->where('website_category.website_id', '=', $website['website_id']);
|
|
|
@@ -2742,6 +2743,7 @@ class NewsService implements NewsServiceInterface
|
|
|
->orWhereRaw("JSON_CONTAINS(cat_arr_id, '$parentCatId')");
|
|
|
})
|
|
|
->where('book.status', 2)
|
|
|
+ ->where('book.website_id', $website['website_id'])
|
|
|
->leftJoin('website_category', function ($join) use ($website) {
|
|
|
$join->on('book.cat_id', '=', 'website_category.category_id')
|
|
|
->where('website_category.website_id', '=', $website['website_id']);
|
|
|
@@ -2794,6 +2796,7 @@ class NewsService implements NewsServiceInterface
|
|
|
$childImgArticles = Book::where('cat_id', $childCatId)
|
|
|
->where('status', 2)
|
|
|
->where('img_url', '!=', '')
|
|
|
+ ->where('book.website_id', $website['website_id'])
|
|
|
->leftJoin('website_category', function ($join) use ($website) {
|
|
|
$join->on('book.cat_id', '=', 'website_category.category_id')
|
|
|
->where('website_category.website_id', '=', $website['website_id']);
|
|
|
@@ -2816,6 +2819,7 @@ class NewsService implements NewsServiceInterface
|
|
|
// 查询子栏目文字新闻
|
|
|
$childTextArticles = Book::where('cat_id', $childCatId)
|
|
|
->where('status', 2)
|
|
|
+ ->where('book.website_id', $website['website_id'])
|
|
|
->leftJoin('website_category', function ($join) use ($website) {
|
|
|
$join->on('book.cat_id', '=', 'website_category.category_id')
|
|
|
->where('website_category.website_id', '=', $website['website_id']);
|
|
|
@@ -3133,6 +3137,7 @@ class NewsService implements NewsServiceInterface
|
|
|
'job_company.business_name',
|
|
|
'job_recruiting.keyword',
|
|
|
'job_recruiting.description',
|
|
|
+ 'job_recruiting.seo_description',
|
|
|
)
|
|
|
->orderBy('updated_at', 'desc')
|
|
|
->limit($data['job2_num'])
|
|
|
@@ -3208,6 +3213,7 @@ class NewsService implements NewsServiceInterface
|
|
|
'job_company.business_name',
|
|
|
'job_recruiting.keyword',
|
|
|
'job_recruiting.description',
|
|
|
+ 'job_recruiting.seo_description',
|
|
|
)
|
|
|
->orderBy('job_recruiting.updated_at', 'desc');
|
|
|
$recruit_count = $query->count();
|
|
|
@@ -3577,7 +3583,7 @@ class NewsService implements NewsServiceInterface
|
|
|
$query->where('user_id', $user['id']);
|
|
|
})
|
|
|
->where('status', 1)
|
|
|
- ->select('id', 'title', 'website_id', 'user_id', 'updated_at','keyword','catid','description')
|
|
|
+ ->select('id', 'title', 'website_id', 'user_id', 'updated_at','keyword','catid','description','seo_description')
|
|
|
->orderBy('updated_at', 'desc')
|
|
|
->limit($data['pageSize'])
|
|
|
->get();
|
|
|
@@ -5215,7 +5221,21 @@ class NewsService implements NewsServiceInterface
|
|
|
$segList1 = array_slice($segList, 0, 8);
|
|
|
$data['keyword'] = implode(',', $segList1);
|
|
|
}
|
|
|
-
|
|
|
+ if(!isset($data['eso_description']) || empty($data['eso_description'])){
|
|
|
+ $content = $data['description'];
|
|
|
+ // 去除 <style> 和 <script> 标签及其内容
|
|
|
+ $content = preg_replace('/<(style|script)[^>]*>.*?<\/\1>/is', '', $content);
|
|
|
+ // 去除所有 HTML 标签
|
|
|
+ $content = strip_tags($content);
|
|
|
+ // 去除 HTML 实体
|
|
|
+ $content = html_entity_decode($content, ENT_QUOTES | ENT_HTML5, 'UTF-8');
|
|
|
+ // 只保留文本和标点符号(去除所有字母数字以外的特殊符号,可根据需要调整正则)
|
|
|
+ $content = preg_replace('/[^\p{L}\p{N}\p{P}\p{Zs}]+/u', '', $content);
|
|
|
+ // 去除多余空白
|
|
|
+ $content = preg_replace('/\s+/u', '', $content);
|
|
|
+ // 截取 100 个字符
|
|
|
+ $data['eso_descriprion'] = mb_substr($content, 0, 100);
|
|
|
+ }
|
|
|
|
|
|
// return Result::success($user);
|
|
|
$data['action_id'] = $data['user_id'] ?? null;
|
|
|
@@ -5385,6 +5405,21 @@ class NewsService implements NewsServiceInterface
|
|
|
$segList1 = array_slice($segList, 0, 8);
|
|
|
$data['keyword'] = implode(',', $segList1);
|
|
|
}
|
|
|
+ if(!isset($data['eso_description']) || empty($data['eso_description'])){
|
|
|
+ $content = $data['description'];
|
|
|
+ // 去除 <style> 和 <script> 标签及其内容
|
|
|
+ $content = preg_replace('/<(style|script)[^>]*>.*?<\/\1>/is', '', $content);
|
|
|
+ // 去除所有 HTML 标签
|
|
|
+ $content = strip_tags($content);
|
|
|
+ // 去除 HTML 实体
|
|
|
+ $content = html_entity_decode($content, ENT_QUOTES | ENT_HTML5, 'UTF-8');
|
|
|
+ // 只保留文本和标点符号(去除所有字母数字以外的特殊符号,可根据需要调整正则)
|
|
|
+ $content = preg_replace('/[^\p{L}\p{N}\p{P}\p{Zs}]+/u', '', $content);
|
|
|
+ // 去除多余空白
|
|
|
+ $content = preg_replace('/\s+/u', '', $content);
|
|
|
+ // 截取 100 个字符
|
|
|
+ $data['eso_descriprion'] = mb_substr($content, 0, 100);
|
|
|
+ }
|
|
|
$data['cat_arr_id'] = array_values(array_unique($data['cat_arr_id']));
|
|
|
if(isset($data['cat_arr_id']) && !empty($data['cat_arr_id']) && is_array($data['cat_arr_id'])){
|
|
|
$data['catid'] = end($data['cat_arr_id']);
|