|
@@ -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;
|