<?php namespace app\api\model; use think\Model; class Tax extends Model { // 自动写入时间戳字段 protected $autoWriteTimestamp = 'int'; protected $createTime = 'createtime'; protected $updateTime = ''; protected $append = [ 'tax_time_text' ]; public function getTaxTimeTextAttr($value,$data) { $value = !empty($data['tax_time'])?date('Y年m月d日'):''; return $value; } }