|
@@ -25,12 +25,26 @@ class Manage extends Auth
|
|
}
|
|
}
|
|
|
|
|
|
# 删除文件
|
|
# 删除文件
|
|
- public function delFile($id, $file)
|
|
|
|
|
|
+ public function upFileStatus()
|
|
{
|
|
{
|
|
- $info = pathinfo($file);
|
|
|
|
- $file = explode('.', $info['filename']);
|
|
|
|
- $file = $file[0];
|
|
|
|
- return Dever::db('file', 'upload')->update(array('rule_id' => $id, 'name' => $file), array('status' => 2));
|
|
|
|
|
|
+ $rule_id = Dever::input('id');
|
|
|
|
+ $id = Dever::input('file_id');
|
|
|
|
+ $status = Dever::input('status', 'is_numeric', '状态', 2);
|
|
|
|
+ $user_id = Dever::load('util', 'upload')->getUser();
|
|
|
|
+ return Dever::db('file', 'upload')->update(array('id' => $id, 'user_id' => $user_id), array('status' => $status));
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ # 彻底删除文件
|
|
|
|
+ public function delFile()
|
|
|
|
+ {
|
|
|
|
+ $rule_id = Dever::input('id');
|
|
|
|
+ $id = Dever::input('file_id');
|
|
|
|
+ $user_id = Dever::load('util', 'upload')->getUser();
|
|
|
|
+ $state = Dever::db('file', 'upload')->delete(array('id' => $id, 'status' => 2, 'user_id' => $user_id));
|
|
|
|
+ if ($state) {
|
|
|
|
+ # 同时删除文件
|
|
|
|
+ }
|
|
|
|
+ return 'ok';
|
|
}
|
|
}
|
|
|
|
|
|
# 添加文件
|
|
# 添加文件
|
|
@@ -39,4 +53,54 @@ class Manage extends Auth
|
|
$data = Dever::load('save', 'upload')->init($id)->addFile($url, $source, $name, $file, $size);
|
|
$data = Dever::load('save', 'upload')->init($id)->addFile($url, $source, $name, $file, $size);
|
|
return $data;
|
|
return $data;
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ # 获取文件库文件列表
|
|
|
|
+ public function getFileList()
|
|
|
|
+ {
|
|
|
|
+ $type = Dever::input('type', 'is_numeric', '类型', 0);
|
|
|
|
+ $id = Dever::input('id', 'is_numeric', '上传规则错误', 1);
|
|
|
|
+ $cate_id = Dever::input('cate_id', 'is_numeric', '上传分类', 1);
|
|
|
|
+ $group_id = Dever::load('util', 'upload')->getGroup();
|
|
|
|
+ $user_id = Dever::load('util', 'upload')->getUser();
|
|
|
|
+ $file = Dever::input('file');
|
|
|
|
+
|
|
|
|
+ $data = Dever::input();
|
|
|
|
+
|
|
|
|
+ $set = array();
|
|
|
|
+ $set['num'] = 10;
|
|
|
|
+ $where['rule_id'] = $id;
|
|
|
|
+ $where['status'] = 1;
|
|
|
|
+ #$where['cate_id'] = $cate_id;
|
|
|
|
+ if ($type == 1) {
|
|
|
|
+ $where['group_id'] = $group_id;
|
|
|
|
+ } elseif ($type == 2) {
|
|
|
|
+ $where['user_id'] = $user_id;
|
|
|
|
+ } elseif ($type == 4) {
|
|
|
|
+ $where['status'] = 2;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ $result['file'] = Dever::db('file', 'upload')->select($where, $set);
|
|
|
|
+ if ($result['file']) {
|
|
|
|
+ foreach ($result['file'] as &$v) {
|
|
|
|
+ if ($v['source_name']) {
|
|
|
|
+ $v['name'] = $v['source_name'];
|
|
|
|
+ }
|
|
|
|
+ $v['url'] = Dever::load('view', 'upload')->getUrl($v);
|
|
|
|
+ $v['class'] = '';
|
|
|
|
+ $v['del'] = 2;
|
|
|
|
+ if ($user_id == $v['user_id']) {
|
|
|
|
+ $v['del'] = 1;
|
|
|
|
+ }
|
|
|
|
+ if ($file) {
|
|
|
|
+ foreach ($file as $v1) {
|
|
|
|
+ if ($v1 && $v1['url'] == $v['url']) {
|
|
|
|
+ $v['class'] = 'show-image-active';
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ $result['total'] = Dever::page('total');
|
|
|
|
+ return $result;
|
|
|
|
+ }
|
|
}
|
|
}
|