From b73f6b4f8505205c56c72fd73b3f6bb289e4c494 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mr=C2=B7x?= Date: Wed, 24 Feb 2021 19:08:42 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=B9=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Database/ActiveRecord.php | 1 - Database/Command.php | 2 +- Database/Orm/Condition.php | 22 ---------------------- 3 files changed, 1 insertion(+), 24 deletions(-) diff --git a/Database/ActiveRecord.php b/Database/ActiveRecord.php index e0de3197..ac3f3f68 100644 --- a/Database/ActiveRecord.php +++ b/Database/ActiveRecord.php @@ -152,7 +152,6 @@ class ActiveRecord extends BaseActiveRecord if (empty($condition)) { $condition = [$this->getPrimary() => $this->getPrimaryValue()]; } - $condition = static::find()->where($condition)->getCondition(); $execute = static::getDb()->createCommand() ->mathematics(self::getTable(), [$action => $columns], $condition); if ($execute instanceof Command) { diff --git a/Database/Command.php b/Database/Command.php index 303e2769..ac45feb9 100644 --- a/Database/Command.php +++ b/Database/Command.php @@ -144,7 +144,7 @@ class Command extends Component public function mathematics($tableName, $param, $condition): bool|static { $change = $this->db->getSchema()->getChange(); - $sql = $change->mathematics($tableName, $param, $condition); + $sql = $change->mathematics($tableName, $param, [$condition]); if ($sql === false) { return false; } diff --git a/Database/Orm/Condition.php b/Database/Orm/Condition.php index 64d10194..81f2f790 100644 --- a/Database/Orm/Condition.php +++ b/Database/Orm/Condition.php @@ -102,7 +102,6 @@ trait Condition private function conditionMap($condition): string { $array = []; - var_dump($condition); if (is_string($condition) || empty($condition)) { return $condition; } @@ -227,25 +226,4 @@ trait Condition return ' LIMIT ' . $query->limit; } - - /** - * @param $value - * @param bool $isSearch - * @return int|string - */ - public function valueEncode($value, $isSearch = false): int|string - { - if ($isSearch) { - return $value; - } - if (is_numeric($value)) { - return $value; - } else { - if (!is_null(Json::decode($value))) { - return $value; - } - return '\'' . Str::encode($value) . '\''; - } - } - }