mirror of
https://gitee.com/fastadminnet/framework.git
synced 2026-07-04 06:12:48 +08:00
max和min方法增加第二个参数用于设置是否强制转换数字
This commit is contained in:
@@ -534,22 +534,24 @@ class Query
|
||||
* MIN查询
|
||||
* @access public
|
||||
* @param string $field 字段名
|
||||
* @param bool $force 强制转为数字类型
|
||||
* @return mixed
|
||||
*/
|
||||
public function min($field)
|
||||
public function min($field, $force = true)
|
||||
{
|
||||
return $this->value('MIN(' . $field . ') AS tp_min', 0, true);
|
||||
return $this->value('MIN(' . $field . ') AS tp_min', 0, $force);
|
||||
}
|
||||
|
||||
/**
|
||||
* MAX查询
|
||||
* @access public
|
||||
* @param string $field 字段名
|
||||
* @param bool $force 强制转为数字类型
|
||||
* @return mixed
|
||||
*/
|
||||
public function max($field)
|
||||
public function max($field, $force = true)
|
||||
{
|
||||
return $this->value('MAX(' . $field . ') AS tp_max', 0, true);
|
||||
return $this->value('MAX(' . $field . ') AS tp_max', 0, $force);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user