Procházet zdrojové kódy

美团对接-第三方订单-重新预定更新改约时间

fang před 1 rokem
rodič
revize
f1b154a7cf
1 změnil soubory, kde provedl 19 přidání a 0 odebrání
  1. 19 0
      app/common/logic/ThirdOrderLogic.php

+ 19 - 0
app/common/logic/ThirdOrderLogic.php

@@ -227,6 +227,25 @@ class ThirdOrderLogic extends BaseLogic
                 return false;
             }
         }
+
+        if(!empty($orderData['work_id']) and !$product->isEmpty() and !empty($product['goods_id'])) {
+            //更改预约时间
+            $serviceWorkInfo = ServiceWork::find($orderData['work_id']);
+            if(!empty($serviceWorkInfo)){
+                $appointment_time = $message['begintime'];
+                ServiceWorkAppointmentLog::create([
+                    'work_id'=>$serviceWorkInfo->id,
+                    'last_appointment_time'=>strtotime($serviceWorkInfo->appointment_time),
+                    'this_appointment_time'=>strtotime($appointment_time),
+                ]);
+                //修改预计完成时间
+                if ($serviceWorkInfo->estimated_finish_time) {
+                    $serviceWorkInfo->estimated_finish_time = strtotime($appointment_time) + (strtotime($serviceWorkInfo->estimated_finish_time) - strtotime($serviceWorkInfo->appointment_time));
+                }
+                $serviceWorkInfo->appointment_time = strtotime($appointment_time);
+                $serviceWorkInfo->save();
+            }
+        }
         return true;
     }