Cartcalculate.php 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. <?php
  2. /**
  3. * Index.php
  4. * Niushop商城系统 - 团队十年电商经验汇集巨献!
  5. * =========================================================
  6. * Copy right 2015-2025 杭州牛之云科技有限公司, 保留所有权利。
  7. * ----------------------------------------------
  8. * 官方网址: https://www.niushop.com
  9. * =========================================================
  10. * @author : niuteam
  11. * @date : 2022.8.8
  12. * @version : v5.0.0.1
  13. */
  14. namespace app\api\controller;
  15. use app\model\cart\CartCalculate as CartCalculateModel;
  16. /**
  17. * 购物车计算
  18. * @author Administrator
  19. *
  20. */
  21. class Cartcalculate extends BaseApi
  22. {
  23. /**
  24. * 购物车计算
  25. */
  26. public function calculate()
  27. {
  28. $token = $this->checkToken();
  29. if ($token[ 'code' ] < 0) return $this->response($token);
  30. $sku_ids = isset($this->params[ 'sku_ids' ]) ? json_decode($this->params[ 'sku_ids' ], true) : [];
  31. $data = [
  32. 'sku_ids' => $sku_ids,
  33. 'site_id' => $this->site_id,//站点id
  34. 'member_id' => $this->member_id,
  35. 'order_from' => $this->params[ 'app_type' ],
  36. 'order_from_name' => $this->params[ 'app_type_name' ],
  37. ];
  38. $cart_calculate_model = new CartCalculateModel();
  39. $res = $cart_calculate_model->calculate($data);
  40. return $this->response($this->success($res));
  41. }
  42. }