From 46b8b5e8e768024a75fabb78c05617fdc89168aa Mon Sep 17 00:00:00 2001 From: thinkphp Date: Mon, 7 Nov 2016 11:14:02 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=B9=E8=BF=9BQuery=E7=B1=BB=E7=9A=84min?= =?UTF-8?q?=E5=92=8Cmax=E6=96=B9=E6=B3=95=20=E5=AF=B9=20=E6=97=A5=E6=9C=9F?= =?UTF-8?q?=E7=B1=BB=E5=9E=8B=E7=9A=84=E6=94=AF=E6=8C=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- library/think/db/Query.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/library/think/db/Query.php b/library/think/db/Query.php index b238610d..4636377b 100644 --- a/library/think/db/Query.php +++ b/library/think/db/Query.php @@ -507,22 +507,24 @@ class Query * MIN查询 * @access public * @param string $field 字段名 - * @return float|int + * @return mixed */ public function min($field = '*') { - return $this->value('MIN(' . $field . ') AS tp_min', 0) + 0; + $value = $this->value('MIN(' . $field . ') AS tp_min', 0); + return is_numeric($value) ? $value + 0 : $value; } /** * MAX查询 * @access public * @param string $field 字段名 - * @return float|int + * @return mixed */ public function max($field = '*') { - return $this->value('MAX(' . $field . ') AS tp_max', 0) + 0; + $value = $this->value('MAX(' . $field . ') AS tp_max', 0); + return is_numeric($value) ? $value + 0 : $value; } /**