修复tp5 Model更新函数返回信息没有是否更新成功信息

This commit is contained in:
sugar1569 2019-04-02 17:35:07 +08:00
parent 1f6d91b849
commit e309a1bda9
2 changed files with 4 additions and 2 deletions

View File

@ -42,9 +42,11 @@ trait ModelTrait
{ {
$model = new self; $model = new self;
if(!$field) $field = $model->getPk(); if(!$field) $field = $model->getPk();
return false !== $model->update($data,[$field=>$id]); // return false !== $model->update($data,[$field=>$id]);
return 0 < $model->update($data,[$field=>$id])->result;
} }
/** /**
* 查询一条数据是否存在 * 查询一条数据是否存在
* @param $map * @param $map

View File

@ -1680,7 +1680,7 @@ abstract class Model implements \JsonSerializable, \ArrayAccess
if (!empty($field)) { if (!empty($field)) {
$model->allowField($field); $model->allowField($field);
} }
$result = $model->isUpdate(true)->save($data, $where); $model->result = $model->isUpdate(true)->save($data, $where);
return $model; return $model;
} }