|
@@ -85,6 +85,7 @@ use App\Model\ResearchTopic;
|
|
|
use App\Model\RetopicUser;
|
|
use App\Model\RetopicUser;
|
|
|
use App\Model\WebCateinfo;
|
|
use App\Model\WebCateinfo;
|
|
|
use App\Model\SinglePage;
|
|
use App\Model\SinglePage;
|
|
|
|
|
+use App\Model\WebsiteColumn;
|
|
|
#[RpcService(name: "NewsService", protocol: "jsonrpc-http", server: "jsonrpc-http")]
|
|
#[RpcService(name: "NewsService", protocol: "jsonrpc-http", server: "jsonrpc-http")]
|
|
|
class NewsService implements NewsServiceInterface
|
|
class NewsService implements NewsServiceInterface
|
|
|
{
|
|
{
|
|
@@ -649,12 +650,19 @@ class NewsService implements NewsServiceInterface
|
|
|
if (!isset($data['catid'])) {
|
|
if (!isset($data['catid'])) {
|
|
|
throw new \Exception('缺少必要字段:catid');
|
|
throw new \Exception('缺少必要字段:catid');
|
|
|
}
|
|
}
|
|
|
|
|
+ $column_arr = WebsiteColumn::where('column_name','官网')->pluck('id')->toArray();
|
|
|
// 查找网站,若是核心站则返回字段is_core=1,否则返回is_core=0,若是不存在此网站则为is_core=2
|
|
// 查找网站,若是核心站则返回字段is_core=1,否则返回is_core=0,若是不存在此网站则为is_core=2
|
|
|
$web = WebsiteCategory::where('category_id', $data['catid'])
|
|
$web = WebsiteCategory::where('category_id', $data['catid'])
|
|
|
->leftJoin('website', 'website_category.website_id', '=', 'website.id')
|
|
->leftJoin('website', 'website_category.website_id', '=', 'website.id')
|
|
|
->select(
|
|
->select(
|
|
|
'website_id',
|
|
'website_id',
|
|
|
- Db::raw('CASE WHEN website.id IS NULL THEN 2 WHEN JSON_CONTAINS(website.`website_column_arr_id`, \'3\') THEN 1 ELSE 0 END as is_core')
|
|
|
|
|
|
|
+ DB::raw('
|
|
|
|
|
+ CASE
|
|
|
|
|
+ WHEN website.id IS NULL THEN 2
|
|
|
|
|
+ WHEN website.website_column_id IN ('.implode(',', $column_arr).') THEN 1
|
|
|
|
|
+ ELSE 0
|
|
|
|
|
+ END as is_core
|
|
|
|
|
+ ')
|
|
|
)
|
|
)
|
|
|
->get();
|
|
->get();
|
|
|
// $id = 225; -----测试开启
|
|
// $id = 225; -----测试开启
|
|
@@ -1132,14 +1140,21 @@ class NewsService implements NewsServiceInterface
|
|
|
// 若是审核通过 则更新c_show_time
|
|
// 若是审核通过 则更新c_show_time
|
|
|
if ($data['status'] == 1) {
|
|
if ($data['status'] == 1) {
|
|
|
// 查找网站,若是核心站则返回字段is_core=1,否则返回is_core=0,若是不存在此网站则为is_core=2
|
|
// 查找网站,若是核心站则返回字段is_core=1,否则返回is_core=0,若是不存在此网站则为is_core=2
|
|
|
- $web = Article::where('article.id', $data['id'])
|
|
|
|
|
- ->leftJoin('website_category', 'article.catid', 'website_category.category_id')
|
|
|
|
|
- ->leftJoin('website', 'website_category.website_id', '=', 'website.id')
|
|
|
|
|
- ->select(
|
|
|
|
|
- 'website_id',
|
|
|
|
|
- Db::raw('CASE WHEN website.id IS NULL THEN 2 WHEN JSON_CONTAINS(website.`website_column_arr_id`, \'3\') THEN 1 ELSE 0 END as is_core')
|
|
|
|
|
- )
|
|
|
|
|
- ->get();
|
|
|
|
|
|
|
+ $column_arr = WebsiteColumn::where('column_name','官网')->pluck('id')->toArray();
|
|
|
|
|
+ // 查找网站,若是核心站则返回字段is_core=1,否则返回is_core=0,若是不存在此网站则为is_core=2
|
|
|
|
|
+ $web = WebsiteCategory::where('category_id', $data['catid'])
|
|
|
|
|
+ ->leftJoin('website', 'website_category.website_id', '=', 'website.id')
|
|
|
|
|
+ ->select(
|
|
|
|
|
+ 'website_id',
|
|
|
|
|
+ DB::raw('
|
|
|
|
|
+ CASE
|
|
|
|
|
+ WHEN website.id IS NULL THEN 2
|
|
|
|
|
+ WHEN website.website_column_id IN ('.implode(',', $column_arr).') THEN 1
|
|
|
|
|
+ ELSE 0
|
|
|
|
|
+ END as is_core
|
|
|
|
|
+ ')
|
|
|
|
|
+ )
|
|
|
|
|
+ ->get();
|
|
|
// 非核心站与核心站----显示时间-----间隔
|
|
// 非核心站与核心站----显示时间-----间隔
|
|
|
$time = 20;
|
|
$time = 20;
|
|
|
// 若不是采集来的文章,则非核心站之间的间隔时间为5分钟;初始时间与当前时间差二十分钟
|
|
// 若不是采集来的文章,则非核心站之间的间隔时间为5分钟;初始时间与当前时间差二十分钟
|
|
@@ -9807,9 +9822,9 @@ class NewsService implements NewsServiceInterface
|
|
|
->when(!empty($where), function ($query) use ($where) {
|
|
->when(!empty($where), function ($query) use ($where) {
|
|
|
$query->where($where);
|
|
$query->where($where);
|
|
|
})
|
|
})
|
|
|
- ->when(!empty($data['catid']), function ($query) use ($data) {
|
|
|
|
|
- $query->where('catid', $data['catid']);
|
|
|
|
|
- })
|
|
|
|
|
|
|
+ // ->when(!isset($data['catid']), function ($query) use ($data) {
|
|
|
|
|
+ // $query->where('catid', $data['catid']);
|
|
|
|
|
+ // })
|
|
|
->where('status', 1)
|
|
->where('status', 1)
|
|
|
->select(['id', 'title', 'catid','status','website_id','updated_at'])
|
|
->select(['id', 'title', 'catid','status','website_id','updated_at'])
|
|
|
->orderBy('updated_at', 'desc')
|
|
->orderBy('updated_at', 'desc')
|