<?php
namespace app\model;

use think\Model;


class History extends Model
{

    protected $table = "jm_history";

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

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


    protected $append = [
        'search_time'
    ];


    public function getContentAttr($value)
    {
        return $value ? json_decode($value) : '';
    }


    public function getSearchTimeAttr($value , $data)
    {
        return isset($data['createtime']) ? date('Y/m/d' , $data['createtime']) : '';
    }

}
