Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Y
ydl-packages
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
1
Merge Requests
1
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
许振钊
ydl-packages
Commits
1daa76d5
Commit
1daa76d5
authored
Sep 08, 2022
by
郑炬波
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: zf
parent
c8c1fdcf
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
11 deletions
+11
-11
package.json
packages/toolkit/package.json
+1
-1
Payment.ts
packages/toolkit/src/Payment/Payment.ts
+10
-10
No files found.
packages/toolkit/package.json
View file @
1daa76d5
{
"name"
:
"@ydl-packages/toolkit"
,
"version"
:
"1.0.1-next.2
2
"
,
"version"
:
"1.0.1-next.2
4
"
,
"description"
:
""
,
"main"
:
"./dist/index.umd.js"
,
"scripts"
:
{
...
...
packages/toolkit/src/Payment/Payment.ts
View file @
1daa76d5
...
...
@@ -156,12 +156,6 @@ export class Payment {
success
:
false
,
errorType
:
PayError
.
VALIDATE
}
}
else
if
(
decodeURIComponent
(
redirectUrl
)
===
redirectUrl
)
{
return
{
errorMessage
:
PayErrorMessage
.
WECHAT_REDIRECT_URL_ENCODE
,
success
:
false
,
errorType
:
PayError
.
VALIDATE
}
}
}
else
{
return
{
...
...
@@ -203,6 +197,9 @@ export class Payment {
// validate end <<<
// hack, 后端微信redirectUrl用的quitUrl
const
payChannel
=
this
.
getPayChannel
(
payType
)
if
(
payChannel
===
PayChannel
.
WX_MWEB
||
payChannel
===
PayChannel
.
WX_JSAPI
)
{
quitUrl
=
redirectUrl
}
const
doUnifiedParams
:
DoUnifiedParams
=
{
returnUrl
,
quitUrl
,
...
...
@@ -285,16 +282,18 @@ export class Payment {
})
}
static
async
loopValidateOrderState
(
count
=
0
,
callBack
:
OrderStateCallBack
):
Promise
<
void
>
{
static
async
loopValidateOrderState
(
count
=
0
,
callBack
:
OrderStateCallBack
,
polltime
=
3000
):
Promise
<
void
>
{
const
[,
queryString
]
=
window
.
location
.
href
.
split
(
'?'
)
const
query
=
queryString
?
qs
.
parse
(
queryString
,
{
ignoreQueryPrefix
:
true
})
:
{}
const
returnParams
:
BackInfo
=
{
payId
:
Number
(
query
[
BACK_PAY_ID
]),
orderId
:
Number
(
query
[
BACK_ORDER_ID
])}
let
timer
:
any
=
null
;
const
checkLoop
=
()
=>
{
if
(
--
count
>
0
)
{
setTimeout
(()
=>
{
this
.
loopValidateOrderState
(
count
,
callBack
)
},
1000
)
timer
=
setTimeout
(()
=>
{
this
.
loopValidateOrderState
(
count
,
callBack
,
polltime
)
},
polltime
)
}
else
{
clearInterval
(
timer
);
callBack
({
isPay
:
false
,
...
returnParams
})
}
}
...
...
@@ -304,6 +303,7 @@ export class Payment {
payId
:
query
[
BACK_PAY_ID
]
})
if
(
res
.
code
===
'200'
&&
res
.
data
===
true
)
{
clearInterval
(
timer
);
callBack
({
isPay
:
true
,
...
returnParams
})
}
else
{
checkLoop
()
...
...
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