From 9c7a01406d043b40a0e54e289f058547846e1c4d Mon Sep 17 00:00:00 2001 From: wuyanwen Date: Fri, 17 Jan 2020 15:49:42 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=9B=B4=E6=96=B0=E6=96=B9?= =?UTF-8?q?=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- extend/catcher/traits/db/BaseOptionsTrait.php | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/extend/catcher/traits/db/BaseOptionsTrait.php b/extend/catcher/traits/db/BaseOptionsTrait.php index 3f0a199..a36139e 100644 --- a/extend/catcher/traits/db/BaseOptionsTrait.php +++ b/extend/catcher/traits/db/BaseOptionsTrait.php @@ -19,17 +19,18 @@ trait BaseOptionsTrait return false; } - /** - * - * @time 2019年12月03日 - * @param $id - * @param $data - * @return bool - */ - public function updateBy($id, $data) + /** + * + * @time 2019年12月03日 + * @param $id + * @param $data + * @param string $field + * @return bool + */ + public function updateBy($id, $data, $field = ''): bool { - if (static::update($data, [$this->getPk() => $id], $this->field)) { + if (static::update($data, [$field ? : $this->getPk() => $id], $this->field)) { return true; }