123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151 |
- const _my = require("../../__antmove/api/index.js")(my);
- const wx = _my;
- const util = require("../../utils/func/request");
- const date = require("../../utils/util/util");
- /*** 自助通行_云上贵州_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-883306131355291200';
- wx.setStorageSync("wx_dateCode", 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);
- util.showToast("您取消了实名认证");
- }
- });
- })
- .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 => {
- util.showToast(err);
- })
- .finally(() => {
- wx.removeStorage({
- key: "wx_dateCode"
- });
- 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();
- console.log(err);
- 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
- };
|