dever 2 years ago
parent
commit
33465e5382
4 changed files with 35 additions and 20 deletions
  1. 2 2
      database/col.php
  2. 1 1
      database/data.php
  3. 25 4
      database/func.php
  4. 7 13
      lib/Data.php

+ 2 - 2
database/col.php

@@ -7,8 +7,8 @@ $type = array
 	3 => '编辑器',
 	4 => '单张图片',
 	5 => '多张图片',
-	6 => '单项选择',
-	7 => '多项选择',
+	//6 => '单项选择',
+	//7 => '多项选择',
 	8 => '时间选择',
 );
 return array

+ 1 - 1
database/data.php

@@ -39,7 +39,7 @@ if ($info) {
             unset($type[$k]);
         } else {
             $type_default = $v['id'];
-            if ($v['id'] > 0) {
+            if ($v['id'] > 0 && isset($v['type']) && $v['type'] == 1) {
             	$type_id[] = $v['id'];
             }
         }

+ 25 - 4
database/func.php

@@ -14,6 +14,12 @@ $col = function()
     return $array;
 };
 
+$type = array
+(
+	1 => '接口',
+	2 => '特殊',
+);
+
 return array
 (
 	# 表名
@@ -50,16 +56,30 @@ return array
 			'list'		=> true,
 		),
 
+		'type'        => array
+        (
+            'type'      => 'tinyint-1',
+            'name'      => '功能类型',
+            'default'   => '1',
+            'desc'      => '功能类型',
+            'match'     => 'is_numeric',
+            'update'  	=> 'select',
+            'option'    => $type,
+            'search'    => 'select',
+            'list'      => true,
+            'control'	=> 'type',
+        ),
+
 		'api'		=> array
 		(
 			'type' 		=> 'varchar-200',
-			'name' 		=> '功能接口-可以直接输入http接口地址,也可以使用dever接口,如果接口返回一条数据,就为单条,如果是多条,就是列表',
+			'name' 		=> '功能定义-如果是接口类型,这里可以直接输入http接口地址,也可以使用dever接口,如果接口返回一条数据,就为单条,如果是多条,就是列表;如果是特殊类型,直接输入类型的值即可',
 			'default' 	=> '',
 			'desc' 		=> '功能接口',
 			'match' 	=> 'is_string',
 			'update'	=> 'textarea',
-			'search'	=> 'fulltext',
-			'list'		=> true,
+			//'search'	=> 'fulltext',
+			//'list'		=> true,
 		),
 
 		'col'       => array
@@ -69,6 +89,7 @@ return array
             'default'   => '',
             'desc'      => '关联字段',
             'match'     => 'is_string',
+            'show'		=> 'type=1',
             'update'    => array
             (
                 array
@@ -131,7 +152,7 @@ return array
 
 	'manage' => array
 	(
-		
+		'delete' => false,
 	),
 
 	'request' => array

+ 7 - 13
lib/Data.php

@@ -58,22 +58,16 @@ class Data
         $info = array();
         $col = array();
         if ($data['type'] > 0) {
-            $func = Dever::db('push/info')->config['func'];
-            $func = $func();
-            $method = false;
+            $func = Dever::db('push/func')->one($data['type']);
             if ($func) {
-                foreach ($func as $k => $v) {
-                    if ($v['id'] == $data['type']) {
-                        $method = $v['api'];
-                        $col = Dever::array_decode($v['col']);
-                        break;
-                    }
+                if ($func['type'] == 1) {
+                    $method = $func['api'];
+                    $col = Dever::array_decode($func['col']);
+                    $source = Dever::load($method, $data['type_id']);
+                } else {
+                    $data['type_id'] = $func['api'];
                 }
             }
-
-            if ($method) {
-                $source = Dever::load($method, $data['type_id']);
-            }
         }
         if ($state == 1) {
             $result = array();