|
@@ -145,6 +145,7 @@ class Order extends BaseModel
|
|
Order::where('id', $order_id)->update([
|
|
Order::where('id', $order_id)->update([
|
|
'order_status' => $order_status,
|
|
'order_status' => $order_status,
|
|
'payment_status' => 2,
|
|
'payment_status' => 2,
|
|
|
|
+ 'is_source' => 1,
|
|
'payment_time' => time(),
|
|
'payment_time' => time(),
|
|
]);
|
|
]);
|
|
//发送下单消息
|
|
//发送下单消息
|
|
@@ -175,18 +176,6 @@ class Order extends BaseModel
|
|
OrderPack::deductPackData($order['pay_order_pack_id'], $order['product_type']);
|
|
OrderPack::deductPackData($order['pay_order_pack_id'], $order['product_type']);
|
|
}
|
|
}
|
|
|
|
|
|
- //如果是门诊预约,预约时间段的订单数要加1
|
|
|
|
- if ($order['product_type'] == 3) {
|
|
|
|
- $schedule_date = date('Y-m-d', $orderPatient['appoint_start_time']);
|
|
|
|
- SchedulePeriod::where('docter_id', $order['docter_id'])->where('organization_id', $order['organization_id'])->where('schedule_type', 1)->where('time_period_id', $orderPatient['time_period_id'])->where('schedule_date', $schedule_date)->increment('order_num');
|
|
|
|
- }
|
|
|
|
- //如果是儿保和疫苗预约,预约时间段的订单数要加1
|
|
|
|
- if (in_array($order['product_type'], [4,5])) {
|
|
|
|
- $schedule_date = date('Y-m-d', $orderPatient['appoint_start_time']);
|
|
|
|
- $schedule_type = $order['product_type'] == 4 ? 2 : 3;
|
|
|
|
- SchedulePeriod::where('organization_id', $order['organization_id'])->where('schedule_type', $schedule_type)->where('time_period_id', $orderPatient['time_period_id'])->where('schedule_date', $schedule_date)->increment('order_num');
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
//如果是疫苗就减少疫苗库存
|
|
//如果是疫苗就减少疫苗库存
|
|
if ($order['product_type'] == 4) {
|
|
if ($order['product_type'] == 4) {
|
|
$orderVaccine = OrderVaccine::where('order_id', $order_id)->first();
|
|
$orderVaccine = OrderVaccine::where('order_id', $order_id)->first();
|
|
@@ -310,20 +299,14 @@ class Order extends BaseModel
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- Order::where('id', $order_id)->update($updateOrder);
|
|
|
|
|
|
|
|
- //如果是门诊预约且距离预约时间还有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)->where('order_num', '>', 0)->decrement('order_num');
|
|
|
|
|
|
+ //能退就是取消占用号源
|
|
|
|
+ if ($can_refund) {
|
|
|
|
+ $updateOrder['is_source'] = 0;
|
|
}
|
|
}
|
|
|
|
|
|
- //如果是疫苗儿保预约且距离预约时间还有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']])->where('order_num', '>', 0)->decrement('order_num');
|
|
|
|
- }
|
|
|
|
|
|
+ Order::where('id', $order_id)->update($updateOrder);
|
|
|
|
+
|
|
//如果是疫苗预约那么取消订单就增加疫苗库存
|
|
//如果是疫苗预约那么取消订单就增加疫苗库存
|
|
if ($order['product_type'] == 4) {
|
|
if ($order['product_type'] == 4) {
|
|
$orderVaccine = OrderVaccine::where('order_id', $order_id)->first();
|
|
$orderVaccine = OrderVaccine::where('order_id', $order_id)->first();
|
|
@@ -446,20 +429,9 @@ class Order extends BaseModel
|
|
$updateOrder['payment_status'] = 5;
|
|
$updateOrder['payment_status'] = 5;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+ $updateOrder['is_source'] = 0;
|
|
Order::where('id', $order_id)->update($updateOrder);
|
|
Order::where('id', $order_id)->update($updateOrder);
|
|
|
|
|
|
- //如果是门诊预约且距离预约时间还有1个小时以上,那么预约时间段的订单数减1
|
|
|
|
- if ($order['product_type'] == 3) {
|
|
|
|
- $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)->where('order_num', '>', 0)->decrement('order_num');
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- //如果是疫苗儿保预约且距离预约时间还有1个小时以上,那么预约时间段的订单数减1
|
|
|
|
- if (in_array($order['product_type'], [4,5])) {
|
|
|
|
- $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']])->where('order_num', '>', 0)->decrement('order_num');
|
|
|
|
- }
|
|
|
|
//如果是疫苗预约那么取消订单就增加疫苗库存
|
|
//如果是疫苗预约那么取消订单就增加疫苗库存
|
|
if ($order['product_type'] == 4) {
|
|
if ($order['product_type'] == 4) {
|
|
$orderVaccine = OrderVaccine::where('order_id', $order_id)->first();
|
|
$orderVaccine = OrderVaccine::where('order_id', $order_id)->first();
|