设备端上传人脸照片接口
请求参数
| 参数 | 类型 | 必填 | 说明 |
staff_uuid | string | 是 | 人员 uuid |
face_img | file | 是 | 人脸照片文件 |
成功响应
{
"code": 0,
"message": "上传成功",
"data": {
"uuid": "staff-uuid",
"staff_uuid": "staff-uuid",
"name": "张三",
"nickname": "张三",
"mobile": "13800000000",
"face_img_url": "static/upload/sjtp/20260618/xxx.jpg",
"face_img_full_url": "https://example.com/static/upload/sjtp/20260618/xxx.jpg",
"hardware_img_uuid": "hardware-img-uuid",
"hardware_uuid": "hardwareuuidwithoutdash",
"hardware_time": "2026-06-18 12:00:00",
"hardware_flag": 1
}
}
失败响应
{
"code": 1,
"message": "失败原因",
"data": []
}
| message | 场景 |
参数错误 | staff_uuid 为空 |
人脸参数错误 | face_img 文件为空 |
人员参数错误 | 按 staff_uuid 找不到人员 |
会员信息不存在 | 人员存在但 is_show 无效 |
百度人脸识别失败:... | 百度注册或识别失败 |
修改人脸数据失败 | staff_face 更新/新增失败 |
curl 示例
curl -X POST 'http://127.0.0.1/m/staff/saveFaceByDevice' \
-F 'staff_uuid=staff-uuid' \
-F 'face_img=@/path/to/face.jpg'
注意事项
当前实现保持现有链路风格,未新增数据库事务。附件上传、百度注册、写库和 MQ 同步为串行执行;如后半段失败,前半段外部副作用不会自动回滚。