活动添加类型

wysf
ztt 9 months ago
parent 511f78eb7d
commit 7efe283f5a
  1. 16
      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());
}

Loading…
Cancel
Save