| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131 | 
							- <?php
 
- namespace Page\Lib;
 
- use Dever;
 
- 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;
 
-         if ($func && $type && isset($func[$type]['search'])) {
 
-             $method = $func[$type]['search'];
 
-         }
 
-         if (!$method) {
 
-             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;
 
-     }
 
-     public function showType_api()
 
-     {
 
-         $value = Dever::input('value');
 
-         $data = array();
 
-         $config['type_id'] = Dever::db('page/data')->config['struct']['type_id'];
 
-         $config['type_id']['name'] = '关联数据';
 
-         if ($value == -1) {
 
-             $config['type_id']['update'] = 'hidden';
 
-         } else {
 
-             $config['type_id']['update'] = 'select';
 
-         }
 
-         
 
-         $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);
 
-         
 
-         return $data;
 
-     }
 
-     # 查看图片
 
-     public function pic($pic)
 
-     {
 
-         $table = array();
 
-         $table[0] = '<img src="'.$pic.'" width=“150”/>';
 
-         return Dever::table($table);
 
-     }
 
-     public function show($id)
 
-     {
 
-         $table = Dever::load('page/lib/data')->getOne($id, 1);
 
-         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'] = '<img src="'.$v['pic'].'" style="margin-bottom: 34px;width:300px" alt="'.$v['name'].'"/>';
 
-         }
 
-         return $data;
 
-     }
 
-     public function getData($col, $id)
 
-     {
 
-         $data = Dever::db('page/data')->find($id);
 
-         if ($data['type'] > 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']];
 
-                 }
 
-             }
 
-         }
 
-         return $data['col_' . $col];
 
-     }
 
- }
 
 
  |