From 7efe283f5a3696722e7078cd1b29fe1c7f261aca Mon Sep 17 00:00:00 2001 From: ztt <835303992@qq.com> Date: Wed, 6 Mar 2024 09:24:24 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B4=BB=E5=8A=A8=E6=B7=BB=E5=8A=A0=E7=B1=BB?= =?UTF-8?q?=E5=9E=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/api/controller/Active.php | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/app/api/controller/Active.php b/app/api/controller/Active.php index 8b85cf68..968c3722 100644 --- a/app/api/controller/Active.php +++ b/app/api/controller/Active.php @@ -43,11 +43,25 @@ class Active extends Controller */ public function info(): Json{ $model = new ActiveMain(); - $data = $model->where('id',1) + $type = $this->request->param('type'); + $data = $model + ->where('type', $type) ->field('id,name,title')->find(); if (!$data) { return $this->renderSuccess('暂无数据'); } + + $list = $model->getList(['active_id' => $data['id']]); + if ($list) { + foreach ($list['col'] as $k => $row) { + $goodsModel = new GoodsModel(); + $goods_list = $goodsModel->getListByIdsFromApi(explode(',', $row['col_goods_ids'])); + // 隐藏冗余的属性 + $goods_list->hidden(GoodsModel::getHidden(['content', 'goods_images', 'images'])); + $list['col'][$k]['goods_list'] = $goods_list; + } + return $this->renderSuccess($list->toArray()); + } return $this->renderSuccess($data->toArray()); }