<?php

namespace app\admin\model\project;

use think\Model;


class ProjectDonationUser extends Model
{

    

    

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

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

    // 追加属性
    protected $append = [
        'anonymous_text',
        'invoice_text',
        'user_type_text'
    ];
    

    
    public function getAnonymousList()
    {
        return ['0' => __('Anonymous 0'), '1' => __('Anonymous 1')];
    }

    public function getInvoiceList()
    {
        return ['0' => __('Invoice 0'), '1' => __('Invoice 1')];
    }

    public function getUserTypeList()
    {
        return ['0' => __('User_type 0'), '1' => __('User_type 1')];
    }


    public function getAnonymousTextAttr($value, $data)
    {
        $value = $value ? $value : (isset($data['anonymous']) ? $data['anonymous'] : '');
        $list = $this->getAnonymousList();
        return isset($list[$value]) ? $list[$value] : '';
    }


    public function getInvoiceTextAttr($value, $data)
    {
        $value = $value ? $value : (isset($data['invoice']) ? $data['invoice'] : '');
        $list = $this->getInvoiceList();
        return isset($list[$value]) ? $list[$value] : '';
    }


    public function getUserTypeTextAttr($value, $data)
    {
        $value = $value ? $value : (isset($data['user_type']) ? $data['user_type'] : '');
        $list = $this->getUserTypeList();
        return isset($list[$value]) ? $list[$value] : '';
    }




}
