Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
B
bh_face_counter
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
黄天晨
bh_face_counter
Commits
8639732b
Commit
8639732b
authored
Jan 22, 2021
by
修福龙
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
刷脸支付分修改
parent
16fc59d3
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
74 additions
and
68 deletions
+74
-68
goods.js
src/models/goods.js
+0
-3
FacePage.js
src/pages/FacePage.js
+70
-58
goods.js
src/services/goods.js
+0
-7
store.js
src/services/store.js
+4
-0
No files found.
src/models/goods.js
View file @
8639732b
...
@@ -93,8 +93,5 @@ export default {
...
@@ -93,8 +93,5 @@ export default {
*
payscoreinfo
(
action
,
{
call
})
{
*
payscoreinfo
(
action
,
{
call
})
{
return
yield
call
(
api
.
payscoreinfo
,
action
);
return
yield
call
(
api
.
payscoreinfo
,
action
);
},
},
*
payscoreCheck
(
action
,
{
call
})
{
return
yield
call
(
api
.
payscoreCheck
,
action
);
},
},
},
};
};
src/pages/FacePage.js
View file @
8639732b
...
@@ -69,7 +69,14 @@ class FacePage extends Component {
...
@@ -69,7 +69,14 @@ class FacePage extends Component {
await
AutoClick
.
clickBackKey
();
await
AutoClick
.
clickBackKey
();
if
(
this
.
faceBusy
)
return
;
if
(
this
.
faceBusy
)
return
;
this
.
faceBusy
=
true
;
this
.
faceBusy
=
true
;
await
this
.
wechatFace
();
// 点击开通重新调用
// await this.wechatFace(); // 点击开通重新调用
if
(
WxFacepay
.
getUserPayScoreStatus
)
{
// 开通支付分
await
this
.
payscore
();
}
else
{
// 微信刷脸
await
this
.
wechatFace
();
}
this
.
faceBusy
=
false
;
this
.
faceBusy
=
false
;
});
});
// 监听微信输入手机号事件
// 监听微信输入手机号事件
...
@@ -236,7 +243,19 @@ class FacePage extends Component {
...
@@ -236,7 +243,19 @@ class FacePage extends Component {
};
};
face
=
()
=>
{
face
=
()
=>
{
this
.
state
.
faceType
===
'wxpay'
?
this
.
wechatFace
()
:
this
.
smileFace
();
const
{
faceType
}
=
this
.
state
;
if
(
faceType
===
'wxpay'
)
{
if
(
WxFacepay
.
getUserPayScoreStatus
&&
this
.
sense
)
{
// 开通支付分
this
.
payscore
();
}
else
{
// 微信刷脸
this
.
wechatFace
();
}
}
else
{
// 支付宝刷脸
this
.
smileFace
();
}
};
};
// device 代表当前打开的门
// device 代表当前打开的门
...
@@ -274,11 +293,7 @@ class FacePage extends Component {
...
@@ -274,11 +293,7 @@ class FacePage extends Component {
let
tipText
=
ret
.
msg
;
let
tipText
=
ret
.
msg
;
// 判断扣款方式使用支付分还是代扣
// 判断扣款方式使用支付分还是代扣
this
.
payscoreEnable
=
!!
ret
.
payscoreEnable
;
this
.
payscoreEnable
=
!!
ret
.
payscoreEnable
;
if
(
this
.
payscoreEnable
&&
ret
.
code
===
-
10
&&
this
.
sense
)
{
Speech
.
speak
(
tipText
);
Speech
.
speak
(
'正在开通支付分,请看向屏幕'
);
}
else
{
Speech
.
speak
(
tipText
);
}
this
.
userId
=
ret
.
userId
;
this
.
userId
=
ret
.
userId
;
if
(
ret
.
code
===
401
)
{
if
(
ret
.
code
===
401
)
{
// 需要验证手机号
// 需要验证手机号
...
@@ -290,11 +305,7 @@ class FacePage extends Component {
...
@@ -290,11 +305,7 @@ class FacePage extends Component {
}
}
if
(
ret
.
code
===
-
10
&&
this
.
sense
)
{
if
(
ret
.
code
===
-
10
&&
this
.
sense
)
{
// 无感设备
// 无感设备
if
(
WxFacepay
.
getUserPayScoreStatus
&&
this
.
payscoreEnable
)
{
this
.
setQrcode
({
action
:
ret
.
action
,
tip
:
tipText
,
qrcode
:
true
});
// 扫码开通免密支付
this
.
openPayScore
(
ret
.
action
);
}
else
{
this
.
setQrcode
({
action
:
ret
.
action
,
tip
:
tipText
,
qrcode
:
true
});
// 扫码开通免密支付
}
return
;
return
;
}
}
// else if (ret.orders && ret.orders.length > 0) {
// else if (ret.orders && ret.orders.length > 0) {
...
@@ -397,6 +408,7 @@ class FacePage extends Component {
...
@@ -397,6 +408,7 @@ class FacePage extends Component {
window
.
socket
.
connect
();
window
.
socket
.
connect
();
}
}
if
(
!
res
.
openid
)
{
if
(
!
res
.
openid
)
{
this
.
payscoreEnable
=
false
;
// 返回错误出现二维码扫码
// 返回错误出现二维码扫码
this
.
goTips
();
this
.
goTips
();
return
;
return
;
...
@@ -409,53 +421,17 @@ class FacePage extends Component {
...
@@ -409,53 +421,17 @@ class FacePage extends Component {
}
}
};
};
wxdoor
=
async
()
=>
{
// 微信人脸身份识别且开通支付分
this
.
loading
(
true
);
payscore
=
async
()
=>
{
const
action
=
{
type
:
'store/wxdoor'
,
openid
:
this
.
faceinfo
.
openid
,
wxtoken
:
this
.
faceinfo
.
token
,
nickname
:
this
.
faceinfo
.
nickname
,
};
if
(
validity
.
phone
.
test
(
this
.
phone
))
action
.
phone
=
this
.
phone
;
if
(
this
.
sense
)
action
.
sense
=
true
;
const
ret
=
await
this
.
props
.
dispatch
(
action
);
this
.
phone
=
''
;
this
.
loading
(
false
);
this
.
handleDoorLogin
(
ret
);
};
// 刷脸开通支付分
openPayScore
=
async
action
=>
{
const
{
orderId
,
code
}
=
await
this
.
getPayScoreStatus
();
if
(
orderId
&&
code
)
{
const
{
data
}
=
await
this
.
props
.
dispatch
({
type
:
'goods/payscoreCheck'
,
userId
:
this
.
userId
,
orderId
,
code
,
});
if
(
data
.
code
===
1
)
{
await
this
.
wxdoor
();
}
else
{
const
tipText
=
'请扫码开通支付分'
;
Speech
.
speak
(
tipText
);
this
.
setQrcode
({
action
,
tip
:
tipText
,
qrcode
:
true
});
// 扫码开通支付分
}
}
else
{
const
tipText
=
'请扫码开通支付分'
;
Speech
.
speak
(
tipText
);
this
.
setQrcode
({
action
,
tip
:
tipText
,
qrcode
:
true
});
// 扫码开通支付分
}
};
// 刷脸查询用户支付分状态
getPayScoreStatus
=
async
()
=>
{
const
{
orderDetailsModal
,
tipsModal
}
=
this
.
state
;
const
{
orderDetailsModal
,
tipsModal
}
=
this
.
state
;
if
(
orderDetailsModal
||
tipsModal
)
{
if
(
orderDetailsModal
||
tipsModal
)
{
// 出现订单弹窗,不做人脸识别
// 出现订单弹窗,不做人脸识别
return
;
return
;
}
}
const
tipText
=
!
this
.
payscoreEnable
?
'正在人脸识别,请看向屏幕,靠中间站稳'
:
'正在开通支付分,请看向屏幕'
;
Speech
.
speak
(
tipText
);
const
data
=
await
this
.
payscoreinfo
();
const
data
=
await
this
.
payscoreinfo
();
if
(
data
.
code
===
1
)
{
if
(
data
.
code
===
1
)
{
const
out_trade_no
=
data
.
data
.
orderId
;
const
out_trade_no
=
data
.
data
.
orderId
;
...
@@ -478,12 +454,49 @@ class FacePage extends Component {
...
@@ -478,12 +454,49 @@ class FacePage extends Component {
payscore_service_id
,
payscore_service_id
,
ask_unionid
:
1
,
ask_unionid
:
1
,
};
};
WxFacepay
.
getUserPayScoreStatus
(
params
);
let
res
=
await
WxFacepay
.
getUserPayScoreStatus
(
params
);
return
{
orderId
:
out_trade_no
,
code
:
payscore_out_request_no
};
if
(
!
res
.
openid
&&
!
AutoClick
.
enable
)
{
// 返回错误自动重新识别
res
=
(
await
WxFacepay
.
getUserPayScoreStatus
(
params
))
||
{};
}
if
(
window
.
socket
)
{
// 返回结果,立即重新连接socket
window
.
socket
.
connect
();
}
if
(
!
res
.
openid
)
{
// 返回错误出现二维码扫码
this
.
payscoreEnable
=
false
;
this
.
goTips
();
return
;
}
this
.
faceinfo
=
{
orderId
:
out_trade_no
,
authCode
:
payscore_out_request_no
,
...
res
,
};
await
this
.
wxdoor
();
}
}
}
}
};
};
wxdoor
=
async
()
=>
{
this
.
loading
(
true
);
const
action
=
{
type
:
'store/wxdoor'
,
openid
:
this
.
faceinfo
.
openid
,
wxtoken
:
this
.
faceinfo
.
token
||
''
,
nickname
:
this
.
faceinfo
.
nickname
||
''
,
orderId
:
this
.
faceinfo
.
orderId
||
''
,
authCode
:
this
.
faceinfo
.
authCode
||
''
,
};
if
(
validity
.
phone
.
test
(
this
.
phone
))
action
.
phone
=
this
.
phone
;
if
(
this
.
sense
)
action
.
sense
=
true
;
const
ret
=
await
this
.
props
.
dispatch
(
action
);
this
.
phone
=
''
;
this
.
loading
(
false
);
this
.
handleDoorLogin
(
ret
);
};
// 获取用户支付分状态
// 获取用户支付分状态
payscoreinfo
=
async
()
=>
{
payscoreinfo
=
async
()
=>
{
const
{
data
}
=
await
this
.
props
.
dispatch
({
const
{
data
}
=
await
this
.
props
.
dispatch
({
...
@@ -620,8 +633,7 @@ class FacePage extends Component {
...
@@ -620,8 +633,7 @@ class FacePage extends Component {
goTips
=
async
()
=>
{
goTips
=
async
()
=>
{
if
(
this
.
payscoreEnable
)
{
if
(
this
.
payscoreEnable
)
{
await
this
.
setState
({
tipsModal
:
false
});
await
this
.
setState
({
tipsModal
:
false
});
Speech
.
speak
(
'正在开通支付分,请看向屏幕'
);
this
.
payscore
();
this
.
openPayScore
(
this
.
action
);
}
else
{
}
else
{
Speech
.
speak
(
'请扫码开门'
);
Speech
.
speak
(
'请扫码开门'
);
this
.
setQrcode
({
action
:
this
.
action
,
tip
:
'请扫码开门'
,
qrcode
:
true
});
this
.
setQrcode
({
action
:
this
.
action
,
tip
:
'请扫码开门'
,
qrcode
:
true
});
...
...
src/services/goods.js
View file @
8639732b
...
@@ -70,10 +70,3 @@ export function wxauthinfo({rawdata}) {
...
@@ -70,10 +70,3 @@ export function wxauthinfo({rawdata}) {
export
function
payscoreinfo
()
{
export
function
payscoreinfo
()
{
return
axios
.
post
(
'/store/goods/payscore/info'
);
return
axios
.
post
(
'/store/goods/payscore/info'
);
}
}
export
function
payscoreCheck
({
userId
,
orderId
,
code
})
{
return
axios
.
post
(
'/store/goods/payscore/check'
,
qs
.
stringify
({
userId
,
orderId
,
code
}),
);
}
src/services/store.js
View file @
8639732b
...
@@ -44,6 +44,8 @@ export function wxdoor({
...
@@ -44,6 +44,8 @@ export function wxdoor({
fToken
,
fToken
,
phone
,
phone
,
sense
,
sense
,
orderId
,
authCode
,
})
{
})
{
return
axios
.
post
(
return
axios
.
post
(
'/store/wxdoor'
,
'/store/wxdoor'
,
...
@@ -56,6 +58,8 @@ export function wxdoor({
...
@@ -56,6 +58,8 @@ export function wxdoor({
fToken
,
fToken
,
phone
,
phone
,
sense
,
sense
,
orderId
,
authCode
,
}),
}),
);
);
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment