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); } }