Active.php 1.1 KB

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