MatchItemPrize.php 865 字节
<?php
namespace app\common\model\match;

use think\Model;
use traits\model\SoftDelete;

class MatchItemPrize extends Model
{
    use SoftDelete;

    // 表名
    protected $name = 'match_item_prize';

    // 自动写入时间戳字段
    protected $autoWriteTimestamp = 'int';

    // 定义时间戳字段名
    protected $createTime = 'createtime';
    protected $updateTime = 'updatetime';
    protected $deleteTime = 'deletetime';

    /**
     * @return array
     * 奖项类型
     */
    public function getPrizeType()
    {
        return ['1' => __('一等奖'), '2' => __('二等奖'), '3' => __('三等奖')];
    }

    public function getGetTimeTextAttr($value, $data)
    {
        $value = $value ? $value : (isset($data['get_time']) ? $data['get_time'] : '');
        return is_numeric($value) ? date("Y-m-d H:i:s", $value) : $value;
    }

}