61 lines
1.3 KiB
PHP
Executable File
61 lines
1.3 KiB
PHP
Executable File
<?php
|
|
/**
|
|
* 会员管理模型
|
|
*/
|
|
namespace app\model;
|
|
|
|
use laytp\BaseModel;
|
|
use think\model\concern\SoftDelete;
|
|
|
|
class Bot extends BaseModel
|
|
{
|
|
use SoftDelete;
|
|
|
|
//模型名
|
|
protected $name = 'admin_bot';
|
|
|
|
//附加属性
|
|
protected $append = ['create_time_int','update_time_int','delete_time_int'];
|
|
|
|
//时间戳字段转换
|
|
protected $type = [
|
|
'create_time_int' => 'timestamp:Y-m-d H:i:s',
|
|
'update_time_int' => 'timestamp:Y-m-d H:i:s',
|
|
'delete_time_int' => 'timestamp:Y-m-d H:i:s',
|
|
];
|
|
|
|
//表名
|
|
|
|
|
|
//关联模型
|
|
public function avatarPicFile(){
|
|
return $this->belongsTo('app\model\Files','avatar_pic','id');
|
|
}
|
|
|
|
//新增属性的方法
|
|
public function getVipTimeIntAttr($value, $data)
|
|
{
|
|
return isset($data['vip_time']) ? $data['vip_time'] : 0;
|
|
}
|
|
|
|
public function getLoginTimeIntAttr($value, $data)
|
|
{
|
|
return isset($data['login_time']) ? strtotime($data['login_time']) : 0;
|
|
}
|
|
|
|
public function getCreateTimeIntAttr($value, $data)
|
|
{
|
|
return isset($data['create_time']) ? strtotime($data['create_time']) : 0;
|
|
}
|
|
|
|
public function getUpdateTimeIntAttr($value, $data)
|
|
{
|
|
return isset($data['update_time']) ? strtotime($data['update_time']) : 0;
|
|
}
|
|
|
|
public function getDeleteTimeIntAttr($value, $data)
|
|
{
|
|
return isset($data['delete_time']) ? strtotime($data['delete_time']) : 0;
|
|
}
|
|
}
|