From a58fd191e53bfa193e3eab33935aa48f6f912045 Mon Sep 17 00:00:00 2001 From: ctexthuang Date: Mon, 13 Jan 2025 15:03:17 +0800 Subject: [PATCH] feat: good --- app/Controller/Admin/GoodController.php | 2 ++ app/Service/Admin/Good/CategoryService.php | 11 ++++++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/app/Controller/Admin/GoodController.php b/app/Controller/Admin/GoodController.php index a9cdb3c..a108273 100644 --- a/app/Controller/Admin/GoodController.php +++ b/app/Controller/Admin/GoodController.php @@ -156,6 +156,7 @@ class GoodController /** * category 列表 + * @param categoryRequest $request * @return array */ #[RequestMapping(path: "list_category", methods: "GET")] @@ -169,6 +170,7 @@ class GoodController * category 添加 * @param categoryRequest $request * @return array + * @throws Exception */ #[RequestMapping(path: "add_category", methods: "POST")] #[Scene(scene: "add_category")] diff --git a/app/Service/Admin/Good/CategoryService.php b/app/Service/Admin/Good/CategoryService.php index 8340811..7e3b553 100644 --- a/app/Service/Admin/Good/CategoryService.php +++ b/app/Service/Admin/Good/CategoryService.php @@ -36,7 +36,16 @@ class CategoryService extends BaseService if (empty($list)) return $this->return->success('success',['list' => []]); - return $this->return->success('success',['list' => $list->toArray()]); + $res = $list->toArray(); + + $ossIds = array_column($res['data'],'image_id'); + $ossInfo = $this->getOssObjects($ossIds); + foreach ($res['data'] as &$one) + { + $one['url'] = $ossInfo[$one['image_id']]['url']; + } + + return $this->return->success('success',['list' => $res]); } /**