Order.php 547 字节
<?php


namespace app\api\model;


use think\Model;

class Order extends Model
{
    protected $name = 'litestore_order';
    protected $createTime = 'createtime';
    protected $updateTime = 'updatetime';
    protected $append = [
        'createtime_text'
    ];

    public function getCreatetimeTextAttr($value,$data)
    {
        $value = !empty($data['createtime']) ? date('Y-m-d',$data['createtime']) : '';
        return $value;
    }

    public function goods()
    {
        return $this->hasMany('OrderGoods','order_id','id');
    }
}