升级Thinkphp6.0.8
This commit is contained in:
1 parent
b0cc71eaed
commit
5025707799
32 files changed
+601
-225
No files matched your search
+4
-8
@@ -267,7 +267,6 @@ abstract class Model implements JsonSerializable, ArrayAccess, Arrayable, Jsonab
|
||||
public function newInstance(array $data = [], $where = null): Model
|
||||
{
|
||||
$model = new static($data);
|
||||
$model->readDataType();
|
||||
|
||||
if ($this->connection) {
|
||||
$model->setConnection($this->connection);
|
||||
@@ -457,8 +456,6 @@ abstract class Model implements JsonSerializable, ArrayAccess, Arrayable, Jsonab
|
||||
$this->data = $this->db()->find($this->getKey())->getData();
|
||||
$this->origin = $this->data;
|
||||
$this->get = [];
|
||||
$this->set = [];
|
||||
$this->readDataType();
|
||||
|
||||
if ($relation) {
|
||||
$this->relation = [];
|
||||
@@ -546,7 +543,7 @@ abstract class Model implements JsonSerializable, ArrayAccess, Arrayable, Jsonab
|
||||
|
||||
// 重新记录原始数据
|
||||
$this->origin = $this->data;
|
||||
$this->set = [];
|
||||
$this->get = [];
|
||||
$this->lazySave = false;
|
||||
|
||||
return true;
|
||||
@@ -613,8 +610,6 @@ abstract class Model implements JsonSerializable, ArrayAccess, Arrayable, Jsonab
|
||||
return true;
|
||||
}
|
||||
|
||||
$data = $this->writeDataType($data);
|
||||
|
||||
if ($this->autoWriteTimestamp && $this->updateTime) {
|
||||
// 自动写入更新时间
|
||||
$data[$this->updateTime] = $this->autoWriteTimestamp();
|
||||
@@ -677,7 +672,7 @@ abstract class Model implements JsonSerializable, ArrayAccess, Arrayable, Jsonab
|
||||
}
|
||||
|
||||
$this->checkData();
|
||||
$data = $this->writeDataType($this->data);
|
||||
$data = $this->data;
|
||||
|
||||
// 时间戳自动写入
|
||||
if ($this->autoWriteTimestamp) {
|
||||
@@ -709,6 +704,7 @@ abstract class Model implements JsonSerializable, ArrayAccess, Arrayable, Jsonab
|
||||
$pk = $this->getPk();
|
||||
|
||||
if (is_string($pk) && (!isset($this->data[$pk]) || '' == $this->data[$pk])) {
|
||||
unset($this->get[$pk]);
|
||||
$this->data[$pk] = $result;
|
||||
}
|
||||
}
|
||||
@@ -721,6 +717,7 @@ abstract class Model implements JsonSerializable, ArrayAccess, Arrayable, Jsonab
|
||||
|
||||
// 标记数据已经存在
|
||||
$this->exists = true;
|
||||
$this->origin = $this->data;
|
||||
|
||||
// 新增回调
|
||||
$this->trigger('AfterInsert');
|
||||
@@ -969,7 +966,6 @@ abstract class Model implements JsonSerializable, ArrayAccess, Arrayable, Jsonab
|
||||
{
|
||||
unset($this->data[$name],
|
||||
$this->get[$name],
|
||||
$this->set[$name],
|
||||
$this->relation[$name]);
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user