新增功能
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
namespace app\common\model;
|
||||
|
||||
use app\common\model\BaseModel;
|
||||
use think\model\concern\SoftDelete;
|
||||
|
||||
class Fan extends BaseModel
|
||||
{
|
||||
use SoftDelete;
|
||||
|
||||
protected $name = 'fan';
|
||||
protected $autoWriteTimestamp = true;
|
||||
protected $createTime = 'create_time';
|
||||
protected $updateTime = 'update_time';
|
||||
protected $deleteTime = 'delete_time';
|
||||
protected $dateFormat = false;
|
||||
|
||||
public function getGenderDescAttr($value, $data)
|
||||
{
|
||||
$gender = [0 => '未知', 1 => '男', 2 => '女'];
|
||||
return $gender[$data['gender']] ?? '未知';
|
||||
}
|
||||
|
||||
public function getStatusDescAttr($value, $data)
|
||||
{
|
||||
$status = [0 => '禁用', 1 => '启用'];
|
||||
return $status[$data['status']] ?? '未知';
|
||||
}
|
||||
|
||||
public function visitRecords()
|
||||
{
|
||||
return $this->hasMany(FanVisitRecord::class, 'fan_id', 'id');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user