修复baseModel更新数据问题

This commit is contained in:
cano
2024-03-10 00:44:33 +08:00
parent aa40614965
commit 025dab4c2c
2 changed files with 3 additions and 1 deletions

1
.gitignore vendored
View File

@ -17,3 +17,4 @@ yarn-error.log
/.fleet /.fleet
/.idea /.idea
/.vscode /.vscode
test.php

View File

@ -43,7 +43,8 @@ class BaseModel extends Model
if(!$col) $col = $this->primaryKey; if(!$col) $col = $this->primaryKey;
$aItem = $this->checkColInFill($aItem); $aItem = $this->checkColInFill($aItem);
if (empty($aItem)) return false; if (empty($aItem)) return false;
if (isset($aItem[$col])) return false; if (!isset($aItem[$col])) return false;
if (empty($aItem[$col])) return false;
return $this->newQuery()->where($col,$aItem[$col])->update($aItem); return $this->newQuery()->where($col,$aItem[$col])->update($aItem);
} }