rabin преди 1 година
родител
ревизия
47c45687ed
променени са 2 файла, в които са добавени 19 реда и са изтрити 9 реда
  1. 11 9
      database/info.php
  2. 8 0
      lib/Handle.php

+ 11 - 9
database/info.php

@@ -52,9 +52,9 @@ return array
         'url'      => array
         (
             'type'      => 'varchar-800',
-            'name'      => '转换的url',
+            'name'      => '需要转换的网址',
             'default'   => '',
-            'desc'      => '转换的url',
+            'desc'      => '需要转换的网址',
             'match'     => 'is_string',
             'update'    => 'text',
             'search'    => 'fulltext',
@@ -67,9 +67,11 @@ return array
             'name'      => '参数',
             'default'   => '',
             'desc'      => '参数',
-            'match'     => 'is_string',
-            'update'    => 'text',
-            'list'      => true,
+            'match'     => 'option',
+            //'update'    => 'text',
+            //'list'      => true,
+            'list_name' => '短连接',
+            'list'      => 'Dever::load("short/handle.showUrl", {id})',
         ),
 
         'key'      => array
@@ -78,10 +80,10 @@ return array
             'name'      => '关键字',
             'default'   => '',
             'desc'      => '关键字',
-            'match'     => 'is_string',
-            'update'    => 'text',
-            'search'    => 'fulltext',
-            'list'      => true,
+            'match'     => 'option',
+            //'update'    => 'text',
+            //'search'    => 'fulltext',
+            //'list'      => true,
         ),
         
         'state'     => array

+ 8 - 0
lib/Handle.php

@@ -6,6 +6,14 @@ use Dever;
 
 class Handle
 {
+    public function showUrl($id)
+    {
+        $info = Dever::db('short/info')->one($id);
+        $type = Dever::db('short/type')->one($info['type']);
+
+        return $type['host'] . Dever::uid($id);
+    }
+
     public function get($type, $url, $param, $host = '')
     {
         $param = json_encode($param);