完成接入人脸认证

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 () { eventRegister: function () {
$('.button-submit').on('click', function () { $('.button-submit').on('click', function () {
var name = $('.name').val(); var name = $('.name').val();
var personId = $('.person-id').val(); var personId = $('.person-id').val();
var phone = $('.phone').val(); var phone = `${$('.phone').val()}`;
var identityCode = $('.identity-code').val(); var identityCode = $('.identity-code').val();
var agree = $('#agree').prop("checked"); var agree = $('#agree').prop("checked");
if (!agree) { if (!agree) {
@@ -152,58 +151,34 @@ $(function () {
return; return;
} }
lockBol = true; lockBol = true;
var metaInfo = window.getMetaInfo();
var requestParam = { 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, uid: pubInfo.uid,
username: encryptDes(name, "1ea53d260ecf11e7b56e00163e046a26"), 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({ networkRequest({
type: 'get', type: 'post',
url: urlPrefix + '/certification/token', url: urlPrefix + '/certification/initFace',
data: requestParam, data: requestParam,
success: function (res) { success: function (res) {
if (res.code == 200) { if (res.code == 200) {
var token = res.data.token; window.location.href = res.data.certifyUrl;
pubInfo.token = token;
// if(browser.app){
if (browser.ios) {
window.webkit.messageHandlers.openFaceLiveness.postMessage(token);
} else {
window.androidJsObj.openFaceLiveness(token);
}
// }
} else { } else {
if (res.code == 10109) { $mask.addClass("failed");
$mask.addClass("failed"); $mask.find(".text").html("实名认证失败");
$mask.find(".text").html("实名认证失败"); $mask.find(".tips").html(res.message);
$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("验证码错误");
} else {
$mask.addClass("failed");
$mask.find(".text").html("实名认证失败");
$mask.find(".tips").html("请填写真实有效的身份证信息");
}
$mask.show(); $mask.show();
lockBol = false; lockBol = false;
setTimeout(function () { setTimeout(function () {
$('.status-mask').hide(); $('.status-mask').hide();
}, 4000); }, 4000);
lockBol = false;
} }
}, },
error (err) { error (err) {
@@ -240,7 +215,7 @@ $(function () {
}, 1000) }, 1000)
var requestParam = { var requestParam = {
phone: encryptDes(phone, "1ea53d260ecf11e7b56e00163e046a26"), phone: encryptDes(86+phone, "1ea53d260ecf11e7b56e00163e046a26"),
uid: pubInfo.uid, uid: pubInfo.uid,
ticket: pubInfo.ticket ticket: pubInfo.ticket
}; };
@@ -306,7 +281,7 @@ function getMessage (key, value) {
function renderByStatus (status) { function renderByStatus (status) {
$mask.attr('class', 'status-mask'); $mask.attr('class', 'status-mask');
console.log("开始回调," + "状态为" + status); console.log("开始回调," + "状态为" + status);
networkRequest({ networkRequest({
type: 'post', type: 'post',
url: urlPrefix + '/certification/notify', url: urlPrefix + '/certification/notify',