|
@@ -11,7 +11,7 @@ namespace app\api\controller;
|
|
|
|
|
|
use app\api\controller\base\Permissions;
|
|
use app\api\controller\base\Permissions;
|
|
use app\common\model\AppointmentApplication;
|
|
use app\common\model\AppointmentApplication;
|
|
-use app\common\model\Appointment;
|
|
|
|
|
|
+use app\common\model\AppointmentTicket;
|
|
use app\common\model\Feedback;
|
|
use app\common\model\Feedback;
|
|
use app\common\model\Webconfig;
|
|
use app\common\model\Webconfig;
|
|
use time\DateHelper;
|
|
use time\DateHelper;
|
|
@@ -44,12 +44,13 @@ class User extends Permissions
|
|
['sex|性别', 'number|in:1,2'],
|
|
['sex|性别', 'number|in:1,2'],
|
|
['phone|电话', 'require|max:50'],
|
|
['phone|电话', 'require|max:50'],
|
|
['id_card|身份证', 'max:50'],
|
|
['id_card|身份证', 'max:50'],
|
|
- ['childs_num|子女数量', 'number|in:1,2,3'],
|
|
|
|
['problem_desc|问题描述', 'max:200'],
|
|
['problem_desc|问题描述', 'max:200'],
|
|
['requirement_desc|需求描述', 'max:200'],
|
|
['requirement_desc|需求描述', 'max:200'],
|
|
['appointment_ticket_id', 'require|number'],
|
|
['appointment_ticket_id', 'require|number'],
|
|
['appointment_period', 'require|number|in:1,2,3'],
|
|
['appointment_period', 'require|number|in:1,2,3'],
|
|
['appointment_time|预约时间段', 'require|dateFormat:H:i:s - H:i:s'],
|
|
['appointment_time|预约时间段', 'require|dateFormat:H:i:s - H:i:s'],
|
|
|
|
+ ['childs_num|子女数量', 'number|in:1,2,3'],
|
|
|
|
+ ['childs_num_str|子女数量', 'max:255'],
|
|
['city|来自城市', 'max:50'],
|
|
['city|来自城市', 'max:50'],
|
|
['job|职业', 'max:50'],
|
|
['job|职业', 'max:50'],
|
|
['education_level|受教育程度', 'number|in:0,1,2,3,4'],
|
|
['education_level|受教育程度', 'number|in:0,1,2,3,4'],
|
|
@@ -67,7 +68,6 @@ class User extends Permissions
|
|
$this->json_error('提交失败:' . $validate->getError());
|
|
$this->json_error('提交失败:' . $validate->getError());
|
|
}
|
|
}
|
|
|
|
|
|
-
|
|
|
|
$model = new AppointmentApplication();
|
|
$model = new AppointmentApplication();
|
|
|
|
|
|
//爽约多少次后,多少天内不能再预约
|
|
//爽约多少次后,多少天内不能再预约
|
|
@@ -86,18 +86,19 @@ class User extends Permissions
|
|
}
|
|
}
|
|
|
|
|
|
//检测预约号源是否可预约
|
|
//检测预约号源是否可预约
|
|
- $ticket = Appointment::get($post['appointment_ticket_id']);
|
|
|
|
|
|
+ $ticket = AppointmentTicket::get($post['appointment_ticket_id']);
|
|
if (!$ticket) {
|
|
if (!$ticket) {
|
|
$this->json_error("获取预约号失败");
|
|
$this->json_error("获取预约号失败");
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ $appoint = $ticket->appointment;
|
|
//判断该时间段,存在于时间列表中才行
|
|
//判断该时间段,存在于时间列表中才行
|
|
if ($post['appointment_period'] == 1) {
|
|
if ($post['appointment_period'] == 1) {
|
|
- $timePeriods = DateHelper::splitTimePeriod($ticket->morning_start_time, $ticket->morning_end_time, $ticket->morning_num);
|
|
|
|
|
|
+ $timePeriods = DateHelper::splitTimePeriod($appoint->morning_start_time, $appoint->morning_end_time, $appoint->morning_num);
|
|
} elseif ($post['appointment_period'] == 2) {
|
|
} elseif ($post['appointment_period'] == 2) {
|
|
- $timePeriods = DateHelper::splitTimePeriod($ticket->afternoon_start_time, $ticket->afternoon_end_time, $ticket->afternoon_num);
|
|
|
|
|
|
+ $timePeriods = DateHelper::splitTimePeriod($appoint->afternoon_start_time, $appoint->afternoon_end_time, $appoint->afternoon_num);
|
|
} else {
|
|
} else {
|
|
- $timePeriods = DateHelper::splitTimePeriod($ticket->night_start_time, $ticket->night_end_time, $ticket->night_num);
|
|
|
|
|
|
+ $timePeriods = DateHelper::splitTimePeriod($appoint->night_start_time, $appoint->night_end_time, $appoint->night_num);
|
|
}
|
|
}
|
|
if (!in_array($post['appointment_time'], $timePeriods)) {
|
|
if (!in_array($post['appointment_time'], $timePeriods)) {
|
|
$this->json_error("该时间段不存在,请重新选择时间");
|
|
$this->json_error("该时间段不存在,请重新选择时间");
|
|
@@ -107,7 +108,7 @@ class User extends Permissions
|
|
$timerang = explode(' - ', $post['appointment_time']);
|
|
$timerang = explode(' - ', $post['appointment_time']);
|
|
$period_end = $timerang[1];
|
|
$period_end = $timerang[1];
|
|
|
|
|
|
- if (time() > strtotime($ticket->daytime . ' ' . $period_end)) {
|
|
|
|
|
|
+ if (time() > strtotime($ticket->appointment_daytime . ' ' . $period_end)) {
|
|
$this->json_error("该时段已经过期,请重新选择时间");
|
|
$this->json_error("该时段已经过期,请重新选择时间");
|
|
}
|
|
}
|
|
|
|
|
|
@@ -136,7 +137,20 @@ class User extends Permissions
|
|
'appointment_ticket_id' => $post['appointment_ticket_id'],
|
|
'appointment_ticket_id' => $post['appointment_ticket_id'],
|
|
'appointment_time' => $post['appointment_time'],
|
|
'appointment_time' => $post['appointment_time'],
|
|
'appointment_period' => $post['appointment_period'],
|
|
'appointment_period' => $post['appointment_period'],
|
|
- 'status' => AppointmentApplication::STATUS_NOT_SIGN
|
|
|
|
|
|
+ 'status' => AppointmentApplication::STATUS_NOT_SIGN,
|
|
|
|
+ 'city' => $post['city']??'',
|
|
|
|
+ 'job' => $post['job']??'',
|
|
|
|
+ 'education_level' => $post['education_level']??0,
|
|
|
|
+ 'home_address' => $post['home_address']??'',
|
|
|
|
+ 'marriage' => $post['marriage']??0,
|
|
|
|
+ 'problem_type' => $post['problem_type']??0,
|
|
|
|
+ 'childs_num_str' => $post['childs_num_str']??'',
|
|
|
|
+ 'childs_age1' => $post['childs_age1']??0,
|
|
|
|
+ 'childs_age2' => $post['childs_age2']??0,
|
|
|
|
+ 'childs_age3' => $post['childs_age3']??0,
|
|
|
|
+ 'childs_sex1' => $post['childs_sex1']??0,
|
|
|
|
+ 'childs_sex2' => $post['childs_sex2']??0,
|
|
|
|
+ 'childs_sex3' => $post['childs_sex3']??0,
|
|
];
|
|
];
|
|
if (false === $model->allowField(true)->save($data)) {
|
|
if (false === $model->allowField(true)->save($data)) {
|
|
$this->json_error("预约入库失败");
|
|
$this->json_error("预约入库失败");
|