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.
ymww_backend/application/admin/model/user/Withdraw.php

62 lines
1.3 KiB

1 year ago
<?php
namespace app\admin\model\user;
use think\Model;
class Withdraw extends Model
{
// 表名
protected $name = 'user_withdraw';
// 自动写入时间戳字段
1 year ago
protected $autoWriteTimestamp = 'integer';
1 year ago
// 定义时间戳字段名
1 year ago
protected $createTime = 'create_time';
protected $updateTime = 'update_time';
1 year ago
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);
}
}