| 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){
|
| xqd
@@ -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);
|
|
|
}
|
|
|
|