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
52041612
Commit
52041612
authored
Jan 18, 2021
by
修福龙
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
通过刷脸开通微信支付分
parent
fd0c90a4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
132 additions
and
17 deletions
+132
-17
goods.js
src/models/goods.js
+6
-0
FacePage.js
src/pages/FacePage.js
+107
-15
goods.js
src/services/goods.js
+13
-2
AutoClick.js
src/utils/AutoClick.js
+6
-0
No files found.
src/models/goods.js
View file @
52041612
...
@@ -90,5 +90,11 @@ export default {
...
@@ -90,5 +90,11 @@ export default {
delete
action
.
type
;
delete
action
.
type
;
return
yield
call
(
api
.
wxauthinfo
,
action
);
return
yield
call
(
api
.
wxauthinfo
,
action
);
},
},
*
payscoreinfo
(
action
,
{
call
})
{
return
yield
call
(
api
.
payscoreinfo
,
action
);
},
*
payscoreCheck
(
action
,
{
call
})
{
return
yield
call
(
api
.
payscoreCheck
,
action
);
},
},
},
};
};
src/pages/FacePage.js
View file @
52041612
...
@@ -270,7 +270,12 @@ class FacePage extends Component {
...
@@ -270,7 +270,12 @@ class FacePage extends Component {
if
(
ret
.
code
<
0
||
ret
.
code
===
401
)
{
if
(
ret
.
code
<
0
||
ret
.
code
===
401
)
{
// 未授权,提示用户扫码验证
// 未授权,提示用户扫码验证
let
tipText
=
ret
.
msg
;
let
tipText
=
ret
.
msg
;
Speech
.
speak
(
tipText
);
let
payscoreEnable
=
ret
.
payscoreEnable
;
if
(
payscoreEnable
)
{
Speech
.
speak
(
'正在开通支付分,请看向屏幕,靠中间站稳'
);
}
else
{
Speech
.
speak
(
tipText
);
}
this
.
userId
=
ret
.
userId
;
this
.
userId
=
ret
.
userId
;
if
(
ret
.
code
===
401
)
{
if
(
ret
.
code
===
401
)
{
// 需要验证手机号
// 需要验证手机号
...
@@ -281,7 +286,34 @@ class FacePage extends Component {
...
@@ -281,7 +286,34 @@ class FacePage extends Component {
return
;
return
;
}
}
if
(
ret
.
code
===
-
10
)
{
if
(
ret
.
code
===
-
10
)
{
this
.
setQrcode
({
action
:
ret
.
action
,
tip
:
tipText
,
qrcode
:
true
});
// 开通免密支付
if
(
this
.
sense
&&
WxFacepay
.
getUserPayScoreStatus
&&
payscoreEnable
)
{
let
openPayScore
=
false
;
const
{
orderId
,
code
}
=
await
this
.
getPayScoreStatus
();
if
(
orderId
&&
code
)
{
for
(
let
i
=
0
;
i
<
10
;
i
++
)
{
// 查询用户支付分状态与服务授权状态
await
delay
(
1000
);
const
{
data
}
=
await
this
.
props
.
dispatch
({
type
:
'goods/payscoreCheck'
,
userId
:
ret
.
userId
,
orderId
,
code
,
});
if
(
data
.
code
===
1
&&
data
.
data
.
payscoreState
)
{
openPayScore
=
true
;
await
this
.
wxdoor
();
break
;
}
}
}
if
(
!
openPayScore
)
{
tipText
=
'请扫码开通支付分'
;
Speech
.
speak
(
tipText
);
this
.
setQrcode
({
action
:
ret
.
action
,
tip
:
tipText
,
qrcode
:
true
});
// 扫码开通支付分
}
}
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) {
...
@@ -391,22 +423,82 @@ class FacePage extends Component {
...
@@ -391,22 +423,82 @@ class FacePage extends Component {
if
(
res
.
sub_openid
)
{
if
(
res
.
sub_openid
)
{
res
.
openid
=
res
.
sub_openid
;
res
.
openid
=
res
.
sub_openid
;
}
}
this
.
loading
(
true
);
this
.
faceinfo
=
{...
res
};
const
action
=
{
await
this
.
wxdoor
();
type
:
'store/wxdoor'
,
openid
:
res
.
openid
,
wxtoken
:
res
.
token
,
nickname
:
res
.
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
);
}
}
};
};
wxdoor
=
async
()
=>
{
this
.
loading
(
true
);
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
);
};
// 刷脸查询用户支付分状态
getPayScoreStatus
=
async
()
=>
{
const
{
orderDetailsModal
,
tipsModal
}
=
this
.
state
;
if
(
orderDetailsModal
||
tipsModal
)
{
// 出现订单弹窗,不做人脸识别
return
;
}
// const tipText = '正在开通支付分,请看向屏幕,靠中间站稳';
// Speech.speak(tipText);
const
data
=
await
this
.
payscoreinfo
();
if
(
data
.
code
===
1
)
{
const
out_trade_no
=
data
.
data
.
orderId
;
const
payscore_out_request_no
=
data
.
data
.
authorizationCode
;
const
payscore_service_id
=
data
.
data
.
payscoreId
;
let
auth
=
(
await
this
.
payscoreAuthinfo
())
||
{};
if
(
auth
.
return_code
===
'SUCCESS'
||
(
auth
.
code
===
1
&&
auth
.
data
.
bizCode
===
'0000'
)
)
{
if
(
auth
.
data
)
{
auth
=
auth
.
data
;
}
const
params
=
{
appid
:
auth
.
appid
||
auth
.
subAppId
,
mch_id
:
auth
.
mch_id
||
auth
.
subMchId
,
out_trade_no
,
authinfo
:
auth
.
authinfo
||
auth
.
authInfo
,
payscore_out_request_no
,
payscore_service_id
,
// ask_unionid: 1,
};
WxFacepay
.
getUserPayScoreStatus
(
params
);
return
{
orderId
:
out_trade_no
,
code
:
payscore_out_request_no
};
}
}
};
// 获取用户支付分状态
payscoreinfo
=
async
()
=>
{
const
{
data
}
=
await
this
.
props
.
dispatch
({
type
:
'goods/payscoreinfo'
,
});
return
data
;
};
// 获取刷脸支付调用凭证
payscoreAuthinfo
=
async
()
=>
{
const
rawdata
=
await
WxFacepay
.
rawdata
();
const
{
data
}
=
await
this
.
props
.
dispatch
({
type
:
'goods/wxauthinfo'
,
rawdata
,
});
return
data
;
};
alipayinfo
=
async
()
=>
{
alipayinfo
=
async
()
=>
{
const
{
data
}
=
await
this
.
props
.
dispatch
({
type
:
'goods/alipayinfo'
});
const
{
data
}
=
await
this
.
props
.
dispatch
({
type
:
'goods/alipayinfo'
});
this
.
alipayInfo
=
await
Smilepay
.
init
(
data
);
this
.
alipayInfo
=
await
Smilepay
.
init
(
data
);
...
...
src/services/goods.js
View file @
52041612
...
@@ -63,6 +63,17 @@ export function smilepay({zimmetainfo, service_id, service_params}) {
...
@@ -63,6 +63,17 @@ export function smilepay({zimmetainfo, service_id, service_params}) {
);
);
}
}
export
function
wxauthinfo
(
action
)
{
export
function
wxauthinfo
({
rawdata
})
{
return
axios
.
post
(
'/common/wxpay/faceAuth'
,
action
);
return
axios
.
post
(
'/common/wxpay/faceAuth'
,
qs
.
stringify
({
rawdata
}));
}
export
function
payscoreinfo
()
{
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/utils/AutoClick.js
View file @
52041612
...
@@ -44,6 +44,12 @@ if (!NativeModules.AutoClick) {
...
@@ -44,6 +44,12 @@ if (!NativeModules.AutoClick) {
search
:
`
${
wxPkg
}
:id/container_register_allow_button`
,
search
:
`
${
wxPkg
}
:id/container_register_allow_button`
,
parent
:
false
,
parent
:
false
,
},
},
wxpayscoreRegister
:
{
pkgName
:
wxPkg
,
method
:
'clickByText'
,
search
:
'申请授权'
,
parent
:
true
,
},
smileConfirm
:
{
smileConfirm
:
{
pkgName
:
alPkg
,
pkgName
:
alPkg
,
method
:
'clickByExact'
,
method
:
'clickByExact'
,
...
...
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