123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213 |
- 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 = '54-98765411111111121'
- 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);
- wx.showToast({
- title: "您取消了实名认证",
- icon: "none"
- });
- }
- });
- })
- .catch(err => {})
- .finally(() => {});
- };
- //进入人脸识别--人脸下发--访客机
- const intoFace_wxrlxf_FKJ = (username, idNumber, phone) => {
- let taskId = `${date.formatTime(Date.now(), "YYYYMMDDHHNNSS")}${parseInt(
- (Math.random() * 9 + 1) * 10000
- )}`;
- // taskId = '16701439390720011';
- wx.setStorageSync("wx_dateCode_FKJ", taskId);
- return new Promise((reslove, reject) => {
- wx.navigateToMiniProgram({
- appId: "wx331fa6d546331cc0",
- path:
- "pages/index/index?idNumber=" +
- idNumber +
- "&name=" +
- username +
- "&phone=" +
- phone +
- "¬ify=" +
- (util.wx_rlxf
- ? util.pro_baseUrl_wxrlxf
- : util.dev_baseUrl_wxrlxf) +
- "/api/next/visitorUserInfoInPut&unit=易行智慧通&token=73b81e3eb2ff11eb877300163e0a5d80&taskId=" +
- taskId,
- envVersion: "release",
- success(res) {
- reslove(true);
- },
- fail(err) {
- reject(err);
- util.showToast(err.errMsg);
- }
- });
- });
- };
- //验证人脸信息--人脸下发
- 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(() => {
- 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);
- wx.showToast({
- title: err.errMsg,
- icon: "none"
- });
- }
- });
- });
- };
- //验证人脸信息
- const getFace = (api, method, data) => {
- wx.showLoading({
- title: "验证中..."
- });
- return util
- .request({
- url: api,
- data: data,
- method: method,
- type: "application/json"
- })
- .then(suc => {
- console.log(suc);
- wx.hideLoading();
- return suc;
- })
- .catch(err => {
- wx.hideLoading();
- wx.showToast({
- title: err,
- icon: "none"
- });
- });
- };
- //告知二维码已被扫描
- 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,
- intoFace_wxrlxf_FKJ: intoFace_wxrlxf_FKJ
- };
|