const util = require('../../utils/func/request'); const date = require('../../utils/util/util') const app = getApp() /*** 自助通行_云上贵州_2021/08/23 ***/ //进入人脸识别--人脸下发 const intoFace_wxrlxf = (name, idcard, phone, orgId) => { return new Promise ((reslove, reject) => { let taskId = `${orgId}-${date.formatTime(Date.now(), 'YYYYMMDDHHNNSS')}${(parseInt((Math.random()*9+1)*10000))}` // taskId = '00-993306131355291200'; app.data.faceTaskId = taskId; wx.navigateToMiniProgram({ appId: 'wx331fa6d546331cc0', path: 'pages/index/index?idNumber='+idcard+'&name='+name+'&phone='+phone+'¬ify='+(util.wx_rlxf?util.pro_baseUrl_wxrlxf:util.dev_baseUrl_wxrlxf)+'/api/next/doConfirmFaceNotify&unit=简约通&token=73b81e3eb2ff11eb877300163e0a5d80&taskId='+taskId, envVersion: 'release', success(res) { reslove(true) }, fail(err) { reject(err) wx.showToast({ title:'您取消了实名认证', icon: 'none' }) } }) }) .catch(err => {}) .finally(() => { }) } //验证人脸信息--人脸下发 const getFace_wxrlxf = (api, method, data) => { wx.showLoading({ title: '验证中...', }) return util.request_wxrlxf({ url: api, data: data, method: method, type: 'application/json' }).then((suc)=>{ return suc }).catch((err) => { wx.showToast({ title: err, icon: 'none' }) }).finally(() => { app.data.faceTaskId = null; wx.hideLoading() }) } /***自助通行_安卓_李工_20211-01-17***/ //进入人脸识别 const intoFace = (name, idcard, taskId) => { wx.setStorageSync('dateCode', taskId) return new Promise ((reslove, reject) => { wx.navigateToMiniProgram({ appId: 'wx331fa6d546331cc0', path: 'pages/index/index?idNumber='+idcard+'&name='+name+'¬ify=http://idc.hz-hanghui.com:8901/nsapi/mpidc&unit=简约通&token=73b81e3eb2ff11eb877300163e0a5d80&taskId='+taskId, envVersion: 'release', success(res) { reslove(true) }, fail(err) { reject(err) util.showToast(err.errMsg) } }) }) } //验证人脸信息 const getFace = (api, method, data) => { wx.showLoading({ title: '验证中...', }) return ( util.request({ url: api, data: data, method: method, type: 'application/json' }).then((suc)=>{ wx.hideLoading() return suc }).catch((err) => { wx.hideLoading() util.showToast(err) }) ) } //告知二维码已被扫描 const notice = (taskId) => { return ( util.request({ url: '/nsapi/mpidc_scan', data: { taskId: taskId }, method: 'post', type: 'applycation/json' }) .then((suc) => { return(suc) }) .catch((err) => { console.log(err) }) ) } //查询是否已扫码 const checkNotice = (taskId) => { return ( util.request({ url: '/nsapi/is_idc_scan', data: { taskId: taskId }, method: 'post', type: 'applycation/json' }) .then((suc) => { return(suc) }) .catch((err) => { console.log(err) }) ) } module.exports = { intoFace_wxrlxf: intoFace_wxrlxf, getFace_wxrlxf: getFace_wxrlxf, intoFace: intoFace, getFace: getFace, notice: notice, checkNotice: checkNotice, }