request->post('cart_id', []); $addressId = (int)$this->request->post('address_id'); $pay_type = (int)$this->request->post('pay_type'); $auth_code = $this->request->post('auth_code'); //微信支付条码 $params=$this->request->post(); $res=OrderLogic::cartIdByOrderInfo($cartId,$addressId,null,$params); return $this->data($res); } /** * @notes 创建零售订单 */ public function createOrder(){ $user=User::where('id',$this->request->userId)->find(); $cartId = (Array)$this->request->post('cart_id', []); $addressId = (int)$this->request->post('address_id'); $pay_type = (int)$this->request->post('pay_type'); $auth_code = $this->request->post('auth_code'); //微信支付条码 $params=$this->request->post(); $order=OrderLogic::createOrder($cartId,$addressId,null,$params); if($order!=false){ if($pay_type==PayEnum::BALANCE_PAY){ $user=User::where('id',$this->request->userId)->find(); $res=RetailOrderLogic::payBalance($user,$order); if($res==true){ $res=RetailOrderLogic::paySuccess($order, ['money'=>$order['actual']]); if($res){ }else{ return $this->fail(RetailOrderLogic::getError()); } }else{ return $this->fail(RetailOrderLogic::getError()); } } return $this->data(['order_id'=>$order->id]); }else{ return $this->fail(OrderLogic::getError()); } } }