rabin 1 year ago
parent
commit
cb1eb61ef9
3 changed files with 106 additions and 0 deletions
  1. 80 0
      database/import.php
  2. 9 0
      lib/Manage.php
  3. 17 0
      src/Import.php

+ 80 - 0
database/import.php

@@ -0,0 +1,80 @@
+<?php
+
+return array
+(
+    # 表名
+    'name' => 'import',
+    # 显示给用户看的名称
+    'lang' => '导入',
+    'menu' => false,
+    'end' => array
+    (
+        'insert' => 'upload/lib/manage.import',
+    ),
+    # 数据结构
+    'struct' => array
+    (
+    
+        'id'        => array
+        (
+            'type'      => 'int-11',
+            'name'      => 'ID',
+            'default'   => '',
+            'desc'      => '',
+            'match'     => 'is_numeric',
+            'search'    => 'order',
+            'list'        => true,
+        ),
+
+        'file'      => array
+        (
+            'type'      => 'varchar-150',
+            'name'      => '选择导入文件',
+            'default'   => '',
+            'desc'      => '选择导入文件',
+            'match'     => 'option',
+            'update'    => 'upload',
+            'key'       => Dever::input('key', 4),
+        ),
+
+        'call'      => array
+        (
+            'type'      => 'varchar-800',
+            'name'      => 'call',
+            'default'   => '',
+            'desc'      => '选择导入文件',
+            'match'     => 'option',
+            'update'    => 'hidden',
+            'value'     => Dever::input('call'),
+        ),
+
+        'state'     => array
+        (
+            'type'      => 'tinyint-1',
+            'name'      => '状态',
+            'default'   => '1',
+            'desc'      => '请选择状态',
+            'match'     => 'is_numeric',
+        ),
+        
+        'cdate'     => array
+        (
+            'type'      => 'int-11',
+            'name'      => '创建时间',
+            'match'     => array('is_numeric', time()),
+            'desc'      => '',
+            # 只有insert时才生效
+            'insert'    => true,
+            //'search'  => 'date',
+            'list'      => 'date("Y-m-d H:i:s", {cdate})',
+        ),
+    ),
+
+    'manage' => array
+    (
+        //'excel'   => true,
+        //'delete' => false,
+        //'edit' => false,
+        //'insert' => false,
+    ),
+);

+ 9 - 0
lib/Manage.php

@@ -5,6 +5,15 @@ use Dever;
 
 class Manage
 {
+    public function import($id, $name, $data)
+    {
+        $file = Dever::param('file', $data);
+        $call = Dever::param('call', $data);
+        if ($file && $call) {
+            Dever::load($call, $file);
+        }
+    }
+
     public function search_tag()
     {
         $name = Dever::input('term');

+ 17 - 0
src/Import.php

@@ -0,0 +1,17 @@
+<?php
+/*
+|--------------------------------------------------------------------------
+| 处理导入
+|--------------------------------------------------------------------------
+*/
+namespace Upload\Src;
+
+use Dever;
+
+class Import
+{
+	public function url($call, $key = 4)
+	{
+		return Dever::url('project/database/update?project=upload&table=import&call='.$call.'&key=' . $key, 'manage');
+	}
+}