|
@@ -50,7 +50,7 @@ class View
|
|
|
Dever::out($data);
|
|
|
}
|
|
|
|
|
|
- public function files()
|
|
|
+ public function files($view)
|
|
|
{
|
|
|
$data = array();
|
|
|
|
|
@@ -58,12 +58,15 @@ class View
|
|
|
$cate = Dever::input('cate', 1);
|
|
|
$name = Dever::input('name');
|
|
|
$tag = Dever::input('tag');
|
|
|
+ $state = Dever::input('state', 1);
|
|
|
+ $upload_search = Dever::input('upload_search');
|
|
|
$data['cur'] = Dever::input('cur');
|
|
|
$data['value'] = Dever::input('value');
|
|
|
$data['search_pg'] = Dever::input('pg', 1);
|
|
|
|
|
|
$param = array();
|
|
|
$param['upload'] = $key;
|
|
|
+ $param['state'] = $state;
|
|
|
if ($name) {
|
|
|
$param['source_name'] = $name;
|
|
|
$param['name'] = $name;
|
|
@@ -72,9 +75,15 @@ class View
|
|
|
$param['cate'] = $cate;
|
|
|
}
|
|
|
|
|
|
+ if ($upload_search) {
|
|
|
+ $param['search'] = $upload_search;
|
|
|
+ }
|
|
|
+
|
|
|
$data['search_cate'] = $cate;
|
|
|
$data['search_tag'] = $tag;
|
|
|
$data['search_name'] = $name;
|
|
|
+ $data['search_name'] = $name;
|
|
|
+ $data['upload_search'] = $upload_search;
|
|
|
$data['key'] = $key;
|
|
|
|
|
|
if (strstr($key, '_')) {
|
|
@@ -113,6 +122,26 @@ class View
|
|
|
$data['file'][$k]['url'] = $v['file'];
|
|
|
}
|
|
|
|
|
|
+ $data['file'][$k]['value_array'] = array();
|
|
|
+ if ($v['value']) {
|
|
|
+ parse_str($v['value'], $data['file'][$k]['value_array']);
|
|
|
+ }
|
|
|
+
|
|
|
+ if (!$view) {
|
|
|
+ if ($v['state'] == 1) {
|
|
|
+ $data['file'][$k]['stateColor'] = 'red';
|
|
|
+ $data['file'][$k]['stateName'] = '删除';
|
|
|
+ $data['file'][$k]['stateUrl'] = Dever::url('view.setState?id=' . $v['id'] . '&state=2', 'upload');
|
|
|
+ } else {
|
|
|
+ $data['file'][$k]['stateColor'] = 'blue';
|
|
|
+ $data['file'][$k]['stateName'] = '恢复';
|
|
|
+ $data['file'][$k]['stateUrl'] = Dever::url('view.setState?id=' . $v['id'] . '&state=1', 'upload');
|
|
|
+ }
|
|
|
+
|
|
|
+ $data['file'][$k]['valueUrl'] = Dever::url('view.setValue?id=' . $v['id'], 'upload');
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
$data['file'][$k]['check'] = false;
|
|
|
if ($data['value'] && $data['value'] == $v['id']) {
|
|
|
$data['file'][$k]['check'] = true;
|
|
@@ -138,10 +167,52 @@ class View
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ if ($view) {
|
|
|
+ return $data;
|
|
|
+ }
|
|
|
+
|
|
|
$data = Dever::render('show', $data);
|
|
|
Dever::out($data);
|
|
|
}
|
|
|
|
|
|
+ public function setState()
|
|
|
+ {
|
|
|
+ $id = Dever::input('id');
|
|
|
+ $state = Dever::input('state');
|
|
|
+
|
|
|
+ $where['where_id'] = $id;
|
|
|
+ $where['state'] = $state;
|
|
|
+ Dever::db('upload/file')->update($where);
|
|
|
+
|
|
|
+ return 'ok';
|
|
|
+ }
|
|
|
+
|
|
|
+ public function setValue()
|
|
|
+ {
|
|
|
+ $id = Dever::input('id');
|
|
|
+ $value = Dever::input('value');
|
|
|
+
|
|
|
+ $where['where_id'] = $id;
|
|
|
+ $where['value'] = $value;
|
|
|
+ Dever::db('upload/file')->update($where);
|
|
|
+
|
|
|
+ return 'ok';
|
|
|
+ }
|
|
|
+
|
|
|
+ # 根据key search 查找文件
|
|
|
+ public function search($key = 1, $search)
|
|
|
+ {
|
|
|
+ $key = Dever::input('key', $key);
|
|
|
+ $search = Dever::input('search', $search);
|
|
|
+
|
|
|
+ Dever::setInput('key', $key);
|
|
|
+ Dever::setInput('upload_search', $search);
|
|
|
+
|
|
|
+ $data = $this->files(true);
|
|
|
+
|
|
|
+ return $data['file'];
|
|
|
+ }
|
|
|
+
|
|
|
public function kindeditorFile()
|
|
|
{
|
|
|
$key = Dever::input('key');
|