<?php

namespace app\admin\model;

use think\Model;


class Partytype extends Model
{

    

    

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

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

    // 追加属性
    protected $append = [
        'room_type_text'
    ];
    

    
    public function getRoomTypeList()
    {
        return ['1' => __('Room_type 1'), '2' => __('Room_type 2')];
    }


    public function getRoomTypeTextAttr($value, $data)
    {
        $value = $value ? $value : (isset($data['room_type']) ? $data['room_type'] : '');
        $list = $this->getRoomTypeList();
        return isset($list[$value]) ? $list[$value] : '';
    }




}
