|
@@ -4058,17 +4058,43 @@ class WholeController extends Curd
|
|
$appointments = Appointment::where('join_appointment_member_benefit_id', $benefit['member_benefit_id'])
|
|
$appointments = Appointment::where('join_appointment_member_benefit_id', $benefit['member_benefit_id'])
|
|
->where('appointment_status', 'INIT')
|
|
->where('appointment_status', 'INIT')
|
|
->limit(intval($list['nbr']))
|
|
->limit(intval($list['nbr']))
|
|
- ->get();
|
|
|
|
- foreach ($appointments as $appointment) {
|
|
|
|
- $appointmentIds[] = $appointment->appointment_id;
|
|
|
|
- Appointment::where('appointment_id', $appointment->appointment_id)->update([
|
|
|
|
- 'appointment_status' => 'DONE',
|
|
|
|
- 'appointment_datetime' => $times,
|
|
|
|
- 'appointment_apply_datetime' => $times,
|
|
|
|
- 'appointment_doing_datetime' => $times,
|
|
|
|
- 'appointment_done_datetime' => $times,
|
|
|
|
- 'appointment_done_json' => json_encode($writeOffData)
|
|
|
|
- ]);
|
|
|
|
|
|
+ ->get()
|
|
|
|
+ ->toArray();
|
|
|
|
+ if ($appointments) {
|
|
|
|
+ foreach ($appointments as $appointment) {
|
|
|
|
+ $appointmentIds[] = $appointment['appointment_id'];
|
|
|
|
+ Appointment::where('appointment_id', $appointment['appointment_id'])->update([
|
|
|
|
+ 'appointment_status' => 'DONE',
|
|
|
|
+ 'appointment_datetime' => $times,
|
|
|
|
+ 'appointment_apply_datetime' => $times,
|
|
|
|
+ 'appointment_doing_datetime' => $times,
|
|
|
|
+ 'appointment_done_datetime' => $times,
|
|
|
|
+ 'appointment_done_json' => json_encode($writeOffData)
|
|
|
|
+ ]);
|
|
|
|
+ }
|
|
|
|
+ } else {
|
|
|
|
+ for ($i = 0; $i < intval($list['nbr']); $i++) {
|
|
|
|
+ Appointment::insert([
|
|
|
|
+ 'appointment_id' => 'AP' . date('ymdHi') . random_string(4, 'up'),
|
|
|
|
+ 'join_appointment_member_id' => $benefit['join_benefit_member_id'],
|
|
|
|
+ 'join_appointment_goods_id' => !empty($benefit['join_benefit_package_id']) ? $benefit['join_benefit_package_id'] : $benefit['join_benefit_goods_id'],
|
|
|
|
+ 'join_appointment_goods_sku_id' => $benefit['join_benefit_goods_sku_id'],
|
|
|
|
+ 'join_appointment_order_id' => $benefit['join_benefit_order_id'],
|
|
|
|
+ 'join_appointment_member_benefit_id' => $benefit['member_benefit_id'],
|
|
|
|
+ 'appointment_classify' => $benefit['member_benefit_category'],
|
|
|
|
+ 'appointment_status' => 'DONE',
|
|
|
|
+ 'appointment_category' => 'NORMAL',
|
|
|
|
+ 'appointment_datetime' => date('Y-m-d H:i:s'),
|
|
|
|
+ 'appointment_apply_datetime' => date('Y-m-d H:i:s'),
|
|
|
|
+ 'appointment_doing_datetime' => date('Y-m-d H:i:s'),
|
|
|
|
+ 'appointment_done_datetime' => date('Y-m-d H:i:s'),
|
|
|
|
+ 'appointment_done_json' => json_encode($writeOffData),
|
|
|
|
+ 'appointment_mode' => 'ORDER',
|
|
|
|
+ 'settlement_mode' => 'ONLINE',
|
|
|
|
+ 'appointment_platform' => 'SYSTEM',
|
|
|
|
+ 'appointment_addtimes' => time()
|
|
|
|
+ ]);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|