| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293 |
- <?php
- /**
- * Niushop商城系统 - 团队十年电商经验汇集巨献!
- * =========================================================
- * Copy right 2019-2029 上海牛之云网络科技有限公司, 保留所有权利。
- * ----------------------------------------------
- * 官方网址: https://www.niushop.com
- * 这不是一个自由软件!您只能在不用于商业目的的前提下对程序代码进行修改和使用。
- * 任何企业和个人不允许对程序代码以任何形式任何目的再发布。
- * =========================================================
- */
- namespace addon\store\shopapi\controller;
- use addon\store\model\order\OrderCreate as OrderCreateModel;
- /**
- * 订单创建(收银台)
- * Class OrderRefund
- * @package addon\shop\siteapi\controller
- */
- class Ordercreate extends BaseStoreApi
- {
- public function payment()
- {
- $token = $this->checkToken();
- if ($token[ 'code' ] < 0) return $this->response($token);
- $order_id = $this->params[ 'order_id' ] ?? 0;
- $order_create_model = new OrderCreateModel();
- $data = [
- 'site_id' => $this->site_id,//站点id
- 'order_id' => $order_id,
- 'member_id' => $this->params[ 'member_id' ] ?? 0,//购买会员(可有可无)
- 'store_id' => $this->store_id ?? 0,
- 'app_module' => $this->site_type,
- 'coupon_id' => $this->params[ 'coupon_id' ] ?? '',
- 'is_use_balance' => $this->params[ 'is_use_balance' ] ?? 0,
- 'is_use_point' => $this->params[ 'is_use_point' ] ?? 0,
- 'hongbao_id' => $this->params[ 'hongbao_id' ] ?? 0,
- 'order_from' => $this->params[ 'order_from' ] ?? 'h5',
- 'promotion_type' => '',
- 'source' => $this->params[ 'source' ] ?? '',// is_buy 普通购买 cart 购物车 ‘’ 参与活动,
- 'promotion_extend' => empty($this->params[ 'promotion_extend' ]) ? [] : json_decode($this->params[ 'promotion_extend' ], true)
- ];
- if (empty($data[ 'sku_array' ])) {
- return $this->response($this->error('', '缺少必填参数商品数据'));
- }
- $res = $order_create_model->orderPayment($data);
- return $this->response($res);
- }
- /**
- * 商品计算
- * @return false|string
- */
- public function calculate()
- {
- $token = $this->checkToken();
- if ($token[ 'code' ] < 0) return $this->response($token);
- $order_create_model = new OrderCreateModel();
- $data = [
- 'site_id' => $this->site_id,//站点id
- 'sku_array' => !empty($this->params[ 'sku_array' ]) ? json_decode($this->params[ 'sku_array' ], true) : [],
- 'member_id' => $this->params[ 'member_id' ] ?? 0,//购买会员(可有可无)
- 'app_module' => $this->site_type,
- 'store_id' => $this->params[ 'store_id' ] ?? 0,
- 'mobile' => $this->params[ 'mobile' ] ?? '',
- 'coupon_id' => $this->params[ 'coupon_id' ] ?? 0,
- 'is_use_balance' => $this->params[ 'is_use_balance' ] ?? 0,
- 'is_use_point' => $this->params[ 'is_use_point' ] ?? 0,
- 'hongbao_id' => $this->params[ 'hongbao_id' ] ?? 0,
- 'order_from' => $this->params[ 'order_from' ] ?? 'h5',
- 'promotion_type' => '',
- 'source' => $this->params[ 'source' ] ?? '',// is_buy 普通购买 cart 购物车 ‘’ 参与活动,
- 'promotion_extend' => empty($this->params[ 'promotion_extend' ]) ? [] : json_decode($this->params[ 'promotion_extend' ], true)
- ];
- if (empty($data[ 'sku_array' ])) {
- return $this->response($this->error('', '缺少必填参数商品数据'));
- }
- $res = $order_create_model->calculate($data);
- return $this->response($res);
- }
- }
|