www.maiwd.cn // +---------------------------------------------------------------------- namespace app\admin\model\wdsxh\member; use think\Model; class Cert extends Model { // 表名 protected $name = 'wdsxh_member_cert'; // 自动写入时间戳字段 protected $autoWriteTimestamp = 'integer'; // 定义时间戳字段名 protected $createTime = 'createtime'; protected $updateTime = 'updatetime'; protected $deleteTime = false; // 追加属性 protected $append = [ 'channel_text' ]; public function getChannelList() { return ['1' => __('Channel 1'), '2' => __('Channel 2')]; } public function getChannelTextAttr($value, $data) { $value = $value ? $value : (isset($data['channel']) ? $data['channel'] : ''); $list = $this->getChannelList(); return isset($list[$value]) ? $list[$value] : ''; } public function member() { return $this->belongsTo('app\admin\model\wdsxh\member\Member','member_id','id')->setEagerlyType(0); } }