コード例 #1
0
ファイル: OrderService.php プロジェクト: hachi-zzq/dajiayao
 public function update(Order $order, $itemTotal, $grandTotal, $discount_total, $amount_tendered, $isAnonymous, $postage, $orderType, $receiverAddressId)
 {
     $order->item_total = $itemTotal;
     $order->grand_total = $grandTotal;
     $order->discount_total = $discount_total;
     $order->amount_tendered = $amount_tendered;
     $order->postage = $postage;
     $order->order_type = $orderType;
     $order->receiver_address_id = $receiverAddressId;
     $buyerAddr = BuyerAddress::find($receiverAddressId);
     if (!$buyerAddr) {
         throw new \Exception(sprintf("buyer addr id : %s not found in db", ${$receiverAddressId}));
     }
     $order->receiver_address = $buyerAddr->address;
     $address = $buyerAddr->addresses;
     $county = $address->address;
     $city = $address->getFather();
     $province = $city->getFather();
     $order->receiver_full_address = $province->address . $city->address . $county . $buyerAddr->address;
     $order->receiver = $buyerAddr->receiver;
     $order->receiver_phone = $buyerAddr->mobile;
     $order->receiver_postcode = $buyerAddr->postcode;
     $order->is_anonymous = $isAnonymous;
     $order->deliver_status = Order::DELIVER_STATUS_NO;
     $order->payment_type = Order::PAYMENT_TYPE_WX;
     $order->payment_status = Order::PAY_STATUS_NO;
     $order->status = Order::STATUS_TO_PAY;
     $order->save();
     return $order->id;
 }