You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
61 lines
1.3 KiB
61 lines
1.3 KiB
<?php
|
|
|
|
namespace app\admin\model\user;
|
|
|
|
use think\Model;
|
|
|
|
|
|
class Withdraw extends Model
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
// 表名
|
|
protected $name = 'user_withdraw';
|
|
|
|
// 自动写入时间戳字段
|
|
protected $autoWriteTimestamp = 'integer';
|
|
|
|
// 定义时间戳字段名
|
|
protected $createTime = 'create_time';
|
|
protected $updateTime = 'update_time';
|
|
protected $deleteTime = false;
|
|
|
|
// 追加属性
|
|
protected $append = [
|
|
'create_time_text',
|
|
'update_time_text'
|
|
];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public function getCreateTimeTextAttr($value, $data)
|
|
{
|
|
$value = $value ? $value : (isset($data['create_time']) ? $data['create_time'] : '');
|
|
return is_numeric($value) ? date("Y-m-d H:i:s", $value) : $value;
|
|
}
|
|
|
|
|
|
public function getUpdateTimeTextAttr($value, $data)
|
|
{
|
|
$value = $value ? $value : (isset($data['update_time']) ? $data['update_time'] : '');
|
|
return is_numeric($value) ? date("Y-m-d H:i:s", $value) : $value;
|
|
}
|
|
|
|
protected function setCreateTimeAttr($value)
|
|
{
|
|
return $value === '' ? null : ($value && !is_numeric($value) ? strtotime($value) : $value);
|
|
}
|
|
|
|
protected function setUpdateTimeAttr($value)
|
|
{
|
|
return $value === '' ? null : ($value && !is_numeric($value) ? strtotime($value) : $value);
|
|
}
|
|
|
|
|
|
}
|
|
|