Ai_GirlFriend/xunifriend_RaeeC/application/admin/model/voice/Library.php
2026-01-31 19:15:41 +08:00

50 lines
860 B
PHP

<?php
namespace app\admin\model\voice;
use think\Model;
use traits\model\SoftDelete;
class Library extends Model
{
use SoftDelete;
// 表名
protected $name = 'voice_library';
// 自动写入时间戳字段
protected $autoWriteTimestamp = 'integer';
// 定义时间戳字段名
protected $createTime = 'createtime';
protected $updateTime = 'updatetime';
protected $deleteTime = 'deletetime';
// 追加属性
protected $append = [
'gender_text'
];
public function getGenderList()
{
return ['male' => __('Gender male'), 'female' => __('Gender female')];
}
public function getGenderTextAttr($value, $data)
{
$value = $value ?: ($data['gender'] ?? '');
$list = $this->getGenderList();
return $list[$value] ?? '';
}
}