Bundling.php 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. <?php
  2. /**
  3. * Niushop商城系统 - 团队十年电商经验汇集巨献!
  4. * =========================================================
  5. * Copy right 2019-2029 杭州牛之云科技有限公司, 保留所有权利。
  6. * ----------------------------------------------
  7. * 官方网址: https://www.niushop.com
  8. * =========================================================
  9. */
  10. namespace addon\bundling\api\controller;
  11. use app\api\controller\BaseApi;
  12. use addon\bundling\model\Bundling as BundlingModel;
  13. /**
  14. * 组合套餐
  15. */
  16. class Bundling extends BaseApi
  17. {
  18. /**
  19. * sku所关联有关组合套餐
  20. * @param int $id
  21. * @return false|string
  22. */
  23. public function lists($id = 0)
  24. {
  25. $sku_id = isset($this->params[ 'sku_id' ]) ? $this->params[ 'sku_id' ] : 0;
  26. if (!empty($id)) {
  27. $sku_id = $id;
  28. }
  29. if (empty($sku_id)) {
  30. return $this->response($this->error('', 'REQUEST_SKU_ID'));
  31. }
  32. $bundling_model = new BundlingModel();
  33. $info = $bundling_model->getBundlingGoodsNew($sku_id);
  34. return $this->response($info);
  35. }
  36. /**
  37. * 详情信息
  38. */
  39. public function detail()
  40. {
  41. $bl_id = isset($this->params[ 'bl_id' ]) ? $this->params[ 'bl_id' ] : 0;
  42. if (empty($bl_id)) {
  43. return $this->response($this->error('', 'REQUEST_BL_ID'));
  44. }
  45. $bundling_model = new BundlingModel();
  46. $info = $bundling_model->getBundlingDetail([ [ 'bl_id', '=', $bl_id ] ]);
  47. return $this->response($info);
  48. }
  49. }