Commit d008286e by zeven

兼容随行付接口刷脸进店

parent 9a9a22da
import AsyncStorage from '@react-native-community/async-storage';
import axios from 'axios';
import * as api from '../services/admin';
import SocketIO from '../utils/socketio';
export default {
namespace: 'admin',
......
......@@ -272,7 +272,7 @@ class FacePage extends Component {
authinfo = async () => {
const rawdata = await WxFacepay.rawdata();
const {data} = await this.props.dispatch({
type: 'goods/wxauthinfo',
type: 'goods/faceinfo',
rawdata,
});
return data;
......@@ -286,13 +286,19 @@ class FacePage extends Component {
const tipText = '正在人脸识别,请看向屏幕,靠中间站稳';
Speech.speak(tipText);
this.setState({tip: tipText});
const auth = (await this.authinfo()) || {};
if (auth.return_code === 'SUCCESS') {
let auth = (await this.authinfo()) || {};
if (
auth.return_code === 'SUCCESS' ||
(auth.code === 1 && auth.data.bizCode === '0000')
) {
if (auth.data) {
auth = auth.data;
}
const params = {
appid: auth.appid,
mch_id: auth.mch_id,
appid: auth.appid || auth.subAppId,
mch_id: auth.mch_id || auth.subMchId,
store_id: this.storeKey,
authinfo: auth.authinfo,
authinfo: auth.authinfo || auth.authInfo,
face_authtype: 'FACEID-ONCE',
ask_unionid: 1,
};
......@@ -309,6 +315,9 @@ class FacePage extends Component {
if (!res.openid) {
return;
} // 没识别到人脸不开门
if (res.sub_openid) {
res.openid = res.sub_openid;
}
const ret = await this.props.dispatch({
type: 'store/wxdoor',
openid: res.openid,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment