فهرست منبع

Merge branch 'master' of http://git.9026.com/swdz-WangHaijun/BaoMa

whj 4 سال پیش
والد
کامیت
a3e8e9f9e7
1فایلهای تغییر یافته به همراه2 افزوده شده و 2 حذف شده
  1. 2 2
      app/Models/Order.php

+ 2 - 2
app/Models/Order.php

xqd
@@ -292,14 +292,14 @@ class Order extends BaseModel
         //如果是门诊预约且距离预约时间还有1个小时以上,那么预约时间段的订单数减1
         if ($order['product_type'] == 3 && $can_refund) {
             $schedule_date = date('Y-m-d', $order['order_patient']['appoint_start_time']);
-            SchedulePeriod::where('docter_id', $order['docter_id'])->where('organization_id', $order['organization_id'])->where('time_period_id', $order['order_patient']['time_period_id'])->where('schedule_date', $schedule_date)->decrement('order_num');
+            SchedulePeriod::where('docter_id', $order['docter_id'])->where('organization_id', $order['organization_id'])->where('time_period_id', $order['order_patient']['time_period_id'])->where('schedule_date', $schedule_date)->where('order_num', '>', 0)->decrement('order_num');
         }
 
         //如果是疫苗儿保预约且距离预约时间还有1个小时以上,那么预约时间段的订单数减1
         if (in_array($order['product_type'], [4,5]) && $can_refund) {
             $schedule_type_map = [4 => 2, 5 => 3];
             $schedule_date = date('Y-m-d', $order['order_patient']['appoint_start_time']);
-            SchedulePeriod::where('organization_id', $order['organization_id'])->where('time_period_id', $order['order_patient']['time_period_id'])->where('schedule_date', $schedule_date)->where('schedule_type', $schedule_type_map[$order['product_type']])->decrement('order_num');
+            SchedulePeriod::where('organization_id', $order['organization_id'])->where('time_period_id', $order['order_patient']['time_period_id'])->where('schedule_date', $schedule_date)->where('schedule_type', $schedule_type_map[$order['product_type']])->where('order_num', '>', 0)->decrement('order_num');
         }
         //如果是疫苗预约那么取消订单就增加疫苗库存
         if ($order['product_type'] == 4) {