Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
T
ts-api-demo
Project
Project
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
wmvm
ts-api-demo
Commits
87dfa466
Commit
87dfa466
authored
Jan 12, 2025
by
1486327116
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update
parent
1db15a60
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
207 additions
and
2 deletions
+207
-2
airdrop.control.ts
src/functional/mvc/control/airdrop.control.ts
+68
-0
coinType.control.ts
src/functional/mvc/control/coinType.control.ts
+13
-0
airdrop.service.ts
src/functional/mvc/service/airdrop.service.ts
+106
-0
coinType.service.ts
src/functional/mvc/service/coinType.service.ts
+10
-1
index.ts
src/functional/router/v1/index.ts
+8
-1
access-limit.ts
src/setting/access-limit.ts
+1
-0
login-filter.ts
src/setting/login-filter.ts
+1
-0
No files found.
src/functional/mvc/control/airdrop.control.ts
0 → 100644
View file @
87dfa466
import
*
as
airdropService
from
"../service/airdrop.service"
;
import
{
AirdropVO
,
AirdropPageVO
}
from
"../service/airdrop.service"
;
let
{
logger
,
Res3Utils
,
optionalUtils
:
Optional
,
apiAssertUtils
:
ApiAssert
}
=
require
(
'@madex/ex-js-public'
);
import
{
ErrorCode
}
from
"../../../constant/errorCode"
;
import
{
getCurrentUserId
}
from
"../../../utils/aclUserUtils"
;
let
isIp
=
require
(
'is-ip'
);
export
const
list
=
async
(
req
:
any
,
airdropPageVO
:
AirdropPageVO
)
=>
{
let
func_name
=
"airdropCtrl.list"
;
try
{
airdropPageVO
.
page
=
Optional
.
opt
(
airdropPageVO
,
'page'
,
1
);
airdropPageVO
.
size
=
Optional
.
opt
(
airdropPageVO
,
'size'
,
20
);
let
res
=
await
airdropService
.
list
(
airdropPageVO
);
return
Res3Utils
.
result
(
res
);
}
catch
(
e
)
{
logger
.
error
(
`
${
func_name
}
error:
${
e
}
`
);
return
Res3Utils
.
getErrorResult
(
e
);
}
};
export
const
prizeList
=
async
(
req
:
any
,
airdropPageVO
:
AirdropPageVO
)
=>
{
let
func_name
=
"airdropCtrl.prizeList"
;
try
{
airdropPageVO
.
page
=
Optional
.
opt
(
airdropPageVO
,
'page'
,
1
);
airdropPageVO
.
size
=
Optional
.
opt
(
airdropPageVO
,
'size'
,
20
);
let
res
=
await
airdropService
.
prizeList
(
airdropPageVO
);
return
Res3Utils
.
result
(
res
);
}
catch
(
e
)
{
logger
.
error
(
`
${
func_name
}
error:
${
e
}
`
);
return
Res3Utils
.
getErrorResult
(
e
);
}
};
export
const
save
=
async
(
req
:
any
,
airdropVO
:
AirdropVO
)
=>
{
let
func_name
=
"airdropCtrl.save"
;
try
{
ApiAssert
.
notNull
(
ErrorCode
.
PARAM_MISS
,
airdropVO
.
name
);
ApiAssert
.
notNull
(
ErrorCode
.
PARAM_MISS
,
airdropVO
.
symbol
);
ApiAssert
.
notNull
(
ErrorCode
.
PARAM_MISS
,
airdropVO
.
total
);
ApiAssert
.
notNull
(
ErrorCode
.
PARAM_MISS
,
airdropVO
.
hard_limit
);
ApiAssert
.
notNull
(
ErrorCode
.
PARAM_MISS
,
airdropVO
.
lock_type
);
ApiAssert
.
notNull
(
ErrorCode
.
PARAM_MISS
,
airdropVO
.
lock_symbol
);
ApiAssert
.
notNull
(
ErrorCode
.
PARAM_MISS
,
airdropVO
.
lock_name
);
ApiAssert
.
notNull
(
ErrorCode
.
PARAM_MISS
,
airdropVO
.
lock_time
);
// weight [["1-100","3"],["101-1000","7"]]
ApiAssert
.
notNull
(
ErrorCode
.
PARAM_MISS
,
airdropVO
.
weight
);
ApiAssert
.
notNull
(
ErrorCode
.
PARAM_MISS
,
airdropVO
.
start_time
);
ApiAssert
.
notNull
(
ErrorCode
.
PARAM_MISS
,
airdropVO
.
end_time
);
let
ip
=
isIp
(
req
.
ip
)
?
req
.
ip
:
'*.*.*.*'
;
let
currentUserId
=
await
getCurrentUserId
(
req
.
cookies
.
session_id
);
let
res
=
await
airdropService
.
save
(
airdropVO
,
currentUserId
,
ip
);
return
Res3Utils
.
result
(
res
);
}
catch
(
e
)
{
logger
.
error
(
`
${
func_name
}
error:
${
e
}
`
);
return
Res3Utils
.
getErrorResult
(
e
);
}
};
src/functional/mvc/control/coinType.control.ts
View file @
87dfa466
...
...
@@ -145,6 +145,19 @@ export const mixinCoinList = async (req: any, param: ListParam) => {
}
};
export
const
nftList
=
async
(
req
:
any
,
param
:
ListParam
)
=>
{
let
func_name
=
"coinTypeCtl.nftList"
;
let
cmd
=
req
.
path
;
try
{
let
res
=
await
service
.
nftList
();
return
Res3Utils
.
result
(
res
);
}
catch
(
e
)
{
logger
.
error
(
`
${
func_name
}
error:
${
e
}
`
);
return
Res3Utils
.
getErrorResult
(
e
);
}
};
export
const
updateIconUrl
=
async
(
req
:
any
,
param
:
AddParam
)
=>
{
let
func_name
=
"coinTypeCtl.updateIconUrl"
;
let
cmd
=
req
.
path
;
...
...
src/functional/mvc/service/airdrop.service.ts
0 → 100644
View file @
87dfa466
import
{
ormDB
,
airdropSetting
,
airdropPrize
}
from
"@madex/ex-ts-dao"
;
import
{
ErrorCode
}
from
"../../../constant/errorCode"
;
import
{
addOptLog
}
from
"./userOptLog.service"
;
let
_
=
require
(
'lodash'
);
let
{
logger
,
datetimeUtils
}
=
require
(
'@madex/ex-js-public'
);
export
interface
AirdropVO
{
id
?:
number
;
name
?:
string
|
any
;
icon
?:
string
|
any
;
symbol
?:
string
|
any
;
desc
?:
string
|
any
;
website
?:
string
|
any
;
white_paper
?:
string
|
any
;
total
?:
number
;
hard_limit
?:
number
;
lock_type
?:
number
;
lock_symbol
?:
string
|
any
;
lock_name
?:
string
|
any
;
lock_icon
?:
string
|
any
;
lock_time
?:
number
;
weight
?:
string
|
any
;
rule
?:
string
|
any
;
start_time
?:
Date
|
any
;
end_time
?:
Date
|
any
;
status
?:
number
;
createdAt
?:
Date
|
any
;
updatedAt
?:
Date
|
any
;
}
export
interface
AirdropPageVO
extends
AirdropVO
{
user_id
?:
number
,
search
?
:
string
|
any
;
page
?:
number
;
size
?:
number
;
}
export
async
function
list
(
airdropPageVO
:
AirdropPageVO
)
{
let
where
=
{}
let
search
=
airdropPageVO
.
search
;
if
(
search
)
{
where
=
{
[
ormDB
.
Op
.
or
]:
{
symbol
:
{
[
ormDB
.
Op
.
like
]:
`
${
search
}
%`
},
name
:
{
[
ormDB
.
Op
.
like
]:
`%
${
search
}
%`
},
}
}
}
let
resList
=
await
airdropSetting
.
prototype
.
findAndCount
({
where
:
where
,
limit
:
airdropPageVO
.
size
,
offset
:
(
Number
(
airdropPageVO
.
page
)
-
1
)
*
Number
(
airdropPageVO
.
size
),
order
:
[[
"id"
,
"desc"
]],
raw
:
true
});
return
resList
;
}
export
async
function
prizeList
(
airdropPageVO
:
AirdropPageVO
)
{
let
where
=
{}
let
user_id
=
airdropPageVO
.
user_id
;
if
(
user_id
)
{
where
=
{
user_id
:
Number
(
airdropPageVO
.
user_id
),
}
}
let
resList
=
await
airdropPrize
.
prototype
.
findAndCount
({
where
:
where
,
limit
:
airdropPageVO
.
size
,
offset
:
(
Number
(
airdropPageVO
.
page
)
-
1
)
*
Number
(
airdropPageVO
.
size
),
order
:
[[
"id"
,
"desc"
]],
raw
:
true
});
return
resList
;
}
export
async
function
save
(
airdropVO
:
AirdropVO
,
currentUserId
:
any
,
ip
:
any
)
{
if
(
!
airdropVO
.
id
)
{
airdropVO
.
status
=
0
;
await
airdropSetting
.
prototype
.
create
(
airdropVO
);
}
else
{
await
airdropSetting
.
prototype
.
update
(
airdropVO
,{
where
:{
id
:
Number
(
airdropVO
.
id
)
}
})
}
//管理后台操作日志
addOptLog
(
currentUserId
,
0
,
'新增或修改空投活动'
,
ip
,
JSON
.
stringify
(
airdropVO
),
'空投活动'
);
return
'success'
}
src/functional/mvc/service/coinType.service.ts
View file @
87dfa466
// @madex/ex-ts-dao 是 ts 的 dao, 代码在 bitbucket/ex-js-dao 的 ts 分支上
import
{
coinType
,
ormDB
,
spotPairs
,
mixinCoin
,
mixinChain
}
from
"@madex/ex-ts-dao"
;
import
{
coinType
,
ormDB
,
spotPairs
,
mixinCoin
,
mixinChain
,
nftCollection
}
from
"@madex/ex-ts-dao"
;
import
{
addCoin2Core
}
from
"../../../utils/coreSystemUtils"
;
import
{
ErrorCode
}
from
"../../../constant/errorCode"
;
import
{
addOptLog
}
from
"./userOptLog.service"
;
...
...
@@ -323,6 +323,15 @@ export async function mixinCoinList(param: ListParam) {
return
resList
;
}
export
async
function
nftList
()
{
let
resList
=
await
nftCollection
.
prototype
.
findAndCount
({
order
:
[[
"id"
,
"desc"
]],
raw
:
true
});
return
resList
;
}
export
const
updateIconUrl
=
async
(
param
:
AddParam
,
currentUserId
:
any
,
ip
:
any
)
=>
{
let
id
=
param
.
id
;
let
dbInfo
=
await
coinType
.
prototype
.
findOne
({
...
...
src/functional/router/v1/index.ts
View file @
87dfa466
...
...
@@ -23,6 +23,8 @@ import * as ReqUtils from "../../../utils/req-utils";
import
*
as
spotPairCtrl
from
"../../mvc/control/spotPair.control"
;
import
*
as
coinTypeCtrl
from
"../../mvc/control/coinType.control"
;
import
*
as
noticeCtrl
from
"../../mvc/control/notice.control"
;
import
*
as
airdropCtrl
from
"../../mvc/control/airdrop.control"
;
import
*
as
mUserManageCtrl
from
"../../mvc/control/mUserManage.control"
;
import
*
as
mUserRealNameCtrl
from
"../../mvc/control/mUserRealName.control"
;
import
*
as
usefulLinkCtrl
from
"../../mvc/control/usefulLink.control"
;
...
...
@@ -90,6 +92,8 @@ const postFunc = {
'coinType/getAllSubmitSuccess'
:
coinTypeCtrl
.
getAllSubmitSuccess
,
'coinType/audit'
:
coinTypeCtrl
.
audit
,
'coinType/mixinCoinList'
:
coinTypeCtrl
.
mixinCoinList
,
'coinType/nftList'
:
coinTypeCtrl
.
nftList
,
'coinType/chainList'
:
coinTypeCtrl
.
chainList
,
'coinType/updateIconUrl'
:
coinTypeCtrl
.
updateIconUrl
,
...
...
@@ -328,7 +332,10 @@ const postFunc = {
'fiance/other/account/initAssetList'
:
fianceAccountCtrl
.
initAssetList
,
//运营部-活动管理-Launchpool
'launchpool/save'
:
airdropCtrl
.
save
,
'launchpool/list'
:
airdropCtrl
.
list
,
'launchpool/prizeList'
:
airdropCtrl
.
prizeList
};
...
...
src/setting/access-limit.ts
View file @
87dfa466
...
...
@@ -39,6 +39,7 @@ let cmdWhiteList = {
'coinType/getAllSubmitSuccess'
:
1
,
'coinType/audit'
:
1
,
'coinType/mixinCoinList'
:
1
,
'coinType/nftList'
:
1
,
'coinType/updateIconUrl'
:
1
,
//权限管理 - 我的权限
...
...
src/setting/login-filter.ts
View file @
87dfa466
...
...
@@ -23,6 +23,7 @@ const ExcludeApi = {
'department/allList'
:
1
,
'operate/other/business/area/list'
:
1
,
'coinType/mixinCoinList'
:
1
,
'coinType/nftList'
:
1
,
'coinType/chainList'
:
1
,
'mUser/manage/billTypeList'
:
1
,
...
...
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