From 3d868bc2d55f740b1af2e700134cdd7402b62c39 Mon Sep 17 00:00:00 2001 From: thinkphp Date: Tue, 13 Sep 2016 16:33:31 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=AD=A3=E6=9F=A5=E8=AF=A2=E6=9D=A1?= =?UTF-8?q?=E4=BB=B6=E4=B8=BANULL=E7=9A=84=E6=97=B6=E5=80=99=E5=8F=82?= =?UTF-8?q?=E6=95=B0=E7=BB=91=E5=AE=9A=E7=9A=84=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- library/think/Model.php | 1 + library/think/db/Builder.php | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/library/think/Model.php b/library/think/Model.php index fa6ed492..f1c91582 100644 --- a/library/think/Model.php +++ b/library/think/Model.php @@ -326,6 +326,7 @@ abstract class Model implements \JsonSerializable, \ArrayAccess $value = date($format, $_SERVER['REQUEST_TIME']); break; case 'timestamp': + case 'int': $value = $_SERVER['REQUEST_TIME']; break; } diff --git a/library/think/db/Builder.php b/library/think/db/Builder.php index 77175c82..a18332a2 100644 --- a/library/think/db/Builder.php +++ b/library/think/db/Builder.php @@ -297,7 +297,7 @@ abstract class Builder } } $bindType = isset($binds[$field]) ? $binds[$field] : PDO::PARAM_STR; - if (is_scalar($value) && array_key_exists($field, $binds) && !in_array($exp, ['IN', 'NOT IN', 'BETWEEN', 'NOT BETWEEN']) && strpos($exp, 'TIME') === false) { + if (is_scalar($value) && array_key_exists($field, $binds) && !in_array($exp, ['NOT NULL', 'NULL', 'IN', 'NOT IN', 'BETWEEN', 'NOT BETWEEN']) && strpos($exp, 'TIME') === false) { if (strpos($value, ':') !== 0 || !$this->query->isBind(substr($value, 1))) { $bindName = $bindName ?: 'where_' . $field; $this->query->bind($bindName, $value, $bindType);