Kaynağa Gözat

修改对应书刊表的catid字段名称

15313670163 2 gün önce
ebeveyn
işleme
4919ca1851
1 değiştirilmiş dosya ile 27 ekleme ve 27 silme
  1. 27 27
      app/JsonRpc/NewsService.php

+ 27 - 27
app/JsonRpc/NewsService.php

@@ -1826,7 +1826,7 @@ class NewsService implements NewsServiceInterface
                             ->where('book.status', 2)
                             ->where('book.img_url', '!=', '')
                             ->leftJoin('website_category', function($join) use ($website) {
-                                $join->on('book.catid', '=', 'website_category.category_id')
+                                $join->on('book.cat_id', '=', 'website_category.category_id')
                                     ->where('website_category.website_id', '=', $website['website_id']);
                             })
                             ->select(
@@ -1836,11 +1836,11 @@ class NewsService implements NewsServiceInterface
                                 'book.price',
                                 'book.market_price',
                                 'book.description',
-                                'book.catid',
+                                'book.cat_id',
                                 'book.description',
                                 'book.updated_at',
                                 'website_category.alias as category_name',
-                                DB::raw("CASE WHEN book.catid = $parentCatId THEN '$parent_pinyin' 
+                                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')
@@ -1856,7 +1856,7 @@ class NewsService implements NewsServiceInterface
                             })
                             ->where('book.status', 2)
                             ->leftJoin('website_category', function($join) use ($website) {
-                                $join->on('book.catid', '=', 'website_category.category_id')
+                                $join->on('book.cat_id', '=', 'website_category.category_id')
                                     ->where('website_category.website_id', '=', $website['website_id']);
                             })
                             ->select(
@@ -1866,11 +1866,11 @@ class NewsService implements NewsServiceInterface
                                 'book.price',
                                 'book.market_price',
                                 'book.description',
-                                'book.catid',
+                                'book.cat_id',
                                 'book.description',
                                 'book.updated_at',
                                 'website_category.alias as category_name',
-                                DB::raw("CASE WHEN book.catid = $parentCatId THEN '$parent_pinyin' 
+                                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')
@@ -1904,11 +1904,11 @@ class NewsService implements NewsServiceInterface
                     }else{
                         $child_pinyin = $childCategoryInfo->aLIas_pinyin? $childCategoryInfo->aLIas_pinyin : null;
                         // 查询子栏目图片新闻
-                        $childImgArticles = Book::where('catid', $childCatId)
+                        $childImgArticles = Book::where('cat_id', $childCatId)
                             ->where('status', 2)
                             ->where('img_url', '!=', '')
                             ->leftJoin('website_category', function($join) use ($website) {
-                                $join->on('book.catid', '=', 'website_category.category_id')
+                                $join->on('book.cat_id', '=', 'website_category.category_id')
                                     ->where('website_category.website_id', '=', $website['website_id']);
                             })
                             ->select(
@@ -1918,7 +1918,7 @@ class NewsService implements NewsServiceInterface
                                 'book.price',
                                 'book.market_price',
                                 'book.description',
-                                'book.catid',
+                                'book.cat_id',
                                 'book.description',
                                 'book.updated_at',
                                 DB::raw("'$child_pinyin' as pinyin"))
@@ -1926,10 +1926,10 @@ class NewsService implements NewsServiceInterface
                             ->limit($childImgNum)
                             ->get()->all();
                             // 查询子栏目文字新闻
-                        $childTextArticles = Book::where('catid', $childCatId)
+                        $childTextArticles = Book::where('cat_id', $childCatId)
                             ->where('status', 2)
                             ->leftJoin('website_category', function($join) use ($website) {
-                                $join->on('book.catid', '=', 'website_category.category_id')
+                                $join->on('book.cat_id', '=', 'website_category.category_id')
                                     ->where('website_category.website_id', '=', $website['website_id']);
                             })
                             ->select(
@@ -1939,7 +1939,7 @@ class NewsService implements NewsServiceInterface
                                 'book.price',
                                 'book.market_price',
                                 'book.description',
-                                'book.catid',
+                                'book.cat_id',
                                 'book.description',
                                 'book.updated_at',
                                 DB::raw("'$child_pinyin' as pinyin"))
@@ -1994,14 +1994,14 @@ class NewsService implements NewsServiceInterface
         }
         $query = Book::where('book.status', 2)
             ->where('book.website_id', $data['website_id'])
-            ->where('book.catid', $catid)
+            ->where('book.cat_id', $catid)
             ->select(
                 'book.id',
                 'book.title',
                 'book.img_url',
                 'book.description',
                 'book.updated_at',
-                'book.catid',
+                'book.cat_id',
                 DB::raw("'$pinyin' as pinyin")
             )
             ->orderBy('book.updated_at', 'desc');
@@ -2032,10 +2032,10 @@ class NewsService implements NewsServiceInterface
         if(empty($web)){
             return Result::error("查询失败", 0);
         }
-        $category = WebsiteCategory::where('website_id', $data['website_id'])->where('pid',$data['id'])->orderBy('sort')->first(['pid','category_id']);
-        if(empty($category)){
-            return Result::error("查询失败", 0);
-        }
+        // $category = WebsiteCategory::where('website_id', $data['website_id'])->where('pid',$data['id'])->orderBy('sort')->first(['pid','category_id']);
+        // if(empty($category)){
+        //     return Result::error("查询失败", 0);
+        // }
         $book = Book::where('status', 2)
             ->where('website_id', $data['website_id'])
             ->where('id', $data['id'])
@@ -2047,15 +2047,15 @@ class NewsService implements NewsServiceInterface
         if(empty($book)){
             return Result::error("查询失败", 0);
         }
-        $categorys = WebsiteCategory::where('website_id', $data['website_id'])
-        ->where('pid',$category['pid'])
-        ->select('category_id','alias','aLIas_pinyin')
-        ->orderBy('sort')->get()->all();
-        $result = [
-            'category' => $categorys,
-            'books' => $book,
-        ];
-        return Result::success($result);
+        // $categorys = WebsiteCategory::where('website_id', $data['website_id'])
+        // ->where('pid',$book['cat_id'])
+        // ->select('category_id','alias','aLIas_pinyin')
+        // ->orderBy('sort')->get()->all();
+        // $result = [
+        //     // 'category' => $categorys,
+        //     'books' => $book,
+        // ];
+        return Result::success($book);
     }
      /**
      * 尝试