From 497c13f1272f3f6d8af9dc0763891ba1e5eedd24 Mon Sep 17 00:00:00 2001 From: thinkphp Date: Fri, 30 Sep 2016 20:41:11 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=B9=E8=BF=9BQuery=E7=B1=BB=E7=9A=84?= =?UTF-8?q?=E8=81=9A=E5=90=88=E6=9F=A5=E8=AF=A2=E6=96=B9=E6=B3=95=E7=9A=84?= =?UTF-8?q?=E8=BF=94=E5=9B=9E=E5=80=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- library/think/db/Query.php | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/library/think/db/Query.php b/library/think/db/Query.php index bae75765..2e9308cc 100644 --- a/library/think/db/Query.php +++ b/library/think/db/Query.php @@ -489,51 +489,51 @@ class Query */ public function count($field = '*') { - return $this->value('COUNT(' . $field . ') AS tp_count', 0); + return (int) $this->value('COUNT(' . $field . ') AS tp_count', 0); } /** * SUM查询 * @access public * @param string $field 字段名 - * @return integer + * @return float|int */ public function sum($field = '*') { - return $this->value('SUM(' . $field . ') AS tp_sum', 0); + return $this->value('SUM(' . $field . ') AS tp_sum', 0) + 0; } /** * MIN查询 * @access public * @param string $field 字段名 - * @return integer + * @return float|int */ public function min($field = '*') { - return $this->value('MIN(' . $field . ') AS tp_min', 0); + return $this->value('MIN(' . $field . ') AS tp_min', 0) + 0; } /** * MAX查询 * @access public * @param string $field 字段名 - * @return integer + * @return float|int */ public function max($field = '*') { - return $this->value('MAX(' . $field . ') AS tp_max', 0); + return $this->value('MAX(' . $field . ') AS tp_max', 0) + 0; } /** * AVG查询 * @access public * @param string $field 字段名 - * @return integer + * @return float|int */ public function avg($field = '*') { - return $this->value('AVG(' . $field . ') AS tp_avg', 0); + return $this->value('AVG(' . $field . ') AS tp_avg', 0) + 0; } /**