rabin 3 месяцев назад
Родитель
Сommit
c33cf72b6d
3 измененных файлов с 25 добавлено и 4 удалено
  1. 2 0
      api/Page/Data.php
  2. 22 3
      api/Page/Update.php
  3. 1 1
      lib/Page.php

+ 2 - 0
api/Page/Data.php

@@ -121,6 +121,8 @@ class Data extends Page
                         $result[$key] = $other;
                     }
                 }
+            } elseif (isset($value['show'])) {
+                $result[$key] = $this->getShow($value['show'], $v);
             }
             if ($html == 2) {
                 $result[$key] = strip_tags($result[$key]);

+ 22 - 3
api/Page/Update.php

@@ -18,7 +18,16 @@ class Update extends Page
         $this->setting('field', $data['update'], true, 'text');
         foreach ($data['update'] as $k => $v) {
             if ($v['type'] == 'tree' || $v['type'] == 'upload' || $v['type'] == 'cascader' || $v['type'] == 'checkbox' || isset($v['multiple'])) {
-                $v['value'] = array();
+                if (isset($v['value']) && $v['value']) {
+                    $v['value'] = explode(',', $v['value']);
+                    foreach ($v['value'] as $k1 => $v1) {
+                        if (is_numeric($v1)) {
+                            $v['value'][$k1] = (float) $v1;
+                        }
+                    }
+                } else {
+                    $v['value'] = array();
+                }
             }
             if (isset($v['source'])) {
                 $source[$v['key']] = $v['source'];
@@ -393,7 +402,10 @@ class Update extends Page
             }
             if ($data) {
                 $this->exists($id, $data, $this->config['field']);
-                $this->start($id, $data);
+                $result = $this->start($id, $data);
+                if ($result == 'end') {
+                    return '操作成功';
+                }
                 if ($id) {
                     $info = $this->db->find($id);
                     if ($info) {
@@ -490,7 +502,14 @@ class Update extends Page
                 $result = Dever::call($this->config['start'], array($this->db, $data));
             }
             if ($result) {
-                $data = $result;
+                if ($result == 'end') {
+                    return $result;
+                }
+                if (is_object($result)) {
+                    $this->db = $result;
+                } else {
+                    $data = $result;
+                }
             }
         }
     }

+ 1 - 1
lib/Page.php

@@ -463,7 +463,7 @@ class Page extends Auth
             }
         }
         if (isset($value['option']) && $value['option']) {
-            $this->db->config['struct'][$value['key']]['value'] = $value['option'];
+            $this->db->config['option'][$value['key']] = $value['option'];
         }
         if ($option = $this->db->value($value['key'])) {
             if ($value['type'] == 'checkbox') {