mirror of
https://gitee.com/fastadminnet/framework.git
synced 2026-07-06 23:02:48 +08:00
改进getdbfields方法
This commit is contained in:
@@ -881,9 +881,10 @@ class Model
|
|||||||
unset($fields['_pk'], $fields['_type']);
|
unset($fields['_pk'], $fields['_type']);
|
||||||
return $fields;
|
return $fields;
|
||||||
} else {
|
} else {
|
||||||
$fields = Cache::get(md5($this->getTableName()));
|
$tableName = $this->getTableName();
|
||||||
|
$fields = Cache::get(md5($tableName));
|
||||||
if (!$fields) {
|
if (!$fields) {
|
||||||
$fields = $this->db->getFields($this->getTableName());
|
$fields = $this->db->getFields($tableName);
|
||||||
$this->fields = array_keys($fields);
|
$this->fields = array_keys($fields);
|
||||||
foreach ($fields as $key => $val) {
|
foreach ($fields as $key => $val) {
|
||||||
// 记录字段类型
|
// 记录字段类型
|
||||||
@@ -905,7 +906,7 @@ class Model
|
|||||||
}
|
}
|
||||||
// 记录字段类型信息
|
// 记录字段类型信息
|
||||||
$this->fields['_type'] = $type;
|
$this->fields['_type'] = $type;
|
||||||
Cache::set(md5($this->trueTableName), $this->fields);
|
Cache::set(md5($tableName), $this->fields);
|
||||||
$fields = $this->fields;
|
$fields = $this->fields;
|
||||||
} else {
|
} else {
|
||||||
$this->fields = $fields;
|
$this->fields = $fields;
|
||||||
|
|||||||
Reference in New Issue
Block a user