rabin 3 bulan lalu
induk
melakukan
0728e74f6d
4 mengubah file dengan 28 tambahan dan 6 penghapusan
  1. 3 1
      boot.php
  2. 19 5
      src/Dever/Model.php
  3. 3 0
      src/Dever/Route.php
  4. 3 0
      src/Dever/Store/Mongo.php

+ 3 - 1
boot.php

@@ -50,7 +50,9 @@ class Dever
         if (strpos($class, '?')) {
             list($class, $temp) = explode('?', $class);
             parse_str($temp, $temp);
-            $param[] = $temp;
+            foreach ($temp as $k => $v) {
+                array_unshift($param, $v);
+            }
         }
         if (strpos($class, '.')) {
             list($class, $method) = explode('.', $class);

+ 19 - 5
src/Dever/Model.php

@@ -286,7 +286,7 @@ class Model
             return $this->store->query($sql, $bind)->fetchColumn();
         }
     }
-    public function value($key, $value = false, $col = 'id,name')
+    public function value($key, $value = false, $col = 'id,name', $data = array())
     {
         if (isset($this->config['option'][$key])) {
             $option = $this->config['option'][$key];
@@ -296,11 +296,25 @@ class Model
                 $option = Dever::issets($this->config['struct'][$key], 'value');
             }
         }
+
         if (isset($option)) {
-            if (is_string($option) && strpos($option, 'Dever') === 0) {
-                eval('$option=' . $option . ';');
-            } elseif (is_string($option)) {
-                $option = Dever::db($option)->select([], ['col' => $col]);
+            if (is_string($option)) {
+                if ($data) {
+                    $option = \Dever\Helper\Str::val($option, $data);
+                }
+                if (is_string($option)) {
+                    if (strpos($option, 'http') === 0) {
+                        if (strpos($option, 'Dever') === 0) {
+                            eval('$option=' . $option . ';');
+                        }
+                        return $option;
+                    }
+                    if (strpos($option, 'Dever') === 0) {
+                        eval('$option=' . $option . ';');
+                    } else {
+                        $option = Dever::db($option)->select([], ['col' => $col]);
+                    }
+                }
             } elseif (is_array($option) && !isset($option[0])) {
                 $temp = $option;
                 $option = array();

+ 3 - 0
src/Dever/Route.php

@@ -93,6 +93,9 @@ class Route
         if ($rewrite) {
             return str_replace($rewrite, '', $project['url']) . $uri;
         }
+        if (self::$type == '?l=' && strpos($uri, '?')) {
+            $uri = str_replace('?', '&', $uri);
+        }
         return $project['url'] . self::$type . $uri;
     }
     public static function host()

+ 3 - 0
src/Dever/Store/Mongo.php

@@ -73,6 +73,9 @@ class Mongo extends Base
                 $set['order'] = array();
                 foreach ($temp as $k => $v) {
                     $t = explode(' ', $v);
+                    if ($t[0] == 'id') {
+                        $t[0] = '_' . $t[0];
+                    }
                     $set['order'][$t[0]] = $t[1] == 'desc' ? -1 : 1;
                 }
             }