dever 3 years ago
parent
commit
4c5fcd8d29
2 changed files with 24 additions and 3 deletions
  1. 17 2
      app/collection/database/cate.php
  2. 7 1
      app/collection/src/Api.php

+ 17 - 2
app/collection/database/cate.php

@@ -241,7 +241,7 @@ return array
             'option' => array
             (
                 'state' => 1,
-                'status' => 2,
+                'status' => 1,
             ),
             'type' => 'all',
             'order' => array('reorder' => 'desc','id' => 'desc'),
@@ -254,12 +254,27 @@ return array
             'option' => array
             (
                 'ids' => array('yes-id', 'in'),
-                'status' => 2,
+                'status' => 1,
                 'state' => 1,
             ),
             'type' => 'all',
             'order' => array('reorder' => 'desc','id' => 'desc'),
             'col' => '*,id as value|id',
         ),
+
+        'getData' => array
+        (
+            # 匹配的正则或函数 选填项
+            'option' => array
+            (
+                'ids' => array('yes-id', 'in'),
+                'id' => 'yes',
+                'status' => 1,
+                'state' => 1,
+            ),
+            'type' => 'all',
+            'order' => array('reorder' => 'desc','id' => 'desc'),
+            'col' => 'id,name,logo',
+        ),
     ),
 );

+ 7 - 1
app/collection/src/Api.php

@@ -58,9 +58,15 @@ class Api extends Core
         $data['info'] = array();
         $collection = Dever::load('user/lib/collection')->getList($this->uid);
         if ($collection) {
+            $cate = array();
             foreach ($collection as $k => $v) {
-                $data['info'][] = $this->getOne($v['info_id']);
+                $info = $this->getOne($v['info_id']);
+                $data['info'][$info['cate_id']][] = $info;
+                $cate[$info['cate_id']] = $info['cate_id'];
             }
+
+            $cate = implode(',', $cate);
+            $data['cate'] = Dever::db('collection/cate')->getData(array('ids' => $cate));
         }
 
         return $data;