mirror of
https://gitee.com/fastadminnet/framework.git
synced 2026-07-07 15:12:48 +08:00
改进聚合模型
This commit is contained in:
@@ -213,6 +213,8 @@ class Merge extends Model
|
|||||||
$result = 1;
|
$result = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// 清空change
|
||||||
|
$this->change = [];
|
||||||
// 新增回调
|
// 新增回调
|
||||||
$this->trigger('after_update', $this);
|
$this->trigger('after_update', $this);
|
||||||
} else {
|
} else {
|
||||||
@@ -239,6 +241,9 @@ class Merge extends Model
|
|||||||
if ($insertId) {
|
if ($insertId) {
|
||||||
if (is_string($pk)) {
|
if (is_string($pk)) {
|
||||||
$this->data[$pk] = $insertId;
|
$this->data[$pk] = $insertId;
|
||||||
|
if ($this->fk == $pk) {
|
||||||
|
$this->change[] = $pk;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
$this->data[$this->fk] = $insertId;
|
$this->data[$this->fk] = $insertId;
|
||||||
}
|
}
|
||||||
@@ -257,6 +262,10 @@ class Merge extends Model
|
|||||||
$query->table($table)->strict(false)->insert($data);
|
$query->table($table)->strict(false)->insert($data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// 标记为更新
|
||||||
|
$this->isUpdate = true;
|
||||||
|
// 清空change
|
||||||
|
$this->change = [];
|
||||||
// 新增回调
|
// 新增回调
|
||||||
$this->trigger('after_insert', $this);
|
$this->trigger('after_insert', $this);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user