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
75f5184d
Commit
75f5184d
authored
Apr 04, 2023
by
Ron
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' into fix_WX_browser_20230403
merge
parents
e5f13bf3
c8945665
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
17 additions
and
3 deletions
+17
-3
package.json
packages/toolkit/package.json
+1
-1
Defined.ts
packages/toolkit/src/Payment/Defined.ts
+7
-0
Payment.ts
packages/toolkit/src/Payment/Payment.ts
+9
-2
No files found.
packages/toolkit/package.json
View file @
75f5184d
{
"name"
:
"@ydl-packages/toolkit"
,
"version"
:
"1.0.8"
,
"version"
:
"1.0.8
-beta.2
"
,
"description"
:
""
,
"main"
:
"./dist/index.umd.js"
,
"scripts"
:
{
...
...
packages/toolkit/src/Payment/Defined.ts
View file @
75f5184d
...
...
@@ -126,6 +126,13 @@ export type ToPayReturns = {
payUrl
?:
string
}
export
type
BalanceReturns
=
{
success
:
boolean
code
?:
number
msg
?:
string
}
export
interface
DoUnifiedParams
extends
Omit
<
ToPayParams
,
'totalAmount'
|
'redirectUrl'
>
{
payChannel
?:
PayChannel
,
payBalance
:
number
,
...
...
packages/toolkit/src/Payment/Payment.ts
View file @
75f5184d
...
...
@@ -18,6 +18,7 @@ import {
PayType
,
ToPayParams
,
ToPayReturns
,
BalanceReturns
,
WechatPayParams
}
from
"./Defined"
;
import
{
ACCESS_TOKEN
,
UID
}
from
"@/Const"
;
...
...
@@ -89,15 +90,21 @@ export class Payment {
}
}
async
getBalance
():
Promise
<
number
>
{
//isHandleErr 是否要自定义处理异常
async
getBalance
(
handleErr
:
(
err
:
BalanceReturns
)
=>
void
):
Promise
<
number
|
null
>
{
try
{
const
{
data
:
res
}
=
await
requestForPhp
.
post
(
MY_BALANCE
,
{
balance
:
1
})
if
(
res
.
data
&&
res
.
data
.
balance
)
{
this
.
balance
=
Number
(
res
.
data
.
balance
)
}
if
(
handleErr
&&
res
.
msg
!==
'success'
){
handleErr
&&
handleErr
(
res
)
return
null
}
return
this
.
balance
}
catch
(
err
)
{
return
0
handleErr
&&
handleErr
({
success
:
false
})
return
!!
handleErr
?
null
:
0
}
}
getPayMethodList
(
totalAmount
:
number
)
{
...
...
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