Active.php 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. <?php
  2. namespace app\api\controller\sharing;
  3. use app\api\controller\Controller;
  4. use app\api\model\sharing\Active as ActiveModel;
  5. use app\api\model\sharing\Goods as GoodsModel;
  6. /**
  7. * 拼团拼单控制器
  8. * Class Active
  9. * @package app\api\controller\sharing
  10. */
  11. class Active extends Controller
  12. {
  13. /**
  14. * 拼单详情
  15. * @param $active_id
  16. * @return array
  17. * @throws \app\common\exception\BaseException
  18. * @throws \think\exception\DbException
  19. */
  20. public function detail($active_id)
  21. {
  22. // 拼单详情
  23. $detail = ActiveModel::detail($active_id);
  24. if (!$detail) {
  25. return $this->renderError('很抱歉,拼单不存在');
  26. }
  27. // 拼团商品详情
  28. $model = new GoodsModel;
  29. $goods = $model->getDetails($detail['goods_id'], $this->getUser(false));
  30. // 更多拼团商品
  31. $goodsList = $model->getList([], $this->getUser(false));
  32. return $this->renderSuccess(compact('detail', 'goods', 'goodsList'));
  33. }
  34. }