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()); }