rabin 3 月之前
父节点
当前提交
a0d7877154
共有 2 个文件被更改,包括 6 次插入3 次删除
  1. 2 2
      src/Dever/Library.php
  2. 4 1
      src/Dever/Model.php

+ 2 - 2
src/Dever/Library.php

@@ -28,7 +28,7 @@ class Library
             $file = $path . DIRECTORY_SEPARATOR . $class;
             $file = $path . DIRECTORY_SEPARATOR . $class;
             $class = str_replace('/', '\\', $class);
             $class = str_replace('/', '\\', $class);
         } else {
         } else {
-            $class = $file = ucfirst($file);
+            $class = ucfirst($file);
             $file = $path . DIRECTORY_SEPARATOR . $file;
             $file = $path . DIRECTORY_SEPARATOR . $file;
         }
         }
         $class = ucfirst($app) . '\\' . ucfirst($path) . '\\' . $class;
         $class = ucfirst($app) . '\\' . ucfirst($path) . '\\' . $class;
@@ -45,7 +45,7 @@ class Library
             $class = str_replace('manage/', 'lib/', $class);
             $class = str_replace('manage/', 'lib/', $class);
             $path = 'manage';
             $path = 'manage';
         }
         }
-        $class = self::apply($class, $app, $path);
+        $class = self::apply(ucfirst($class), $app, $path);
         if (empty(self::$class[$class])) {
         if (empty(self::$class[$class])) {
             self::$class[$class] = new $class();
             self::$class[$class] = new $class();
         }
         }

+ 4 - 1
src/Dever/Model.php

@@ -160,6 +160,9 @@ class Model
     public function find($param, $set = array(), $lock = false)
     public function find($param, $set = array(), $lock = false)
     {
     {
         if (isset($this->partition['where']) && $this->partition['where']) {
         if (isset($this->partition['where']) && $this->partition['where']) {
+            if (is_numeric($param)) {
+                $param = array('id' => $param);
+            }
             $param = array_merge($this->partition['where'], $param);
             $param = array_merge($this->partition['where'], $param);
         }
         }
         return $this->store->find($this->config['table'], $param, $set, $this->config['struct'], $lock);
         return $this->store->find($this->config['table'], $param, $set, $this->config['struct'], $lock);
@@ -168,7 +171,7 @@ class Model
     {
     {
         return $this->column($param, 'sum(`'.$field.'`)', 0);
         return $this->column($param, 'sum(`'.$field.'`)', 0);
     }
     }
-    public function column($param = array(), $field, $default = '')
+    public function column($param = array(), $field = 'name', $default = '')
     {
     {
         $info = $this->find($param, array('col' => $field . ' as value'));
         $info = $this->find($param, array('col' => $field . ' as value'));
         return $info ? $info['value'] : $default;
         return $info ? $info['value'] : $default;