黄宗昌 před 2 roky
rodič
revize
d93cf8882e

+ 8 - 2
app/Http/Controllers/V1/UserFolderController.php

xqd xqd
@@ -36,6 +36,9 @@ class UserFolderController extends Controller
         if(empty($params['name'])){
             return $this->error("名称不能为空!");
         }
+        if(empty($params['type'])){
+            return $this->error("类型不能为空!");
+        }
         $params['user_id'] = $this->userId; // 用户ID
         $res = UserFolder::query()->create($params);
         if(!$res){
@@ -49,8 +52,11 @@ class UserFolderController extends Controller
      * @return void
      * 文件夹列表
      */
-    public function folderList(){
-        $list = UserFolder::query()->withCount('images')->where('user_id','=',$this->userId)->get();
+    public function folderList(Request $request){
+
+        $type = $request->get('type',1);
+
+        $list = UserFolder::query()->withCount('images')->where('type',$type)->where('user_id','=',$this->userId)->get();
         return $this->success($list);
     }
 

+ 1 - 0
app/Models/UserFolderImage.php

xqd
@@ -15,6 +15,7 @@ class UserFolderImage extends Model
         'user_id',
         'folder_id',
         'image',
+        'type'
     ];
 
 }