<?php

namespace app\admin\model\users;

use think\Model;


class Usermoneylog extends Model
{

    

    

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

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

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

    
    public function getHeatosList()
    {
        return ['1' => __('Heatos 1'), '-1' => __('Heatos -1')];
    }


    public function getHeatosTextAttr($value, $data)
    {
        $value = $value ? $value : (isset($data['heatos']) ? $data['heatos'] : '');
        $list = $this->getHeatosList();
        return isset($list[$value]) ? $list[$value] : '';
    }

    public function users()
    {
        return self::hasOne("app\admin\model\users\Users",'id',"user_id");

    }


}
