<?php namespace app\admin\model; use think\Model; class JoinUs extends Model { // 表名 protected $name = 'join_us'; // 自动写入时间戳字段 protected $autoWriteTimestamp = 'int'; // 定义时间戳字段名 protected $createTime = 'createtime'; protected $updateTime = false; protected $deleteTime = false; // 追加属性 protected $append = [ 'team_text' ]; public function getTeamList() { return ['0' => __('Team 0'), '1' => __('Team 1')]; } public function getTeamTextAttr($value, $data) { $value = $value ? $value : (isset($data['team']) ? $data['team'] : ''); $list = $this->getTeamList(); return isset($list[$value]) ? $list[$value] : ''; } }