checkToken(); if ($token['code'] < 0) return $this->response($token); $order_create = new OrderCreateModel(); $data = [ 'bl_id' => isset($this->params['bl_id']) ? $this->params['bl_id'] : '',//组合套餐id 'num' => isset($this->params['num']) ? $this->params['num'] : 1,//组合套餐数量(买几套) 'member_id' => $this->member_id, 'order_from' => $this->params['app_type'], 'order_from_name' => $this->params['app_type_name'], 'is_balance' => isset($this->params['is_balance']) ? $this->params['is_balance'] : 0,//是否使用余额 'pay_password' => isset($this->params['pay_password']) ? $this->params['pay_password'] : '',//支付密码 'buyer_message' => $this->params['buyer_message'], 'delivery' => isset($this->params["delivery"]) && !empty($this->params["delivery"]) ? json_decode($this->params["delivery"], true) : [], 'coupon' => isset($this->params["coupon"]) && !empty($this->params["coupon"]) ? json_decode($this->params["coupon"], true) : [], 'member_address' => isset($this->params["member_address"]) && !empty($this->params["member_address"]) ? json_decode($this->params["member_address"], true) : [] ]; if (empty($data['bl_id'])) { return $this->response($this->error('', '缺少必填参数商品数据')); } $res = $order_create->create($data); return $this->response($res); } /** * 计算信息 */ public function calculate() { $token = $this->checkToken(); if ($token['code'] < 0) return $this->response($token); $order_create = new OrderCreateModel(); $data = [ 'bl_id' => isset($this->params['bl_id']) ? $this->params['bl_id'] : '',//组合套餐id 'num' => isset($this->params['num']) ? $this->params['num'] : 1,//组合套餐数量(买几套) 'member_id' => $this->member_id, 'order_from' => $this->params['app_type'], 'order_from_name' => $this->params['app_type_name'], 'is_balance' => isset($this->params['is_balance']) ? $this->params['is_balance'] : 0,//是否使用余额 'delivery' => isset($this->params["delivery"]) && !empty($this->params["delivery"]) ? json_decode($this->params["delivery"], true) : [], 'coupon' => isset($this->params["coupon"]) && !empty($this->params["coupon"]) ? json_decode($this->params["coupon"], true) : [], 'member_address' => isset($this->params["member_address"]) && !empty($this->params["member_address"]) ? json_decode($this->params["member_address"], true) : [] ]; if (empty($data['bl_id'])) { return $this->response($this->error('', '缺少必填参数商品数据')); } $res = $order_create->calculate($data); return $this->response($this->success($res)); } /** * 待支付订单 数据初始化 * @return string */ public function payment() { $token = $this->checkToken(); if ($token['code'] < 0) return $this->response($token); $order_create = new OrderCreateModel(); $data = [ 'bl_id' => isset($this->params['bl_id']) ? $this->params['bl_id'] : '', 'num' => isset($this->params['num']) ? $this->params['num'] : '', 'member_id' => $this->member_id, 'order_from' => $this->params['app_type'], 'is_balance' => isset($this->params['is_balance']) ? $this->params['is_balance'] : 0,//是否使用余额 'order_from_name' => $this->params['app_type_name'] ]; if (empty($data['bl_id'])) { return $this->response($this->error('', '缺少必填参数商品数据')); } $res = $order_create->orderPayment($data); return $this->response($this->success($res)); } }