Commit 21bc7814 by chenjinjing

no message

parent 9b343953
......@@ -281,16 +281,19 @@ export async function createAppointment( studentId: string, param: { start_time:
}
/**验证预约时间 */
let startTime = new Date(param.start_time);
let endTime = new Date(param.end_time);
if (startTime >= endTime) {
throw new BizError(ERRORENUM.参数错误, '预约结束时间必须大于开始时间');
const startTime = new Date(param.start_time);
const endTime = new Date(param.end_time);
if (isNaN(startTime.getTime()) || isNaN(endTime.getTime())) {
throw new BizError(ERRORENUM.参数错误, '时间格式无效');
}
if (startTime > endTime) { // 修改点:允许相等,只拒绝开始>结束
throw new BizError(ERRORENUM.参数错误, '预约结束时间必须大于或等于开始时间');
}
const todayStart = new Date();
todayStart.setHours(0, 0, 0, 0);
if (startTime < todayStart) {
throw new BizError(ERRORENUM.参数错误, '预约开始时间不能早于今天');
}
// if (startTime < new Date()) {
// throw new BizError(ERRORENUM.参数错误, '预约开始时间不能早于当前时间');
// }
/**创建预约 */
await addData(TABLENAME.预约表, {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment