find($type); $method = false; if ($func && $func['search']) { $method = $func['search']; } if (!$method) { Dever::alert('暂无数据'); } return Dever::search($method); } public function showType_api() { $value = Dever::input('value'); $data = array(); $id = Dever::input('id'); if ($id) { $data = Dever::db('page/data')->find($id); } $struct = Dever::db('page/data')->config['struct']; $config['type_id'] = $struct['type_id']; $config['type_id']['name'] = '关联数据'; if ($value == -1) { $config['type_id']['update'] = 'hidden'; /* foreach ($struct as $k => $v) { if (strstr($k, 'col_')) { $config[$k] = $v; $config[$k]['update'] = $v['update_bak']; } }*/ } else { $config['type_id']['update'] = 'select'; $config['type_id']['update_search'] = 'page/lib/manage.search?type=' . $value; if ($data && $data['type_id']) { $config['type_id']['update_search_value'] = $data['type_id']; } /* $func = Dever::db('page/func')->find($value); if ($func && $func['col']) { $func['col'] = Dever::array_decode($func['col']); $col = array(); foreach ($func['col'] as $v) { $col['col_' . $v['col_id']] = 1; } foreach ($struct as $k => $v) { if (strstr($k, 'col_')) { if (isset($col[$k])) { $config[$k] = $v; $config[$k]['update'] = $v['update_bak']; } else { $config[$k] = $v; $config[$k]['update'] = 'hidden'; } } } }*/ } $data = Dever::load('manage/database')->update_struct(array('struct' => $config), false, $data, -1, '', false, false); return $data; } # 查看图片 public function pic($pic) { $table = array(); return ''; return Dever::table($table); } public function show($id) { $table = Dever::load('page/lib/data')->getOne($id); if (count($table) == 1) { $table = $table[0]; } return Dever::table($table); } # 查看模板 public function template() { $data = Dever::db('page/template')->state(); foreach ($data as $k => $v) { if (!$v['pic']) { $v['pic'] = ''; } $data[$k]['name'] = ''.$v['name'].''; } return $data; } public function getPic($col, $id) { $info = $this->getData($col, $id); return $this->pic($info); } public function getData($col, $id) { $data = Dever::db('page/data')->find($id); if (isset($data['col_' . $col]) && $data['col_' . $col]) { return $data['col_' . $col]; } if ($data['type'] > 0 && $data['type_id'] > 0) { $func = Dever::db('page/func')->find($data['type']); 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 && isset($info[$v['name']])) { return $info[$v['name']]; } } } } } return $data['col_' . $col]; } }