|
@@ -8,14 +8,7 @@ class Manage
|
|
|
{
|
|
|
public function search_api()
|
|
|
{
|
|
|
- $keyword = Dever::input('keyword');
|
|
|
-
|
|
|
- $yes = Dever::input('yes');
|
|
|
-
|
|
|
- $where = array();
|
|
|
-
|
|
|
$type = Dever::input('type');
|
|
|
-
|
|
|
$func = Dever::db('page/module')->config['func'];
|
|
|
$func = $func();
|
|
|
$method = false;
|
|
@@ -27,37 +20,7 @@ class Manage
|
|
|
Dever::alert('暂无数据');
|
|
|
}
|
|
|
|
|
|
- if ($yes) {
|
|
|
- $yes = Dever::db($method)->search(array('ids' => $yes));
|
|
|
- }
|
|
|
- if (!$keyword) {
|
|
|
- $where['limit'] = '0,50';
|
|
|
- $data = Dever::db($method)->search($where);
|
|
|
- } else {
|
|
|
- $where['name'] = $keyword;
|
|
|
- $data = Dever::db($method)->search($where);
|
|
|
- }
|
|
|
-
|
|
|
- $result = array();
|
|
|
- if ($yes) {
|
|
|
- foreach ($yes as $k => $v) {
|
|
|
- if (isset($data[$k])) {
|
|
|
- unset($data[$k]);
|
|
|
- }
|
|
|
- $yes[$k]['selected'] = 'selected';
|
|
|
- }
|
|
|
- $data = $yes + $data;
|
|
|
-
|
|
|
- $data = array_merge($data, array());
|
|
|
- } else {
|
|
|
- $data = array_merge($data, array());
|
|
|
- }
|
|
|
-
|
|
|
- if (!$data) {
|
|
|
- Dever::alert('暂无数据');
|
|
|
- }
|
|
|
-
|
|
|
- return $data;
|
|
|
+ return Dever::search($method);
|
|
|
}
|
|
|
|
|
|
public function showType_api()
|
|
@@ -70,9 +33,15 @@ class Manage
|
|
|
$config['type_id']['update'] = 'hidden';
|
|
|
} else {
|
|
|
$config['type_id']['update'] = 'select';
|
|
|
+ $config['type_id']['update_search'] = 'page/lib/manage.search?type=' . $value;
|
|
|
+ $id = Dever::input('id');
|
|
|
+ if ($id) {
|
|
|
+ $info = Dever::db('page/data')->find($id);
|
|
|
+ if ($info && $info['type_id']) {
|
|
|
+ $config['type_id']['update_search_value'] = $info['type_id'];
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
-
|
|
|
- $config['type_id']['update_search'] = 'page/lib/manage.search?type=' . $value;
|
|
|
|
|
|
$data = Dever::load('manage/database')->update_struct(array('struct' => $config), false, $data, -1, '', false, false);
|
|
|
|
|
@@ -83,7 +52,7 @@ class Manage
|
|
|
public function pic($pic)
|
|
|
{
|
|
|
$table = array();
|
|
|
- $table[0] = '<img src="'.$pic.'" width=“150”/>';
|
|
|
+ return '<img src="'.$pic.'" width=“150”/>';
|
|
|
|
|
|
return Dever::table($table);
|
|
|
}
|
|
@@ -115,13 +84,17 @@ class Manage
|
|
|
{
|
|
|
$data = Dever::db('page/data')->find($id);
|
|
|
|
|
|
- if ($data['type'] > 0) {
|
|
|
+ if ($data['type'] > 0 && $data['type_id'] > 0) {
|
|
|
$func = Dever::db('page/func')->find($data['type']);
|
|
|
- $info = Dever::load($func['api'], $id);
|
|
|
- $func['col'] = Dever::json_decode($func['col']);
|
|
|
- foreach ($func['col'] as $k => $v) {
|
|
|
- if ($v['col_id'] == $col) {
|
|
|
- return $info[$v['name']];
|
|
|
+ if ($func['col']) {
|
|
|
+ $info = Dever::load($func['api'], $data['type_id']);
|
|
|
+ if ($info) {
|
|
|
+ $func['col'] = Dever::json_decode($func['col']);
|
|
|
+ foreach ($func['col'] as $k => $v) {
|
|
|
+ if ($v['col_id'] == $col) {
|
|
|
+ return $info[$v['name']];
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|