完成接入人脸认证

This commit is contained in:
Dragon
2024-01-10 18:45:21 +08:00
parent bb3cd87401
commit 33bc6ebd86

View File

@@ -109,10 +109,9 @@ $(function () {
},
eventRegister: function () {
$('.button-submit').on('click', function () {
var name = $('.name').val();
var personId = $('.person-id').val();
var phone = $('.phone').val();
var phone = `${$('.phone').val()}`;
var identityCode = $('.identity-code').val();
var agree = $('#agree').prop("checked");
if (!agree) {
@@ -152,58 +151,34 @@ $(function () {
return;
}
lockBol = true;
var metaInfo = window.getMetaInfo();
var requestParam = {
certType: 0,
code: identityCode,
identityNumber: encryptDes(personId, "1ea53d260ecf11e7b56e00163e046a26"),
metaInfo:JSON.stringify(metaInfo),
phone: encryptDes(86+phone, "1ea53d260ecf11e7b56e00163e046a26"),
returnUrl: urlPrefix + '/peko/modules/h5Income/withdrawal.html',
uid: pubInfo.uid,
username: encryptDes(name, "1ea53d260ecf11e7b56e00163e046a26"),
identityNumber: encryptDes(personId, "1ea53d260ecf11e7b56e00163e046a26"),
phone: encryptDes(phone, "1ea53d260ecf11e7b56e00163e046a26"),
code: identityCode,
ticket: pubInfo.ticket
};
if (browser.android) {
requestParam.deviceInfo = JSON.stringify({
deviceId: pubInfo.deviceId
});
}
networkRequest({
type: 'get',
url: urlPrefix + '/certification/token',
type: 'post',
url: urlPrefix + '/certification/initFace',
data: requestParam,
success: function (res) {
if (res.code == 200) {
var token = res.data.token;
pubInfo.token = token;
// if(browser.app){
if (browser.ios) {
window.webkit.messageHandlers.openFaceLiveness.postMessage(token);
} else {
window.androidJsObj.openFaceLiveness(token);
}
// }
} else {
if (res.code == 10109) {
$mask.addClass("failed");
$mask.find(".text").html("实名认证失败");
$mask.find(".tips").html("该身份证实名认证已达5次");
} else if (res.code == 10110) {
$mask.addClass("have-identity");
$mask.find(".text").html("您已通过实名认证");
$mask.find(".tips").html("系统已成功审核您的实名认证");
} else if (res.code == 4003) {
$mask.addClass("failed");
$mask.find(".text").html("实名认证失败");
$mask.find(".tips").html("验证码错误");
window.location.href = res.data.certifyUrl;
} else {
$mask.addClass("failed");
$mask.find(".text").html("实名认证失败");
$mask.find(".tips").html("请填写真实有效的身份证信息");
}
$mask.find(".tips").html(res.message);
$mask.show();
lockBol = false;
setTimeout(function () {
$('.status-mask').hide();
}, 4000);
lockBol = false;
}
},
error (err) {
@@ -240,7 +215,7 @@ $(function () {
}, 1000)
var requestParam = {
phone: encryptDes(phone, "1ea53d260ecf11e7b56e00163e046a26"),
phone: encryptDes(86+phone, "1ea53d260ecf11e7b56e00163e046a26"),
uid: pubInfo.uid,
ticket: pubInfo.ticket
};