2db47680
hexiaodong
chore: 初始提交 php 遗...
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
|
<?php
namespace addons\qingdong\controller;
use addons\antis\controller\StaffApi;
use app\admin\model\qingdong\file\Category;
class Netdisk extends StaffApi
{
protected $noNeedLogin = ['*'];
//文件列表
public function index(){
$param = $this->request->param();
$groupList = (new \addons\qingdong\model\Netdisk())->where('category_id',$param['category_id'])->select();
$this->success('',$groupList);
}
//文件夹列表
public function listType(){
$param = $this->request->param();
$groupList = (new Category())->where('s_id',$param['category_id'])->select();
$this->success('',$groupList);
}
//文件列表
public function indexType(){
$param = $this->request->param();
$groupList = (new Category())->where('s_id', 0)
->where(function ($query)use($param){
if(isset($param['type']) && !empty($param['type'])){
if($param['type'] == '2'){
$query->where(['type'=>'2','create_id'=>$this->auth->id]);
}
if($param['type'] == '3'){
$query->whereOr(['type'=>'3']);
}
}
})
->select();
$this->success('',$groupList);
}
//创建文件
public function addNetdisk(){
$param = $this->request->param();
$data = [
'category_id'=>$param['category_id']??'',
'name'=>$param['name'],
'file'=>$param['file'],
'create_id'=>$this->auth->id,
];
$res = (new \addons\qingdong\model\Netdisk())->save($data);
$this->success('添加成功');
}
//创建文件夹
public function addType(){
$param = $this->request->param();
$data = [
's_id'=>$param['s_id']??'',
'name'=>$param['name'],
'type'=>$param['type'],
'create_id'=>$this->auth->id,
];
$res = (new Category())->save($data);
$this->success('添加成功');
}
public function delNetdisk(){
$param = $this->request->param();
$find = (new \addons\qingdong\model\Netdisk())->where('create_id',$this->auth->id)->where('id',$param['id'])->find();
if(!$find){
$this->error('未找到该文件');
}
$find->delete();
$this->success('删除成功');
}
public function delType(){
$param = $this->request->param();
$find = (new Category())->where('create_id',$this->auth->id)->where('id',$param['id'])->find();
if(!$find){
$this->error('未找到该文件夹');
}
$find->delete();
$this->success('删除成功');
}
}
|