模型数据修改时时间空间无法更新的bug

This commit is contained in:
2018-05-09 11:03:50 +08:00
parent b1b7b00362
commit 5eb55d9195

View File

@@ -20,8 +20,8 @@ class BaseModel {
protected $data;
protected $autoWriteTimestamp = true;
protected $auto = array('update_time');
protected $insert = array('create_time');
protected $auto = array();
protected $insert = array();
protected $update = array();
// 创建时间字段
protected $createTime = 'create_time';
@@ -60,6 +60,13 @@ class BaseModel {
if ($value['is_must'] == 1 && $value['is_show'] == 0) {
$this->data[$value['name']] = $value['value'];
}
if ($value['type'] == 'datetime' || $value['type'] == 'date') {
if (isset($data[$value['name']]) && $data[$value['name']]) {
$this->data[$value['name']] = strtotime($data[$value['name']]);
}else{
$this->data[$value['name']] = time();
}
}
}
$this->autoCompleteData($this->auto);
if (!empty($where)) {