chore: establish V1.1 recovery baseline
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
/**
|
||||
* 实名认证服务(API_INVENTORY 行 30-31)
|
||||
*
|
||||
* 封装提交与查询两个端点。
|
||||
* 提交走 POST + 幂等键(同一身份证不可重复提交)。
|
||||
* 身份证号等敏感字段由 stores/userStore 在收集阶段加密传输,本层不缓存明文。
|
||||
*/
|
||||
const api = require('../utils/api');
|
||||
|
||||
/**
|
||||
* 提交实名认证(API_INVENTORY 行 30)
|
||||
* @param {{ realName: string, idCardNumber: string, faceImageUrl?: string }} payload
|
||||
* @returns {Promise<{ submitted: true, status: 'pending' }>}
|
||||
*/
|
||||
function submit(payload) {
|
||||
// 幂等键:身份证号后4位 + 当前秒,避免用户多次点击
|
||||
const tail = (payload.idCardNumber || '').slice(-4).toUpperCase();
|
||||
const idempotencyKey = 'verification-submit:' + tail + ':' + Math.floor(Date.now() / 1000);
|
||||
return api.post('/verification/submit', payload, undefined, idempotencyKey);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询认证状态(API_INVENTORY 行 31)
|
||||
* @returns {Promise<{ status: 'not_submitted'|'pending'|'approved'|'rejected', rejectReason?: string, submittedAt?: number, reviewedAt?: number }>}
|
||||
*/
|
||||
function getStatus() {
|
||||
return api.get('/verification/status');
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
submit,
|
||||
getStatus,
|
||||
};
|
||||
Reference in New Issue
Block a user