nizongfeng преди 3 години
родител
ревизия
76cb000851
променени са 4 файла, в които са добавени 57 реда и са изтрити 0 реда
  1. +22
    -0
      application/admin/service/OrderHotelDao.php
  2. +22
    -0
      application/admin/service/OrderItemDao.php
  3. +8
    -0
      application/admin/service/PaymentOrderService.php
  4. +5
    -0
      application/admin/service/ReceiptOrderService.php

+ 22
- 0
application/admin/service/OrderHotelDao.php Целия файл

@@ -297,4 +297,26 @@ class OrderHotelDao
return Util::returnArrEr("将酒店订单从付款单下移除失败".$e->getMessage());
}
}

/**
* 获取主订单ID
* @param $payment_order_id
* @return array
*/
public function getOrderMainIdByPayment($payment_order_id){
$subOrderModel = new OrderHotel();
try {
$subOrderList = $subOrderModel->where(["payment_order_id" => $payment_order_id, "del_flag" => 0])->select()->toArray();
if (null == $subOrderList) {
return [];
}
$id = [];
foreach ($subOrderList as $val){
$id[] = $val['order_id'];
}
return array_unique($id);
}catch (Exception $e) {
return [];
}
}
}

+ 22
- 0
application/admin/service/OrderItemDao.php Целия файл

@@ -247,4 +247,26 @@ class OrderItemDao
return Util::returnArrEr("将附加项目订单从付款单下移除失败".$e->getMessage());
}
}

/**
* 获取主订单ID
* @param $payment_order_id
* @return array
*/
public function getOrderMainIdByPayment($payment_order_id){
$subOrderModel = new OrderItem();
try {
$subOrderList = $subOrderModel->where(["payment_order_id" => $payment_order_id, "del_flag" => 0])->select()->toArray();
if (null == $subOrderList) {
return [];
}
$id = [];
foreach ($subOrderList as $val){
$id[] = $val['order_id'];
}
return array_unique($id);
}catch (Exception $e) {
return [];
}
}
}

+ 8
- 0
application/admin/service/PaymentOrderService.php Целия файл

@@ -68,6 +68,14 @@ class PaymentOrderService
Db::rollback();
return $itemRe;
}
//3.获取所有子订单对应的主订单ID
$hotelIds = $hotelDao->getOrderMainIdByPayment($id);
$itemIds = $itemDao->getOrderMainIdByPayment($id);
$orderMainIds = array_unique(array_merge($hotelIds,$itemIds));
$orderMainDao = new OrderMainDao();
foreach ($orderMainIds as $orderId) {
$orderMainDao->setOrderAmount($orderId);
}
Db::commit();
return Util::returnArrSu();
}


+ 5
- 0
application/admin/service/ReceiptOrderService.php Целия файл

@@ -64,6 +64,11 @@ class ReceiptOrderService
Db::rollback();
return $orderRe;
}
//3.设置订单状态
$setRe = $orderDao->setOrderAmount($id);
if (!$setRe['flag']) {
return $setRe;
}
Db::commit();
return Util::returnArrSu();



Зареждане…
Отказ
Запис