DESKTOP-2STQMTS\Administrator 3 years ago
parent
commit
2af41edd7c
1 changed files with 18 additions and 6 deletions
  1. 18 6
      app/Http/Controllers/Api/IndexController.php

+ 18 - 6
app/Http/Controllers/Api/IndexController.php

@@ -57,14 +57,26 @@ class IndexController extends FrontController
             ->orderBy('sort','asc')
             ->get();
 
-        $data = [];
+        $cn_data = [];
+        $en_data = [];
 
         foreach ($list as $value){
-            $res['title'] = $value['title'];
-            $res['cn']['image'] = $value['cn_image'];
-            $res['en']['image'] = $value['en_image'];
-            $data[] = $res;
+            $cn['title'] = $value['title'];
+            $cn['image'] = $value['cn_image'];
+
+            $en['title'] = $value['title'];
+            $en['image'] = $value['en_image'];
+
+            $cn_data[] = $cn;
+            $en_data[] = $en;
         }
-        return $this->apiResponseSuccess('获取成功',$data);
+
+        $cn_datas['items'] = $cn_data;
+        $en_datas['items'] = $en_data;
+
+        return $this->apiResponseSuccess('获取成功',[
+            'cn' => $cn_datas,
+            'en' => $en_datas,
+        ]);
     }
 }