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
c8945665
Commit
c8945665
authored
Apr 04, 2023
by
许振钊
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'feat_balance_0403' into 'master'
feat: 余额请求能力透出 See merge request
!8
parents
e1749b07
c9385ddd
Hide 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 @
c8945665
{
{
"name"
:
"@ydl-packages/toolkit"
,
"name"
:
"@ydl-packages/toolkit"
,
"version"
:
"1.0.8"
,
"version"
:
"1.0.8
-beta.2
"
,
"description"
:
""
,
"description"
:
""
,
"main"
:
"./dist/index.umd.js"
,
"main"
:
"./dist/index.umd.js"
,
"scripts"
:
{
"scripts"
:
{
...
...
packages/toolkit/src/Payment/Defined.ts
View file @
c8945665
...
@@ -126,6 +126,13 @@ export type ToPayReturns = {
...
@@ -126,6 +126,13 @@ export type ToPayReturns = {
payUrl
?:
string
payUrl
?:
string
}
}
export
type
BalanceReturns
=
{
success
:
boolean
code
?:
number
msg
?:
string
}
export
interface
DoUnifiedParams
extends
Omit
<
ToPayParams
,
'totalAmount'
|
'redirectUrl'
>
{
export
interface
DoUnifiedParams
extends
Omit
<
ToPayParams
,
'totalAmount'
|
'redirectUrl'
>
{
payChannel
?:
PayChannel
,
payChannel
?:
PayChannel
,
payBalance
:
number
,
payBalance
:
number
,
...
...
packages/toolkit/src/Payment/Payment.ts
View file @
c8945665
...
@@ -18,6 +18,7 @@ import {
...
@@ -18,6 +18,7 @@ import {
PayType
,
PayType
,
ToPayParams
,
ToPayParams
,
ToPayReturns
,
ToPayReturns
,
BalanceReturns
,
WechatPayParams
WechatPayParams
}
from
"./Defined"
;
}
from
"./Defined"
;
import
{
ACCESS_TOKEN
,
UID
}
from
"@/Const"
;
import
{
ACCESS_TOKEN
,
UID
}
from
"@/Const"
;
...
@@ -89,15 +90,21 @@ export class Payment {
...
@@ -89,15 +90,21 @@ export class Payment {
}
}
}
}
async
getBalance
():
Promise
<
number
>
{
//isHandleErr 是否要自定义处理异常
async
getBalance
(
handleErr
:
(
err
:
BalanceReturns
)
=>
void
):
Promise
<
number
|
null
>
{
try
{
try
{
const
{
data
:
res
}
=
await
requestForPhp
.
post
(
MY_BALANCE
,
{
balance
:
1
})
const
{
data
:
res
}
=
await
requestForPhp
.
post
(
MY_BALANCE
,
{
balance
:
1
})
if
(
res
.
data
&&
res
.
data
.
balance
)
{
if
(
res
.
data
&&
res
.
data
.
balance
)
{
this
.
balance
=
Number
(
res
.
data
.
balance
)
this
.
balance
=
Number
(
res
.
data
.
balance
)
}
}
if
(
handleErr
&&
res
.
msg
!==
'success'
){
handleErr
&&
handleErr
(
res
)
return
null
}
return
this
.
balance
return
this
.
balance
}
catch
(
err
)
{
}
catch
(
err
)
{
return
0
handleErr
&&
handleErr
({
success
:
false
})
return
!!
handleErr
?
null
:
0
}
}
}
}
getPayMethodList
(
totalAmount
:
number
)
{
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