Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
V
vue-gjjs
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
zhouqian
vue-gjjs
Commits
716bffcc
Commit
716bffcc
authored
Nov 24, 2021
by
fukai
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
提供直接调用交易API
parent
864a60ec
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
43 additions
and
0 deletions
+43
-0
Emitter.js
src/service/Emitter.js
+43
-0
No files found.
src/service/Emitter.js
0 → 100644
View file @
716bffcc
import
Api
from
'./Api'
export
default
class
Emitter
{
static
DEFAULT
=
"default"
static
RULE
=
"rule"
static
CHECK
=
"check"
static
execute
(
trnName
,
path
,
data
,
ruleType
=
this
.
RULE
){
let
url
=
`
${
trnName
}
/execute
${
ruleType
.
substring
(
0
,
1
).
toUpperCase
()}${
ruleType
.
substring
(
1
)}
/
${
path
.
toLowerCase
()}
`
return
Api
.
post
(
url
,
data
);
}
/**
* 执行具体交易路径的rule
* @param {*} trnName 交易名称
* @param {*} data 数据,可以为函数,结构(或者返回的结构)需要为{key1:val1,key2:val2...params:{}}
* @param {*} path rule路径
* @returns 执行结果,使用await,.then均可接收结果
*/
static
executeRule
(
trnName
,
data
,
path
){
return
this
.
execute
(
trnName
,
data
,
path
)
}
/**
* 执行具体交易路径的check
* @param {*} trnName 交易名称
* @param {*} data 数据,可以为函数,结构(或者返回的结构)需要为{key1:val1,key2:val2...params:{}}
* @param {*} path rule路径
* @returns 执行结果,使用await,.then均可接收结果
*/
static
executeCheck
(
trnName
,
data
,
path
){
return
this
.
execute
(
trnName
,
data
,
path
,
this
.
CHECK
)
}
/**
* 执行具体交易路径的default
* @param {*} trnName 交易名称
* @param {*} data 数据,可以为函数,结构(或者返回的结构)需要为{key1:val1,key2:val2...params:{}}
* @param {*} path rule路径
* @returns 执行结果,使用await,.then均可接收结果
*/
static
executeDefault
(
trnName
,
data
,
path
){
return
this
.
execute
(
trnName
,
data
,
path
,
this
.
DEFAULT
)
}
}
\ No newline at end of file
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