|
|
@@ -55,7 +55,7 @@ class ClientService implements ClientServiceInterface
|
|
|
// 调整获取方式
|
|
|
// 根据网站id获取,从website_template中获取 website_template
|
|
|
$website_id = $data['website_id'] ?? 2;
|
|
|
- var_dump("网站id:", $website_id);
|
|
|
+ $getpage = $data['getpage'] ?? 'index';
|
|
|
$template = Db::table('website_template')->where('website_id', $website_id)->first();
|
|
|
var_dump("模板:", $template);
|
|
|
$template = $template->template_data;
|
|
|
@@ -122,7 +122,7 @@ class ClientService implements ClientServiceInterface
|
|
|
|
|
|
//获取
|
|
|
// $getpage = $data['base']['getpage'] ?? 'index';
|
|
|
- $getpage = $data['getpage'] ?? 'index';
|
|
|
+
|
|
|
|
|
|
var_dump($getpage, 'leixing ');
|
|
|
// index = 首页
|
|
|
@@ -176,8 +176,22 @@ class ClientService implements ClientServiceInterface
|
|
|
if ($imgSize > 0) {
|
|
|
$imgArticles = Db::table('article')
|
|
|
->leftJoin('article_ignore', function ($join) use ($website_id) {
|
|
|
- $join->on('article.id', '=', 'article_ignore.article_id')->where('article_ignore.website_id', '=', $website_id);
|
|
|
- })->whereNull('article_ignore.article_id')->whereIn('catid', $temp_arr = array_merge([$category_id], $cat_1st_arr[$category_id]))->where('status', 1)
|
|
|
+ $join->on('article.id', '=', 'article_ignore.article_id')
|
|
|
+ ->where('article_ignore.website_id', '=', $website_id);
|
|
|
+ })
|
|
|
+ // ->whereNull('article_ignore.article_id')
|
|
|
+ ->where(function ($query) {
|
|
|
+ $query->whereNull('article_ignore.article_id')
|
|
|
+ ->orWhere(function ($subQuery) {
|
|
|
+ $subQuery->whereNotNull('article_ignore.article_id')
|
|
|
+ ->where('article_ignore.is_ignore', 0)
|
|
|
+ ->where(function ($subSubQuery) {
|
|
|
+ $subSubQuery->where('article_ignore.c_show_time', '<=', date('Y-m-d H:i:s'))
|
|
|
+ ->orWhereNull('article_ignore.c_show_time');
|
|
|
+ });
|
|
|
+ });
|
|
|
+ })
|
|
|
+ ->whereIn('catid', $temp_arr = array_merge([$category_id], $cat_1st_arr[$category_id]))->where('status', 1)
|
|
|
|
|
|
|
|
|
->whereNotNull('imgurl')->where('imgurl', '!=', '')->limit($imgSize)->orderBy('updated_at', 'desc')->get()->toArray();
|
|
|
@@ -192,8 +206,21 @@ class ClientService implements ClientServiceInterface
|
|
|
$textArticles = Db::table('article')
|
|
|
->leftJoin('article_ignore', function ($join) use ($website_id) {
|
|
|
$join->on('article.id', '=', 'article_ignore.article_id')->where('article_ignore.website_id', '=', $website_id);
|
|
|
- })->whereNull('article_ignore.article_id')->whereIn('catid', $temp_arr = array_merge([$category_id], $cat_1st_arr[$category_id]))->where('status', 1)
|
|
|
-
|
|
|
+ })
|
|
|
+ // ->whereNull('article_ignore.article_id')
|
|
|
+ ->where(function ($query) {
|
|
|
+ $query->whereNull('article_ignore.article_id')
|
|
|
+ ->orWhere(function ($subQuery) {
|
|
|
+ $subQuery->whereNotNull('article_ignore.article_id')
|
|
|
+ ->where('article_ignore.is_ignore', 0)
|
|
|
+ ->where(function ($subSubQuery) {
|
|
|
+ $subSubQuery->where('article_ignore.c_show_time', '<=', date('Y-m-d H:i:s'))
|
|
|
+ ->orWhereNull('article_ignore.c_show_time');
|
|
|
+ });
|
|
|
+ });
|
|
|
+ })
|
|
|
+ ->whereIn('catid', $temp_arr = array_merge([$category_id], $cat_1st_arr[$category_id]))
|
|
|
+ ->where('status', 1)
|
|
|
->where('status', 1)->limit($textSize)->orderBy('updated_at', 'desc')->get()->toArray();
|
|
|
//拼接上拼音
|
|
|
foreach ($textArticles as $k => $v) {
|
|
|
@@ -210,7 +237,19 @@ class ClientService implements ClientServiceInterface
|
|
|
$imgArticles = Db::table('article')
|
|
|
->leftJoin('article_ignore', function ($join) use ($website_id) {
|
|
|
$join->on('article.id', '=', 'article_ignore.article_id')->where('article_ignore.website_id', '=', $website_id);
|
|
|
- })->whereNull('article_ignore.article_id')
|
|
|
+ })
|
|
|
+ // ->whereNull('article_ignore.article_id')
|
|
|
+ ->where(function ($query) {
|
|
|
+ $query->whereNull('article_ignore.article_id')
|
|
|
+ ->orWhere(function ($subQuery) {
|
|
|
+ $subQuery->whereNotNull('article_ignore.article_id')
|
|
|
+ ->where('article_ignore.is_ignore', 0)
|
|
|
+ ->where(function ($subSubQuery) {
|
|
|
+ $subSubQuery->where('article_ignore.c_show_time', '<=', date('Y-m-d H:i:s'))
|
|
|
+ ->orWhereNull('article_ignore.c_show_time');
|
|
|
+ });
|
|
|
+ });
|
|
|
+ })
|
|
|
->whereRaw('MATCH(level_text) AGAINST(? IN NATURAL LANGUAGE MODE)', [$level])->where('status', 1)->whereIn('catid', $categoryIds)->whereNotNull('imgurl')->where('imgurl', '!=', '')->limit($imgSize)->orderBy('updated_at', 'desc')->get()->toArray();
|
|
|
//拼接上拼音
|
|
|
foreach ($imgArticles as $k => $v) {
|
|
|
@@ -222,7 +261,19 @@ class ClientService implements ClientServiceInterface
|
|
|
$textArticles = Db::table('article')->where('status', 1)
|
|
|
->leftJoin('article_ignore', function ($join) use ($website_id) {
|
|
|
$join->on('article.id', '=', 'article_ignore.article_id')->where('article_ignore.website_id', '=', $website_id);
|
|
|
- })->whereNull('article_ignore.article_id')
|
|
|
+ })
|
|
|
+ // ->whereNull('article_ignore.article_id')
|
|
|
+ ->where(function ($query) {
|
|
|
+ $query->whereNull('article_ignore.article_id')
|
|
|
+ ->orWhere(function ($subQuery) {
|
|
|
+ $subQuery->whereNotNull('article_ignore.article_id')
|
|
|
+ ->where('article_ignore.is_ignore', 0)
|
|
|
+ ->where(function ($subSubQuery) {
|
|
|
+ $subSubQuery->where('article_ignore.c_show_time', '<=', date('Y-m-d H:i:s'))
|
|
|
+ ->orWhereNull('article_ignore.c_show_time');
|
|
|
+ });
|
|
|
+ });
|
|
|
+ })
|
|
|
->whereRaw('MATCH(level_text) AGAINST(? IN NATURAL LANGUAGE MODE)', [$level])->whereIn('catid', $categoryIds)->limit($textSize)->orderBy('updated_at', 'desc')->get()->toArray();
|
|
|
//拼接上拼音
|
|
|
foreach ($textArticles as $k => $v) {
|
|
|
@@ -293,6 +344,9 @@ class ClientService implements ClientServiceInterface
|
|
|
//将修改后的数据放到template里
|
|
|
break;
|
|
|
case 'class':
|
|
|
+ if(!isset($data['template']['class']['data'][0]['componentList'])){
|
|
|
+ break;
|
|
|
+ }
|
|
|
$componetList = $data['template']['class']['data'][0]['componentList'];
|
|
|
$class_count = count($componetList);
|
|
|
$parent_id = $data['template']['class']['parent_id'] ?? 0;
|
|
|
@@ -333,6 +387,20 @@ class ClientService implements ClientServiceInterface
|
|
|
->where('catid', $category_id)
|
|
|
->whereNotNull('imgurl')
|
|
|
->limit($imgSize)
|
|
|
+ ->leftJoin('article_ignore', function ($join) use ($website_id) {
|
|
|
+ $join->on('article.id', '=', 'article_ignore.article_id')->where('article_ignore.website_id', '=', $website_id);
|
|
|
+ })
|
|
|
+ ->where(function ($query) {
|
|
|
+ $query->whereNull('article_ignore.article_id')
|
|
|
+ ->orWhere(function ($subQuery) {
|
|
|
+ $subQuery->whereNotNull('article_ignore.article_id')
|
|
|
+ ->where('article_ignore.is_ignore', 0)
|
|
|
+ ->where(function ($subSubQuery) {
|
|
|
+ $subSubQuery->where('article_ignore.c_show_time', '<=', date('Y-m-d H:i:s'))
|
|
|
+ ->orWhereNull('article_ignore.c_show_time');
|
|
|
+ });
|
|
|
+ });
|
|
|
+ })
|
|
|
// ->select($listType)
|
|
|
->orderBy('updated_at', 'desc')
|
|
|
->get()
|
|
|
@@ -346,6 +414,20 @@ class ClientService implements ClientServiceInterface
|
|
|
->where('catid', $category_id)
|
|
|
->whereNull('imgurl')
|
|
|
->limit($textSize)
|
|
|
+ ->leftJoin('article_ignore', function ($join) use ($website_id) {
|
|
|
+ $join->on('article.id', '=', 'article_ignore.article_id')->where('article_ignore.website_id', '=', $website_id);
|
|
|
+ })
|
|
|
+ ->where(function ($query) {
|
|
|
+ $query->whereNull('article_ignore.article_id')
|
|
|
+ ->orWhere(function ($subQuery) {
|
|
|
+ $subQuery->whereNotNull('article_ignore.article_id')
|
|
|
+ ->where('article_ignore.is_ignore', 0)
|
|
|
+ ->where(function ($subSubQuery) {
|
|
|
+ $subSubQuery->where('article_ignore.c_show_time', '<=', date('Y-m-d H:i:s'))
|
|
|
+ ->orWhereNull('article_ignore.c_show_time');
|
|
|
+ });
|
|
|
+ });
|
|
|
+ })
|
|
|
->orderBy('updated_at', 'desc')
|
|
|
->get()
|
|
|
->toArray();
|
|
|
@@ -363,6 +445,9 @@ class ClientService implements ClientServiceInterface
|
|
|
}
|
|
|
break;
|
|
|
case 'list':
|
|
|
+ if(!isset($data['template']['list']['data'][0]['componentList'])){
|
|
|
+ break;
|
|
|
+ }
|
|
|
$componetListdata = $data['template']['list']['data'];
|
|
|
$category_id = $data['template']['list']['category_id'] ?? 0;
|
|
|
|
|
|
@@ -381,7 +466,20 @@ class ClientService implements ClientServiceInterface
|
|
|
$listType = $componentData['listType'];
|
|
|
$articals = Db::table('article')
|
|
|
->where('catid', $category_id)
|
|
|
- ->where('status', 1)
|
|
|
+ ->where('status', 1)->leftJoin('article_ignore', function ($join) use ($website_id) {
|
|
|
+ $join->on('article.id', '=', 'article_ignore.article_id')->where('article_ignore.website_id', '=', $website_id);
|
|
|
+ })
|
|
|
+ ->where(function ($query) {
|
|
|
+ $query->whereNull('article_ignore.article_id')
|
|
|
+ ->orWhere(function ($subQuery) {
|
|
|
+ $subQuery->whereNotNull('article_ignore.article_id')
|
|
|
+ ->where('article_ignore.is_ignore', 0)
|
|
|
+ ->where(function ($subSubQuery) {
|
|
|
+ $subSubQuery->where('article_ignore.c_show_time', '<=', date('Y-m-d H:i:s'))
|
|
|
+ ->orWhereNull('article_ignore.c_show_time');
|
|
|
+ });
|
|
|
+ });
|
|
|
+ })
|
|
|
->orderBy('updated_at', 'desc')
|
|
|
->get();
|
|
|
// ->paginate($pageSize, ['*'], 'page', $page);
|
|
|
@@ -411,6 +509,20 @@ class ClientService implements ClientServiceInterface
|
|
|
$imgArticles = Db::table('article')
|
|
|
->where('catid', $category_id)
|
|
|
->whereNotNull('imgurl')
|
|
|
+ ->where('status', 1)->leftJoin('article_ignore', function ($join) use ($website_id) {
|
|
|
+ $join->on('article.id', '=', 'article_ignore.article_id')->where('article_ignore.website_id', '=', $website_id);
|
|
|
+ })
|
|
|
+ ->where(function ($query) {
|
|
|
+ $query->whereNull('article_ignore.article_id')
|
|
|
+ ->orWhere(function ($subQuery) {
|
|
|
+ $subQuery->whereNotNull('article_ignore.article_id')
|
|
|
+ ->where('article_ignore.is_ignore', 0)
|
|
|
+ ->where(function ($subSubQuery) {
|
|
|
+ $subSubQuery->where('article_ignore.c_show_time', '<=', date('Y-m-d H:i:s'))
|
|
|
+ ->orWhereNull('article_ignore.c_show_time');
|
|
|
+ });
|
|
|
+ });
|
|
|
+ })
|
|
|
->limit($imgSize)
|
|
|
->orderBy('updated_at', 'desc')
|
|
|
->get()
|
|
|
@@ -425,6 +537,20 @@ class ClientService implements ClientServiceInterface
|
|
|
$textArticles = Db::table('article')
|
|
|
->where('catid', $category_id)
|
|
|
->whereNull('imgurl')
|
|
|
+ ->where('status', 1)->leftJoin('article_ignore', function ($join) use ($website_id) {
|
|
|
+ $join->on('article.id', '=', 'article_ignore.article_id')->where('article_ignore.website_id', '=', $website_id);
|
|
|
+ })
|
|
|
+ ->where(function ($query) {
|
|
|
+ $query->whereNull('article_ignore.article_id')
|
|
|
+ ->orWhere(function ($subQuery) {
|
|
|
+ $subQuery->whereNotNull('article_ignore.article_id')
|
|
|
+ ->where('article_ignore.is_ignore', 0)
|
|
|
+ ->where(function ($subSubQuery) {
|
|
|
+ $subSubQuery->where('article_ignore.c_show_time', '<=', date('Y-m-d H:i:s'))
|
|
|
+ ->orWhereNull('article_ignore.c_show_time');
|
|
|
+ });
|
|
|
+ });
|
|
|
+ })
|
|
|
->limit($textSize)
|
|
|
->orderBy('updated_at', 'desc')
|
|
|
->get()
|
|
|
@@ -448,6 +574,9 @@ class ClientService implements ClientServiceInterface
|
|
|
|
|
|
break;
|
|
|
case 'article':
|
|
|
+ if(!isset($data['template']['article']['data'])){
|
|
|
+ break;
|
|
|
+ }
|
|
|
$article_id = 51434; //假设这是文章ID
|
|
|
$componetListdata = &$data['template']['article']['data'];
|
|
|
var_dump($categoryIds, '----------------');
|