|
@@ -150,31 +150,31 @@ class AppointmentService
|
|
|
try {
|
|
|
// 先检查选择的时段是否可预约
|
|
|
$goods = Goods::where('goods_id', $params['join_appointment_goods_id'])->first();
|
|
|
- $appointments = Appointment::where('appointment_datetime', $params['appointment_datetime'])->get()->toArray();
|
|
|
- if ($goods->is_support_appointment == 'Y' && !empty($goods->goods_attribute_json)) {
|
|
|
- $extendJson = json_decode($goods->goods_attribute_json, true);
|
|
|
- foreach ($extendJson['times'] as $key => $time) {
|
|
|
- if ($time['duration'] == $params['appointment_times']) {
|
|
|
- if (!empty($appointments)) {
|
|
|
- foreach ($appointments as $appointment) {
|
|
|
- $applyJson = json_decode($appointment['appointment_apply_json'], true);
|
|
|
- $applyJsonTimes = $applyJson['times'] ?? '';
|
|
|
-
|
|
|
- if ($time['duration'] == $applyJsonTimes) {
|
|
|
- $extendJson['times'][$key]['person'] -= $applyJson['person'];
|
|
|
- if ($extendJson['times'][$key]['person'] < $params['person']) {
|
|
|
- return json_fail('当前时段名额不足,请选择其他时段');
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- } else {
|
|
|
- if ($extendJson['times'][$key]['person'] < $params['person']) {
|
|
|
- return json_fail('当前时段名额不足,请选择其他时段');
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
+ // $appointments = Appointment::where('appointment_datetime', $params['appointment_datetime'])->get()->toArray();
|
|
|
+ // if ($goods->is_support_appointment == 'Y' && !empty($goods->goods_attribute_json)) {
|
|
|
+ // $extendJson = json_decode($goods->goods_attribute_json, true);
|
|
|
+ // foreach ($extendJson['times'] as $key => $time) {
|
|
|
+ // if ($time['duration'] == $params['appointment_times']) {
|
|
|
+ // if (!empty($appointments)) {
|
|
|
+ // foreach ($appointments as $appointment) {
|
|
|
+ // $applyJson = json_decode($appointment['appointment_apply_json'], true);
|
|
|
+ // $applyJsonTimes = $applyJson['times'] ?? '';
|
|
|
+
|
|
|
+ // if ($time['duration'] == $applyJsonTimes) {
|
|
|
+ // $extendJson['times'][$key]['person'] -= $applyJson['person'];
|
|
|
+ // if ($extendJson['times'][$key]['person'] < $params['person']) {
|
|
|
+ // return json_fail('当前时段名额不足,请选择其他时段');
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // } else {
|
|
|
+ // if ($extendJson['times'][$key]['person'] < $params['person']) {
|
|
|
+ // return json_fail('当前时段名额不足,请选择其他时段');
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // }
|
|
|
// 如果没有,新建
|
|
|
if (empty($params['join_appointment_member_id']) && !empty($params['username']) && !empty($params['mobile'])) {
|
|
|
$memberId = "ME" . str_pad(SysSerial::getSerial(), 16, "0", STR_PAD_LEFT) . random_string(6, 'up');
|
|
@@ -374,34 +374,34 @@ class AppointmentService
|
|
|
try {
|
|
|
// 先检查选择的时段是否可预约
|
|
|
$goods = Goods::where('goods_id', $params['join_appointment_goods_id'])->first();
|
|
|
- $appointments = Appointment::where('appointment_datetime', $params['appointment_datetime'])
|
|
|
- ->where('appointment_id', '<>', $params['appointment_id'])
|
|
|
- ->get()
|
|
|
- ->toArray();
|
|
|
- if ($goods->is_support_appointment == 'Y' && !empty($goods->goods_attribute_json) && $appointment->appointment_category != 'GREENWAY') {
|
|
|
- $extendJson = json_decode($goods->goods_attribute_json, true);
|
|
|
- foreach ($extendJson['times'] as $key => $time) {
|
|
|
- if ($time['duration'] == $params['appointment_times']) {
|
|
|
- if (!empty($appointments)){
|
|
|
- foreach ($appointments as $appointmentItem) {
|
|
|
- $applyJson = json_decode($appointmentItem['appointment_apply_json'], true);
|
|
|
- $applyJsonTimes = $applyJson['times'] ?? '';
|
|
|
-
|
|
|
- if ($time['duration'] == $applyJsonTimes) {
|
|
|
- $extendJson['times'][$key]['person'] -= $applyJson['person'];
|
|
|
- if ($extendJson['times'][$key]['person'] < $params['person']) {
|
|
|
- return json_fail('当前时段名额不足,请选择其他时段');
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- }else{
|
|
|
- if ($extendJson['times'][$key]['person'] < $params['person']) {
|
|
|
- return json_fail('当前时段名额不足,请选择其他时段');
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
+ // $appointments = Appointment::where('appointment_datetime', $params['appointment_datetime'])
|
|
|
+ // ->where('appointment_id', '<>', $params['appointment_id'])
|
|
|
+ // ->get()
|
|
|
+ // ->toArray();
|
|
|
+ // if ($goods->is_support_appointment == 'Y' && !empty($goods->goods_attribute_json) && $appointment->appointment_category != 'GREENWAY') {
|
|
|
+ // $extendJson = json_decode($goods->goods_attribute_json, true);
|
|
|
+ // foreach ($extendJson['times'] as $key => $time) {
|
|
|
+ // if ($time['duration'] == $params['appointment_times']) {
|
|
|
+ // if (!empty($appointments)){
|
|
|
+ // foreach ($appointments as $appointmentItem) {
|
|
|
+ // $applyJson = json_decode($appointmentItem['appointment_apply_json'], true);
|
|
|
+ // $applyJsonTimes = $applyJson['times'] ?? '';
|
|
|
+
|
|
|
+ // if ($time['duration'] == $applyJsonTimes) {
|
|
|
+ // $extendJson['times'][$key]['person'] -= $applyJson['person'];
|
|
|
+ // if ($extendJson['times'][$key]['person'] < $params['person']) {
|
|
|
+ // return json_fail('当前时段名额不足,请选择其他时段');
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // }else{
|
|
|
+ // if ($extendJson['times'][$key]['person'] < $params['person']) {
|
|
|
+ // return json_fail('当前时段名额不足,请选择其他时段');
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // }
|
|
|
$data = [
|
|
|
'appointment_status' => $params['appointment_status'],
|
|
|
// 'join_appointment_goods_sku_id' => $params['join_appointment_goods_sku_id'] ?? '',
|