From 511df78a136ecb5feefc58882d597bd1bfaa537b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E6=99=AF=E7=AB=8B?= Date: Fri, 15 Apr 2022 21:51:59 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=95=86=E5=93=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/data/model/ShopGoods.php | 10 +++++++++- app/data/model/ShopGoodsCate.php | 10 ++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/app/data/model/ShopGoods.php b/app/data/model/ShopGoods.php index da333441c..0b414645e 100644 --- a/app/data/model/ShopGoods.php +++ b/app/data/model/ShopGoods.php @@ -11,5 +11,13 @@ use think\admin\Model; */ class ShopGoods extends Model { - + /** + * 格式化创建时间 + * @param string $value + * @return string + */ + public function getCreateAtAttr(string $value): string + { + return format_datetime($value); + } } \ No newline at end of file diff --git a/app/data/model/ShopGoodsCate.php b/app/data/model/ShopGoodsCate.php index 9a47c9965..b269b3364 100644 --- a/app/data/model/ShopGoodsCate.php +++ b/app/data/model/ShopGoodsCate.php @@ -75,4 +75,14 @@ class ShopGoodsCate extends Model foreach ($cates as &$cate) unset($cate['parent']); return array_values($cates); } + + /** + * 格式化创建时间 + * @param string $value + * @return string + */ + public function getCreateAtAttr(string $value): string + { + return format_datetime($value); + } } \ No newline at end of file