Commit d008286e by zeven

兼容随行付接口刷脸进店

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