feat: 陪诊师入驻申请与审核链路
- 新增 attendant_application 表与 5 个接口:提交/我的申请/审核列表/ 材料大图/审批,/mine 注册在 /:id 之前 - 提交侧按员工档案岗位分支:在职陪诊师与管理员及其他岗位 409 拒绝, 转岗由管理员后台显式操作;停用陪诊师可重新申请 - 审批两步走不依赖事务:条件更新抢占 pending,ensureEmployee 单条 条件 upsert 幂等建档(只放行无档案或已有 attendant 档案), 失败靠 approvedEmployeeId 为空续跑 - 岗位冲突时申请单条件回滚为 pending,不卡死在"已通过但未建档" - employee.userId 加 partial unique 索引并移除 employeeNo 默认值, 附迁移与存量校验脚本;员工管理端绑定账号查重与 userIdSource 标记 - 证件照复用 parseImage(单张 3MB),入驻前缀放宽请求体上限; 索引创建失败改为记日志,避免启动即崩
This commit is contained in:
@@ -40,15 +40,15 @@ class HandlerTrainingApplication {
|
||||
|
||||
// 只接受 jpeg/png 的 data URL;同时检查文件签名和原始大小,
|
||||
// 防止把任意 base64 文本当作报名材料写入数据库
|
||||
static parseImage(input, label) {
|
||||
static parseImage(input, label, maxBytes = MAX_IMAGE_BYTES) {
|
||||
const raw = String(input || "").trim();
|
||||
const match = raw.match(/^data:(image\/(?:jpeg|png));base64,([A-Za-z0-9+/]+={0,2})$/);
|
||||
if (!match) return { error: `请上传${label}(JPG/PNG)` };
|
||||
|
||||
const mime = match[1];
|
||||
const buffer = Buffer.from(match[2], "base64");
|
||||
if (!buffer.length || buffer.length > MAX_IMAGE_BYTES) {
|
||||
return { error: `${label}不能超过 5MB` };
|
||||
if (!buffer.length || buffer.length > maxBytes) {
|
||||
return { error: `${label}不能超过 ${Math.round(maxBytes / 1024 / 1024)}MB` };
|
||||
}
|
||||
|
||||
const isJpeg = buffer.length > 2 && buffer[0] === 0xff && buffer[1] === 0xd8;
|
||||
|
||||
Reference in New Issue
Block a user