<?php

namespace app\admin\model;

use think\Model;


class Userwallet extends Model
{

    

    

    // 表名
    protected $table = 'user_wallet';
    
    // 自动写入时间戳字段
    protected $autoWriteTimestamp = false;

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

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

    
    public function getIntroLevelList()
    {
        return ['-1' => __('Intro_level -1'), '0' => __('Intro_level 0'), '1' => __('Intro_level 1'), '2' => __('Intro_level 2'), '3' => __('Intro_level 3'), '4' => __('Intro_level 4'), '5' => __('Intro_level 5')];
    }


    public function getIntroLevelTextAttr($value, $data)
    {
        $value = $value ? $value : (isset($data['intro_level']) ? $data['intro_level'] : '');
        $list = $this->getIntroLevelList();
        return isset($list[$value]) ? $list[$value] : '';
    }




    public function user()
    {
        return $this->belongsTo('User', 'user_id', 'id', [], 'LEFT')->setEagerlyType(0);
    }
}
