200) { jsonError('需求简述不能超过200字'); } $record = [ 'id' => uniqid('sub_', true), 'createdAt' => date('c'), 'doctorId' => $doctorId, 'doctorName' => $doctorName, 'nickname' => $nickname, 'gender' => $gender, 'contact' => $contact, 'description' => $description, ]; $submissions = readSubmissions(); $submissions[] = $record; if (!saveSubmissions($submissions)) { jsonError(getSaveSubmissionsError(), 500); } $response = [ 'ok' => true, 'message' => '提交成功', 'id' => $record['id'], 'total' => count($submissions), ]; http_response_code(200); header('Content-Type: application/json; charset=utf-8'); echo json_encode($response, JSON_UNESCAPED_UNICODE); finishResponseAndContinue(); $mailSent = sendSubmissionMail($submissions); if (!$mailSent) { error_log('[submit] 数据已保存,邮件通知未发送,ID=' . $record['id']); } exit;