Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
foreign
/
customer-service
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
12efd840
authored
Feb 14, 2022
by
Sixong.Zhu
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
u
parent
2d3f735b
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
34 additions
and
0 deletions
service/benefit.ts
service/benefit.ts
0 → 100644
View file @
12efd840
import
{
UniplatSdk
}
from
"uniplat-sdk"
;
export
const
enum
BenefitServiceName
{
CompanyApi
=
'company_api'
}
export
const
enum
BenefitApiName
{
Home
=
'home_data'
}
export
class
BenefitInvoker
{
private
static
readonly
subProject
=
'welfare_v2'
;
private
static
readonly
unsetupError
=
'服务尚未初始化'
;
private
static
sdk
:
UniplatSdk
|
null
=
null
;
public
static
setup
(
sdk
:
UniplatSdk
)
{
this
.
sdk
=
sdk
;
return
this
;
}
public
static
get
<
T
>
(
service
:
BenefitServiceName
,
api
:
BenefitApiName
)
{
if
(
this
.
sdk
)
{
return
this
.
sdk
.
domainService
(
this
.
subProject
,
service
,
api
).
request
<
{},
{},
T
>
(
'get'
);
}
return
Promise
.
reject
(
this
.
unsetupError
);
}
public
static
post
<
T
>
(
service
:
BenefitServiceName
,
api
:
BenefitApiName
,
data
?:
any
)
{
if
(
this
.
sdk
)
{
return
this
.
sdk
.
domainService
(
this
.
subProject
,
service
,
api
).
request
<
{},
{},
T
>
(
'post'
,
{
data
});
}
return
Promise
.
reject
(
this
.
unsetupError
);
}
}
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