|
|
@@ -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']);
|
|
|
@@ -2729,35 +2730,36 @@ class NewsService implements NewsServiceInterface
|
|
|
'website_category.alias as category_name',
|
|
|
DB::raw("CASE WHEN book.cat_id = $parentCatId THEN '$parent_pinyin'
|
|
|
ELSE CONCAT('$parent_pinyin', '/', website_category.aLIas_pinyin) END as pinyin")
|
|
|
- )
|
|
|
- ->orderBy('updated_at', 'desc')
|
|
|
- ->limit($parentImgNum)
|
|
|
- ->get()->all();
|
|
|
- // 查询文字新闻
|
|
|
- }
|
|
|
- if ($parentTextNum != 0) {
|
|
|
- $textBooks = [];
|
|
|
- $textBooks = Book::where(function ($query) use ($parentCatId) {
|
|
|
- $query->whereRaw("JSON_CONTAINS(cat_arr_id, '\"$parentCatId\"')")
|
|
|
- ->orWhereRaw("JSON_CONTAINS(cat_arr_id, '$parentCatId')");
|
|
|
- })
|
|
|
- ->where('book.status', 2)
|
|
|
- ->leftJoin('website_category', function ($join) use ($website) {
|
|
|
- $join->on('book.cat_id', '=', 'website_category.category_id')
|
|
|
- ->where('website_category.website_id', '=', $website['website_id']);
|
|
|
- })
|
|
|
- ->select(
|
|
|
- 'book.id',
|
|
|
- 'book.title',
|
|
|
- 'book.img_url',
|
|
|
- 'book.price',
|
|
|
- 'book.market_price',
|
|
|
- 'book.description',
|
|
|
- 'book.cat_id',
|
|
|
- 'book.description',
|
|
|
- 'book.updated_at',
|
|
|
- 'website_category.alias as category_name',
|
|
|
- DB::raw("CASE WHEN book.cat_id = $parentCatId THEN '$parent_pinyin'
|
|
|
+ )
|
|
|
+ ->orderBy('updated_at', 'desc')
|
|
|
+ ->limit($parentImgNum)
|
|
|
+ ->get()->all();
|
|
|
+ // 查询文字新闻
|
|
|
+ }
|
|
|
+ if($parentTextNum!=0){
|
|
|
+ $textBooks = [];
|
|
|
+ $textBooks = Book::where(function($query) use ($parentCatId) {
|
|
|
+ $query->whereRaw("JSON_CONTAINS(cat_arr_id, '\"$parentCatId\"')")
|
|
|
+ ->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']);
|
|
|
+ })
|
|
|
+ ->select(
|
|
|
+ 'book.id',
|
|
|
+ 'book.title',
|
|
|
+ 'book.img_url',
|
|
|
+ 'book.price',
|
|
|
+ 'book.market_price',
|
|
|
+ 'book.description',
|
|
|
+ 'book.cat_id',
|
|
|
+ 'book.description',
|
|
|
+ 'book.updated_at',
|
|
|
+ 'website_category.alias as category_name',
|
|
|
+ DB::raw("CASE WHEN book.cat_id = $parentCatId THEN '$parent_pinyin'
|
|
|
ELSE CONCAT('$parent_pinyin', '/', website_category.aLIas_pinyin) END as pinyin")
|
|
|
)
|
|
|
->orderBy('updated_at', 'desc')
|