mirror of
https://gitee.com/fastadminnet/framework.git
synced 2026-07-10 00:22:48 +08:00
改进Model类_write_data方法
This commit is contained in:
@@ -204,7 +204,7 @@ class Model
|
||||
throw new Exception('invalid data');
|
||||
}
|
||||
}
|
||||
if (!empty($this->duplicate)) {
|
||||
if (!empty($this->duplicate) && 'update' == $type) {
|
||||
// 存在数据副本
|
||||
foreach ($data as $key => $val) {
|
||||
// 去除相同数据
|
||||
@@ -215,7 +215,7 @@ class Model
|
||||
if (empty($data)) {
|
||||
// 没有数据变化
|
||||
return [];
|
||||
} elseif ('update' == $type) {
|
||||
} else {
|
||||
// 更新操作保留主键信息
|
||||
$pk = $this->getPk();
|
||||
if (is_array($pk)) {
|
||||
@@ -1236,7 +1236,7 @@ class Model
|
||||
$range = is_array($rule) ? $rule : explode(',', $rule);
|
||||
$result = 'in' == $type ? in_array($value, $range) : !in_array($value, $range);
|
||||
break;
|
||||
case 'between':// 验证是否在某个范围
|
||||
case 'between': // 验证是否在某个范围
|
||||
case 'notbetween': // 验证是否不在某个范围
|
||||
if (is_string($rule)) {
|
||||
$rule = explode(',', $rule);
|
||||
|
||||
Reference in New Issue
Block a user