Jelajahi Sumber

修改c端接口:获取栏目、获取某个栏目、获取栏目的seo

rkljw 4 bulan lalu
induk
melakukan
f9fbd781bb
1 mengubah file dengan 6 tambahan dan 2 penghapusan
  1. 6 2
      app/JsonRpc/WebsiteService.php

+ 6 - 2
app/JsonRpc/WebsiteService.php

@@ -772,6 +772,7 @@ class WebsiteService implements WebsiteServiceInterface
             } else {
                 $pidMap = $pidResults->keyBy('pid');
                 $result->each(function ($record) use ($pidMap) {
+                    $record->aLIas_pinyin = $record->path;
                     if ($pidMap->has($record->category_id)) {
                         $pidResult = $pidMap->get($record->category_id);
                         $record->chilid_id = $pidResult->category_id;
@@ -2160,6 +2161,7 @@ class WebsiteService implements WebsiteServiceInterface
         if (empty($result)) {
             return Result::error("暂无导航", 0);
         }
+        $result['aLIas_pinyin'] = $result['path'] ?? '';
         $result['website_name'] = $website['website_name'] ?? '';
         $result['suffix'] = $website['suffix'] ?? '';
         return Result::success($result);
@@ -2181,8 +2183,10 @@ class WebsiteService implements WebsiteServiceInterface
             if (empty($category)) {
                 return Result::error("暂无此导航", 0);
             }
-            $category['children_count'] = WebsiteCategory::where('website_id', $data['website_id'])->where('pid', $data['category_id'])->count();
-            $parent = WebsiteCategory::where('website_id', $data['website_id'])->where('category_id', $category['pid'])->select('category_id as parent_id', 'alias as parent_name', 'aLIas_pinyin')->first();
+            $category['children_count'] = WebsiteCategory::where('website_id',$data['website_id'])->where('pid',$data['category_id'])->count();
+            $parent = WebsiteCategory::where('website_id',$data['website_id'])->where('category_id',$category['pid'])->select('category_id as parent_id','alias as parent_name','aLIas_pinyin')->first();
+            // return Result::success($parent);
+            $category['aLIas_pinyin'] = $category['path'] ?? '';
             $category['parent_id'] = $parent['parent_id'] ?? '';
             $category['parent_pinyin'] = $parent['aLIas_pinyin'] ?? '';
             $category['parent_name'] = $parent['parent_name'] ?? '';