<?php

namespace app\admin\model\books;

use think\Model;


class BooksArrangement extends Model
{





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

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

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

    // 追加属性
    protected $append = [
        'is_deleted_text',
        'status_text'
    ];



    public function getIsDeletedList()
    {
        return ['0' => __('是'), '1' => __('否')];
    }

    public function getStatusList()
    {
        return ['0' => __('启用'), '1' => __('禁用')];
    }


    public function getIsDeletedTextAttr($value, $data)
    {
        $value = $value ? $value : (isset($data['is_deleted']) ? $data['is_deleted'] : '');
        $list = $this->getIsDeletedList();
        return isset($list[$value]) ? $list[$value] : '';
    }


    public function getStatusTextAttr($value, $data)
    {
        $value = $value ? $value : (isset($data['status']) ? $data['status'] : '');
        $list = $this->getStatusList();
        return isset($list[$value]) ? $list[$value] : '';
    }




}
