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
ea3f8ff2
Commit
ea3f8ff2
authored
Aug 29, 2024
by
ml
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
增加 资源位管理 邮件订阅 相关接口
parent
55400170
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
1036 additions
and
48 deletions
+1036
-48
package-lock.json
package-lock.json
+64
-39
errorCode.ts
src/constant/errorCode.ts
+2
-0
statusConst.ts
src/constant/statusConst.ts
+26
-0
usefulLinkConst.ts
src/constant/usefulLinkConst.ts
+133
-0
mUserSubscribe.control.ts
src/functional/mvc/control/mUserSubscribe.control.ts
+176
-0
usefulLink.control.ts
src/functional/mvc/control/usefulLink.control.ts
+119
-0
mUserAccountOperateLog.service.ts
src/functional/mvc/service/mUserAccountOperateLog.service.ts
+1
-1
mUserMailLog.service.ts
src/functional/mvc/service/mUserMailLog.service.ts
+179
-0
mUserManage.service.ts
src/functional/mvc/service/mUserManage.service.ts
+6
-6
mUserRealName.service.ts
src/functional/mvc/service/mUserRealName.service.ts
+2
-2
mUserSubscribe.service.ts
src/functional/mvc/service/mUserSubscribe.service.ts
+112
-0
usefulLink.service.ts
src/functional/mvc/service/usefulLink.service.ts
+181
-0
userOptLog.service.ts
src/functional/mvc/service/userOptLog.service.ts
+2
-0
index.ts
src/functional/router/v1/index.ts
+20
-0
access-limit.ts
src/setting/access-limit.ts
+13
-0
No files found.
package-lock.json
View file @
ea3f8ff2
This diff is collapsed.
Click to expand it.
src/constant/errorCode.ts
View file @
ea3f8ff2
...
...
@@ -35,4 +35,6 @@ export const ErrorCode = {
USER_NOT_LOCK
:
'30032'
,
//该用户未锁定
REASON_TOO_LONG
:
'30033'
,
//驳回原因过长
DATA_STATUS_CHANGED
:
'30034'
,
//非法操作,数据状态已经变更
UID_ILLEGALITY
:
'30035'
,
//UID不合法
UID_TOO_MUCH
:
'30036'
,
//UID过多
}
src/constant/statusConst.ts
0 → 100644
View file @
ea3f8ff2
export
const
TYPE_MAIL
=
{
/**
* 邮件日志类型: 。
*/
TYPE_MAIL_LOG_MONEY_AND_KYC
:
1
,
/**
* 邮件日志类型: 。
*/
TYPE_MAIL_LOG_MONEY_AND_NO_KYC
:
2
,
/**
* 邮件日志类型: 。
*/
TYPE_MAIL_LOG_NO_MONEY_AND_KYC
:
3
,
/**
* 邮件日志类型: 。
*/
TYPE_MAIL_LOG_NO_MONEY_AND_NO_KYC
:
4
,
/**
* 邮件日志类型: 。
*/
TYPE_MAIL_LOG_ALL
:
5
,
/**
* 邮件日志类型: 。
*/
TYPE_MAIL_LOG_SINGLE
:
6
,
}
\ No newline at end of file
src/constant/usefulLinkConst.ts
0 → 100644
View file @
ea3f8ff2
/**
* useful_link表常量。
*/
export
const
IS_ACTIVE
=
{
/**
* 是否启用: 未启用。
*/
IS_ACTIVE_NO
:
0
,
/**
* 是否启用: 已启用。
*/
IS_ACTIVE_YES
:
1
}
export
const
IS_ACTIVE_ARR
=
[
IS_ACTIVE
.
IS_ACTIVE_NO
,
IS_ACTIVE
.
IS_ACTIVE_YES
]
export
const
LINK_TYPE
=
{
/**
* 友情链接。
*/
TYPE_NORMAL
:
1
,
/**
* 合作伙伴。
*/
TYPE_FRIEND
:
2
,
/**
* 公告。
*/
TYPE_NOTICE
:
3
,
/**
* 轮播图。
*/
TYPE_SLIDESHOW
:
4
,
/**
* app 轮播图。
*/
TYPE_SLIDESHOW_APP
:
5
,
/**
* 鼓励金比例管理。
*/
TYPE_BIX_LOCK_BACK_RATE
:
6
,
/**
* app 弹窗。
*/
TYPE_APP_POP
:
8
,
/**
* web 弹框。
*/
TYPE_WEB_POP
:
9
,
/**
* banner, 首页活动 banner。
*/
TYPE_BANNER
:
10
,
/**
* 活动中心。
*/
TYPE_ACTIVE_CENTER
:
11
,
/**
* 广告位: 红包页面。
*/
TYPE_ADVERTISE_RED_PACKET
:
12
,
/**
* 广告位: web交易页,币对位置。
*/
TYPE_ADVERTISE_WEB_PAIR
:
13
,
/**
* 广告位: 登录页面。
*/
TYPE_ADVERTISE_LOGIN
:
14
,
/**
* 广告位: 系统邮件。
*/
TYPE_ADVERTISE_SYS_MAIL
:
15
,
/**
* 标题广告: 币币交易详情页。
*/
TYPE_DETAIL_TRADE_SPOT
:
16
,
/**
* 标题广告: 杠杆交易详情页。
*/
TYPE_DETAIL_TRADE_CREDIT
:
17
,
/**
* 标题广告: 合约交易详情页。
*/
TYPE_DETAIL_TRADE_CONTRACT
:
18
,
/**
* 合约轮播图。
*/
TYPE_SLIDESHOW_CONTRACT
:
19
,
/**
* 合约公告
*/
TYPE_NOTICE_CONTRACT
:
20
,
}
export
const
LINK_TYPE_ARR
=
[
LINK_TYPE
.
TYPE_NORMAL
,
LINK_TYPE
.
TYPE_FRIEND
,
LINK_TYPE
.
TYPE_NOTICE
,
LINK_TYPE
.
TYPE_SLIDESHOW
,
LINK_TYPE
.
TYPE_SLIDESHOW_APP
,
LINK_TYPE
.
TYPE_BIX_LOCK_BACK_RATE
,
LINK_TYPE
.
TYPE_APP_POP
,
LINK_TYPE
.
TYPE_WEB_POP
,
LINK_TYPE
.
TYPE_BANNER
,
LINK_TYPE
.
TYPE_ACTIVE_CENTER
,
LINK_TYPE
.
TYPE_ADVERTISE_RED_PACKET
,
LINK_TYPE
.
TYPE_ADVERTISE_WEB_PAIR
,
LINK_TYPE
.
TYPE_ADVERTISE_LOGIN
,
LINK_TYPE
.
TYPE_ADVERTISE_SYS_MAIL
,
LINK_TYPE
.
TYPE_DETAIL_TRADE_SPOT
,
LINK_TYPE
.
TYPE_DETAIL_TRADE_CREDIT
,
LINK_TYPE
.
TYPE_DETAIL_TRADE_CONTRACT
,
LINK_TYPE
.
TYPE_SLIDESHOW_CONTRACT
,
LINK_TYPE
.
TYPE_NOTICE_CONTRACT
,
]
src/functional/mvc/control/mUserSubscribe.control.ts
0 → 100644
View file @
ea3f8ff2
import
*
as
mUserSubscribeService
from
"../service/mUserSubscribe.service"
;
import
{
QueryVO
}
from
"../service/mUserSubscribe.service"
;
import
*
as
mUserMailLogService
from
"../service/mUserMailLog.service"
;
import
{
UserMailLogVO
}
from
"../service/mUserMailLog.service"
;
let
{
logger
,
Res3Utils
,
optionalUtils
:
Optional
,
apiAssertUtils
:
ApiAssert
}
=
require
(
'@madex/ex-js-public'
);
import
{
ErrorCode
}
from
"../../../constant/errorCode"
;
import
{
IS_ACTIVE
,
IS_ACTIVE_ARR
,
LINK_TYPE_ARR
}
from
"../../../constant/usefulLinkConst"
;
import
{
getCurrentUserId
}
from
"../../../utils/aclUserUtils"
;
let
isIp
=
require
(
'is-ip'
);
/**
* 订阅列表
* @param req
* @param infoVO
*/
export
const
list
=
async
(
req
:
any
,
queryVO
:
QueryVO
)
=>
{
let
func_name
=
"mUserSubscribe.control.list"
;
try
{
queryVO
.
page
=
Optional
.
opt
(
queryVO
,
'page'
,
1
);
queryVO
.
size
=
Optional
.
opt
(
queryVO
,
'size'
,
20
);
let
res
=
await
mUserSubscribeService
.
list
(
queryVO
);
return
Res3Utils
.
result
(
res
);
}
catch
(
e
)
{
logger
.
error
(
`
${
func_name
}
error:
${
e
}
`
);
return
Res3Utils
.
getErrorResult
(
e
);
}
};
/**
* 删除订阅
* TODO: 关于status 字段 从老管理后台来看 0 代表无效 1 代表有效 但是数据库备注 0 有效 1 无效 以哪个为准?
* @param req
* @param authConfigVO
*/
export
const
del
=
async
(
req
:
any
,
queryVO
:
QueryVO
)
=>
{
let
func_name
=
"mUserSubscribe.control.delete"
;
try
{
let
ip
=
isIp
(
req
.
ip
)
?
req
.
ip
:
'*.*.*.*'
;
let
currentUserId
=
await
getCurrentUserId
(
req
.
cookies
.
session_id
);
ApiAssert
.
notNull
(
ErrorCode
.
PARAM_MISS
,
queryVO
.
id
);
let
res
=
await
mUserSubscribeService
.
del
(
Number
(
queryVO
.
id
),
currentUserId
,
ip
);
return
Res3Utils
.
result
(
res
);
}
catch
(
e
)
{
logger
.
error
(
`
${
func_name
}
error:
${
e
}
`
);
return
Res3Utils
.
getErrorResult
(
e
);
}
};
/**
* 订阅统计
* TODO: 关于status 字段 从老管理后台来看 0 代表无效 1 代表有效 但是数据库备注 0 有效 1 无效 以哪个为准?
* @param req
* @param authConfigVO
*/
export
const
count
=
async
(
req
:
any
,
queryVO
:
QueryVO
)
=>
{
let
func_name
=
"mUserSubscribe.control.count"
;
try
{
let
res
=
await
mUserSubscribeService
.
count
();
return
Res3Utils
.
result
(
res
);
}
catch
(
e
)
{
logger
.
error
(
`
${
func_name
}
error:
${
e
}
`
);
return
Res3Utils
.
getErrorResult
(
e
);
}
};
/**
* 邮件发送历史
* @param req
* @param infoVO
*/
export
const
history
=
async
(
req
:
any
,
userMailLogVO
:
UserMailLogVO
)
=>
{
let
func_name
=
"mUserSubscribe.control.history"
;
try
{
userMailLogVO
.
page
=
Optional
.
opt
(
userMailLogVO
,
'page'
,
1
);
userMailLogVO
.
size
=
Optional
.
opt
(
userMailLogVO
,
'size'
,
20
);
let
res
=
await
mUserMailLogService
.
history
(
userMailLogVO
.
page
,
userMailLogVO
.
size
);
return
Res3Utils
.
result
(
res
);
}
catch
(
e
)
{
logger
.
error
(
`
${
func_name
}
error:
${
e
}
`
);
return
Res3Utils
.
getErrorResult
(
e
);
}
};
/**
* 邮件详情
* @param req
* @param infoVO
*/
export
const
mailDetail
=
async
(
req
:
any
,
userMailLogVO
:
UserMailLogVO
)
=>
{
let
func_name
=
"mUserSubscribe.control.mailDetail"
;
try
{
if
(
!
userMailLogVO
.
id
)
{
throw
ErrorCode
.
PARAM_MISS
}
let
res
=
await
mUserMailLogService
.
mailDetail
(
userMailLogVO
.
id
);
return
Res3Utils
.
result
(
res
);
}
catch
(
e
)
{
logger
.
error
(
`
${
func_name
}
error:
${
e
}
`
);
return
Res3Utils
.
getErrorResult
(
e
);
}
};
/**
* 邮件发送
* TODO: 关于status 字段 从老管理后台来看 0 代表无效 1 代表有效 但是数据库备注 0 有效 1 无效 service里面又查询 status = 0 的 ???
* @param req
* @param userMailLogVO
*/
export
const
mailSend
=
async
(
req
:
any
,
userMailLogVO
:
UserMailLogVO
)
=>
{
let
func_name
=
"mUserSubscribe.control.mailSend"
;
try
{
if
(
!
userMailLogVO
.
subject
||
!
userMailLogVO
.
content
)
{
throw
ErrorCode
.
PARAM_MISS
}
let
ip
=
isIp
(
req
.
ip
)
?
req
.
ip
:
'*.*.*.*'
;
let
currentUserId
=
await
getCurrentUserId
(
req
.
cookies
.
session_id
);
let
subjectBuf
=
Buffer
.
from
(
String
(
userMailLogVO
.
subject
),
'base64'
);
let
contentBuf
=
Buffer
.
from
(
String
(
userMailLogVO
.
content
),
'base64'
);
userMailLogVO
.
subject
=
subjectBuf
.
toString
(
'utf8'
);
userMailLogVO
.
content
=
contentBuf
.
toString
(
'utf8'
);
let
res
=
await
mUserMailLogService
.
mailSend
(
userMailLogVO
,
currentUserId
,
ip
);
return
Res3Utils
.
result
(
res
);
}
catch
(
e
)
{
logger
.
error
(
`
${
func_name
}
error:
${
e
}
`
);
return
Res3Utils
.
getErrorResult
(
e
);
}
};
/**
* 群发邮件
* @param req
* @param userMailLogVO
*/
export
const
maiSendGroup
=
async
(
req
:
any
,
userMailLogVO
:
UserMailLogVO
)
=>
{
let
func_name
=
"mUserSubscribe.control.maiSendGroup"
;
try
{
if
(
!
userMailLogVO
.
subject
||
!
userMailLogVO
.
content
||
!
userMailLogVO
.
uidStr
)
{
throw
ErrorCode
.
PARAM_MISS
}
let
ip
=
isIp
(
req
.
ip
)
?
req
.
ip
:
'*.*.*.*'
;
let
currentUserId
=
await
getCurrentUserId
(
req
.
cookies
.
session_id
);
let
subjectBuf
=
Buffer
.
from
(
String
(
userMailLogVO
.
subject
),
'base64'
);
let
contentBuf
=
Buffer
.
from
(
String
(
userMailLogVO
.
content
),
'base64'
);
userMailLogVO
.
subject
=
subjectBuf
.
toString
(
'utf8'
);
userMailLogVO
.
content
=
contentBuf
.
toString
(
'utf8'
);
let
uids
=
userMailLogVO
.
uidStr
.
split
(
","
);
if
(
uids
.
length
>
1000
)
{
throw
ErrorCode
.
UID_TOO_MUCH
;
}
for
(
let
uid
of
uids
)
{
if
(
!
uid
)
{
throw
ErrorCode
.
UID_ILLEGALITY
;
}
}
let
res
=
await
mUserMailLogService
.
maiSendGroup
(
userMailLogVO
.
subject
,
userMailLogVO
.
content
,
currentUserId
,
ip
,
uids
);
return
Res3Utils
.
result
(
res
);
}
catch
(
e
)
{
logger
.
error
(
`
${
func_name
}
error:
${
e
}
`
);
return
Res3Utils
.
getErrorResult
(
e
);
}
};
\ No newline at end of file
src/functional/mvc/control/usefulLink.control.ts
0 → 100644
View file @
ea3f8ff2
import
*
as
usefulLinkService
from
"../service/usefulLink.service"
;
import
{
UsefulLinkVO
,
UsefulLinkPageVO
}
from
"../service/usefulLink.service"
;
let
{
logger
,
Res3Utils
,
optionalUtils
:
Optional
,
apiAssertUtils
:
ApiAssert
}
=
require
(
'@madex/ex-js-public'
);
import
{
ErrorCode
}
from
"../../../constant/errorCode"
;
import
{
IS_ACTIVE
,
IS_ACTIVE_ARR
,
LINK_TYPE_ARR
}
from
"../../../constant/usefulLinkConst"
;
import
{
getCurrentUserId
}
from
"../../../utils/aclUserUtils"
;
let
isIp
=
require
(
'is-ip'
);
/**
* 分页查询链接列表
* @param req
* @param infoVO
*/
export
const
list
=
async
(
req
:
any
,
usefulLinkPageVO
:
UsefulLinkPageVO
)
=>
{
let
func_name
=
"usefulLinkCtrl.list"
;
try
{
usefulLinkPageVO
.
page
=
Optional
.
opt
(
usefulLinkPageVO
,
'page'
,
1
);
usefulLinkPageVO
.
size
=
Optional
.
opt
(
usefulLinkPageVO
,
'size'
,
20
);
let
res
=
await
usefulLinkService
.
list
(
usefulLinkPageVO
);
return
Res3Utils
.
result
(
res
);
}
catch
(
e
)
{
logger
.
error
(
`
${
func_name
}
error:
${
e
}
`
);
return
Res3Utils
.
getErrorResult
(
e
);
}
};
/**
* 添加链接
* @param req
* @param infoVO
*/
export
const
add
=
async
(
req
:
any
,
usefulLinkVO
:
UsefulLinkVO
)
=>
{
let
func_name
=
"usefulLinkCtrl.add"
;
try
{
let
ip
=
isIp
(
req
.
ip
)
?
req
.
ip
:
'*.*.*.*'
;
let
currentUserId
=
await
getCurrentUserId
(
req
.
cookies
.
session_id
);
await
paramValid
(
usefulLinkVO
);
let
res
=
await
usefulLinkService
.
add
(
usefulLinkVO
,
currentUserId
,
ip
);
return
Res3Utils
.
result
(
res
);
}
catch
(
e
)
{
logger
.
error
(
`
${
func_name
}
error:
${
e
}
`
);
return
Res3Utils
.
getErrorResult
(
e
);
}
};
/**
* 修改链接
* @param req
* @param infoVO
*/
export
const
update
=
async
(
req
:
any
,
usefulLinkVO
:
UsefulLinkVO
)
=>
{
let
func_name
=
"usefulLinkCtrl.update"
;
try
{
let
ip
=
isIp
(
req
.
ip
)
?
req
.
ip
:
'*.*.*.*'
;
let
currentUserId
=
await
getCurrentUserId
(
req
.
cookies
.
session_id
);
await
paramValid
(
usefulLinkVO
);
let
res
=
await
usefulLinkService
.
update
(
usefulLinkVO
,
currentUserId
,
ip
);
return
Res3Utils
.
result
(
res
);
}
catch
(
e
)
{
logger
.
error
(
`
${
func_name
}
error:
${
e
}
`
);
return
Res3Utils
.
getErrorResult
(
e
);
}
};
/**
* 删除链接
* @param req
* @param authConfigVO
*/
export
const
del
=
async
(
req
:
any
,
usefulLinkVO
:
UsefulLinkVO
)
=>
{
let
func_name
=
"usefulLinkCtrl.del"
;
try
{
let
ip
=
isIp
(
req
.
ip
)
?
req
.
ip
:
'*.*.*.*'
;
let
currentUserId
=
await
getCurrentUserId
(
req
.
cookies
.
session_id
);
ApiAssert
.
notNull
(
ErrorCode
.
PARAM_MISS
,
usefulLinkVO
.
id
);
let
res
=
await
usefulLinkService
.
del
(
Number
(
usefulLinkVO
.
id
),
currentUserId
,
ip
);
return
Res3Utils
.
result
(
res
);
}
catch
(
e
)
{
logger
.
error
(
`
${
func_name
}
error:
${
e
}
`
);
return
Res3Utils
.
getErrorResult
(
e
);
}
};
/**
* 链接详情
* @param req
* @param authConfigVO
*/
export
const
detail
=
async
(
req
:
any
,
usefulLinkVO
:
UsefulLinkVO
)
=>
{
let
func_name
=
"usefulLinkCtrl.detail"
;
try
{
ApiAssert
.
notNull
(
ErrorCode
.
PARAM_MISS
,
usefulLinkVO
.
id
);
let
res
=
await
usefulLinkService
.
detail
(
Number
(
usefulLinkVO
.
id
));
return
Res3Utils
.
result
(
res
);
}
catch
(
e
)
{
logger
.
error
(
`
${
func_name
}
error:
${
e
}
`
);
return
Res3Utils
.
getErrorResult
(
e
);
}
};
async
function
paramValid
(
usefulLinkVO
:
UsefulLinkVO
)
{
let
type
=
Number
(
usefulLinkVO
.
type
);
let
active
=
Number
(
usefulLinkVO
.
is_active
);
if
(
!
usefulLinkVO
.
name
||
!
usefulLinkVO
.
url
||
!
type
||
isNaN
(
Number
(
active
))
||
!
usefulLinkVO
.
weight
||
!
usefulLinkVO
.
comment
)
{
throw
ErrorCode
.
PARAM_MISS
;
}
if
(
!
IS_ACTIVE_ARR
.
includes
(
active
)
||
!
LINK_TYPE_ARR
.
includes
(
type
))
{
throw
ErrorCode
.
PARAM_MISS
;
}
}
\ No newline at end of file
src/functional/mvc/service/mUserAccountOperateLog.service.ts
View file @
ea3f8ff2
...
...
@@ -23,7 +23,7 @@ export const TYPE = {
//实名
KYC
:
9
}
export
const
recordOperateLog
=
async
function
(
m_user_id
:
number
,
operate_user_id
:
number
,
operate_type
:
number
,
export
const
record
MUser
OperateLog
=
async
function
(
m_user_id
:
number
,
operate_user_id
:
number
,
operate_type
:
number
,
comment
:
string
,
before_v
:
string
,
after_v
:
string
)
{
let
aclUser
=
await
aclUserInfo
.
prototype
.
findOne
({
where
:
{
...
...
src/functional/mvc/service/mUserMailLog.service.ts
0 → 100644
View file @
ea3f8ff2
import
{
ormDB
,
usefulLink
,
userMailLog
,
userSub
}
from
"@madex/ex-ts-dao"
;
import
{
ErrorCode
}
from
"../../../constant/errorCode"
;
import
{
addOptLog
,
LogType
}
from
"./userOptLog.service"
;
import
{
sendEmail
}
from
"../../../utils/mUserUtils"
;
import
{
TYPE_MAIL
}
from
"../../../constant/statusConst"
;
let
_
=
require
(
'lodash'
);
let
{
logger
}
=
require
(
'@madex/ex-js-public'
);
export
interface
UserMailLogVO
{
id
?:
number
;
user_id
?:
number
;
is_kyc
?:
number
;
lang
?:
string
;
have_money
?:
number
;
subject
?:
string
,
content
?:
string
,
page
?:
number
,
size
?:
number
uidStr
?:
string
}
export
async
function
history
(
page
:
number
|
undefined
,
size
:
number
|
undefined
)
{
let
resList
=
await
userMailLog
.
prototype
.
findAndCount
({
limit
:
size
,
offset
:
(
Number
(
page
)
-
1
)
*
Number
(
size
),
order
:
[[
"id"
,
"desc"
]],
raw
:
true
});
return
resList
;
}
export
async
function
mailDetail
(
id
:
number
|
undefined
)
{
let
dbInfo
=
await
userMailLog
.
prototype
.
findOne
({
where
:
{
id
:
id
},
raw
:
true
});
if
(
!
dbInfo
)
{
throw
ErrorCode
.
DATA_NOT_EXIST
;
}
return
dbInfo
;
}
export
async
function
mailSend
(
userMailLogVO
:
UserMailLogVO
,
currentUserId
:
any
,
ip
:
string
|
undefined
)
{
let
where
=
{
//TODO:0 ? 1 ???
status
:
0
};
if
(
userMailLogVO
.
user_id
)
{
where
[
"user_id"
]
=
userMailLogVO
.
user_id
}
else
{
let
kyc
=
userMailLogVO
.
is_kyc
;
if
(
kyc
&&
(
kyc
==
1
||
kyc
==
2
))
{
where
[
"is_kyc"
]
=
kyc
}
let
haveMoney
=
userMailLogVO
.
have_money
;
if
(
haveMoney
&&
(
haveMoney
==
1
||
haveMoney
==
2
))
{
where
[
"have_money"
]
=
haveMoney
}
if
(
userMailLogVO
.
lang
)
{
where
[
"lang"
]
=
userMailLogVO
.
lang
}
}
let
toAddrRes
=
await
userSub
.
prototype
.
findAll
({
where
:
where
});
if
(
!
toAddrRes
.
length
)
{
throw
ErrorCode
.
DATA_NOT_EXIST
}
let
params
=
{
subject
:
userMailLogVO
.
subject
,
content
:
userMailLogVO
.
content
}
for
(
let
sub
of
toAddrRes
)
{
//TODO:老管理后台就没有模版 ???
sendEmail
(
sub
.
sub
,
sub
.
user_id
,
""
,
params
,
userMailLogVO
.
lang
);
}
let
type
=
userMailLogVO
.
user_id
?
TYPE_MAIL
.
TYPE_MAIL_LOG_SINGLE
:
getType
(
Number
(
userMailLogVO
.
is_kyc
),
Number
(
userMailLogVO
.
have_money
));
let
insertInfo
=
await
userMailLog
.
prototype
.
create
({
subject
:
userMailLogVO
.
subject
,
content
:
userMailLogVO
.
content
,
user_id
:
userMailLogVO
.
user_id
,
type
:
type
,
number
:
toAddrRes
.
length
,
createdAt
:
new
Date
(),
updatedAt
:
new
Date
(),
});
//管理后台操作日志
addOptLog
(
currentUserId
,
`ip:
${
ip
}
,发送订阅邮件:
${
JSON
.
stringify
(
insertInfo
)}
`
,
LogType
.
SUB_MAIL_SEND
);
return
insertInfo
;
}
export
async
function
maiSendGroup
(
subject
:
string
,
content
:
string
,
currentUserId
:
any
,
ip
:
string
|
undefined
,
uids
:
string
[])
{
let
mailLogList
:
any
=
[];
for
(
let
uid
of
uids
)
{
let
oneUid
=
Number
(
uid
);
if
(
!
oneUid
)
{
throw
ErrorCode
.
UID_ILLEGALITY
}
let
insertOne
=
{
subject
:
subject
,
content
:
content
,
user_id
:
oneUid
,
type
:
TYPE_MAIL
.
TYPE_MAIL_LOG_SINGLE
,
number
:
1
,
status
:
-
1
,
createdAt
:
new
Date
(),
updatedAt
:
new
Date
(),
}
mailLogList
.
push
(
insertOne
);
}
let
partList
=
_
.
chunk
(
mailLogList
,
100
);
let
tx
;
try
{
tx
=
await
ormDB
.
transaction
();
for
(
let
onePartList
of
partList
)
{
await
userMailLog
.
prototype
.
bulkCreate
(
onePartList
,
{
transaction
:
tx
});
}
await
tx
.
commit
();
}
catch
(
e
)
{
if
(
tx
)
{
await
tx
.
rollback
();
}
logger
.
error
(
`maiSendGroup.bulkCreate.error:`
+
e
);
}
//管理后台操作日志
addOptLog
(
currentUserId
,
`ip:
${
ip
}
,群发邮件:主题:
${
JSON
.
stringify
(
subject
)}
,用户:
${
uids
}
`
,
LogType
.
SUB_MAIL_SEND_GROUP
);
return
"success"
}
function
getType
(
isKyc
:
number
,
haveMoney
:
number
)
{
if
(
haveMoney
==
1
&&
isKyc
==
1
)
{
return
1
;
}
if
(
haveMoney
==
1
&&
isKyc
==
2
)
{
return
2
;
}
if
(
haveMoney
==
2
&&
isKyc
==
1
)
{
return
3
;
}
if
(
haveMoney
==
2
&&
isKyc
==
2
)
{
return
4
;
}
return
5
;
}
src/functional/mvc/service/mUserManage.service.ts
View file @
ea3f8ff2
...
...
@@ -10,7 +10,7 @@ import { addLog, MUserLogType } from "./mUserOptLog.service";
import
{
addOptLog
,
LogType
}
from
"./userOptLog.service"
;
import
{
checkTotp
}
from
"../../../utils/aclUserUtils"
;
import
{
getFatherUserId
,
getUidsByFatherUid
}
from
"./mUserInfoSon.service"
;
import
{
recordOperateLog
,
TYPE
}
from
"./mUserAccountOperateLog.service"
;
import
{
record
MUser
OperateLog
,
TYPE
}
from
"./mUserAccountOperateLog.service"
;
let
_
=
require
(
'lodash'
);
let
{
logger
,
datetimeUtils
}
=
require
(
'@madex/ex-js-public'
);
...
...
@@ -195,7 +195,7 @@ export async function updateUserEmail(currentUserId: number, m_user_id: any, ema
//管理后台操作日志
addOptLog
(
currentUserId
,
`ip:
${
ip
}
,修改用户:
${
m_user_id
}
邮箱,原邮箱:
${
dbEmail
}
,新邮箱:
${
email
}
`
,
LogType
.
UPDATE_MUSER_EMAIL
);
//管理后台操作Madex 用户的日志
recordOperateLog
(
m_user_id
,
currentUserId
,
TYPE
.
MAIL
,
`ip:
${
ip
}
,修改邮箱`
,
dbEmail
,
email
);
record
MUser
OperateLog
(
m_user_id
,
currentUserId
,
TYPE
.
MAIL
,
`ip:
${
ip
}
,修改邮箱`
,
dbEmail
,
email
);
return
'success'
;
}
...
...
@@ -245,7 +245,7 @@ export async function lockAccount(currentUserId: number, m_user_id: any, ip: any
//管理后台操作日志
addOptLog
(
currentUserId
,
comment
,
LogType
.
LOCK_MUSER
);
//管理后台操作Madex 用户的日志
recordOperateLog
(
fatherUserId
,
currentUserId
,
TYPE
.
ACCOUNT_STATUS
,
comment
,
"0"
,
"1"
);
record
MUser
OperateLog
(
fatherUserId
,
currentUserId
,
TYPE
.
ACCOUNT_STATUS
,
comment
,
"0"
,
"1"
);
return
'success'
;
}
...
...
@@ -301,7 +301,7 @@ export async function unlockAccount(currentUserId: number, m_user_id: any, ip: a
//管理后台操作日志
addOptLog
(
currentUserId
,
comment
,
LogType
.
UNLOCK_MUSER
);
//管理后台操作Madex 用户的日志
recordOperateLog
(
fatherUserId
,
currentUserId
,
TYPE
.
ACCOUNT_STATUS
,
comment
,
"1"
,
"0"
);
record
MUser
OperateLog
(
fatherUserId
,
currentUserId
,
TYPE
.
ACCOUNT_STATUS
,
comment
,
"1"
,
"0"
);
return
'success'
;
}
...
...
@@ -315,7 +315,7 @@ export async function clearLoginLimit(currentUserId: number, m_user_id: any, ip:
//管理后台操作日志
addOptLog
(
currentUserId
,
`ip:
${
ip
}
,清除用户登陆限制:
${
m_user_id
}
`
,
LogType
.
CLEAR_LOGIN_LIMIT
);
//管理后台操作Madex 用户的日志
recordOperateLog
(
m_user_id
,
currentUserId
,
TYPE
.
TWO_HOUR_LIMIT
,
`ip:
${
ip
}
,清除用户登陆限制:
${
m_user_id
}
`
,
""
,
""
);
record
MUser
OperateLog
(
m_user_id
,
currentUserId
,
TYPE
.
TWO_HOUR_LIMIT
,
`ip:
${
ip
}
,清除用户登陆限制:
${
m_user_id
}
`
,
""
,
""
);
return
'success'
;
}
...
...
@@ -337,7 +337,7 @@ export async function clear24WithdrawLimit(currentUserId: number, m_user_id: any
//管理后台操作日志
addOptLog
(
currentUserId
,
`ip:
${
ip
}
,清除用户24小时提现限制:
${
m_user_id
}
`
,
LogType
.
WITHDRAW_24_LIMIT
);
//管理后台操作Madex 用户的日志
recordOperateLog
(
m_user_id
,
currentUserId
,
TYPE
.
TWENTY_FOUR_HOUR_LIMIT
,
`ip:
${
ip
}
,清除用户24小时提现限制:
${
m_user_id
}
`
,
""
,
""
);
record
MUser
OperateLog
(
m_user_id
,
currentUserId
,
TYPE
.
TWENTY_FOUR_HOUR_LIMIT
,
`ip:
${
ip
}
,清除用户24小时提现限制:
${
m_user_id
}
`
,
""
,
""
);
return
'success'
;
}
...
...
src/functional/mvc/service/mUserRealName.service.ts
View file @
ea3f8ff2
...
...
@@ -6,7 +6,7 @@ import { getMUserInfoByUid, sendEmail } from "../../../utils/mUserUtils";
import
{
EMAIL_FORBID_TEMPLATE
,
REAL_NAME_DENY
,
REAL_NAME_PASS
}
from
"../../../constant/emailTemplateType"
;
import
{
KYC_STATUS
,
SETTING_FLAG
}
from
"../../../constant/mUserInfoConst"
;
import
{
addOptLog
,
LogType
}
from
"./userOptLog.service"
;
import
{
recordOperateLog
,
TYPE
}
from
"./mUserAccountOperateLog.service"
;
import
{
record
MUser
OperateLog
,
TYPE
}
from
"./mUserAccountOperateLog.service"
;
let
{
logger
,
}
=
require
(
'@madex/ex-js-public'
);
...
...
@@ -205,7 +205,7 @@ export async function audit(queryVO: QueryVO, currentUserId: any, ip: string | u
//管理后台操作日志
addOptLog
(
currentUserId
,
`ip:
${
ip
}
,实名认证审核:
${
dbUserInfo
.
user_id
}
,
${
remark
}
`
,
LogType
.
KYC_AUDIT
);
//管理后台操作Madex 用户的日志
recordOperateLog
(
dbUserInfo
.
user_id
,
currentUserId
,
TYPE
.
KYC
,
`ip:
${
ip
}
,实名认证审核:
${
dbUserInfo
.
user_id
}
,
${
remark
}
`
,
""
,
""
);
record
MUser
OperateLog
(
dbUserInfo
.
user_id
,
currentUserId
,
TYPE
.
KYC
,
`ip:
${
ip
}
,实名认证审核:
${
dbUserInfo
.
user_id
}
,
${
remark
}
`
,
""
,
""
);
return
'success'
;
}
...
...
src/functional/mvc/service/mUserSubscribe.service.ts
0 → 100644
View file @
ea3f8ff2
import
{
ormDB
,
usefulLink
,
userSub
}
from
"@madex/ex-ts-dao"
;
import
{
ErrorCode
}
from
"../../../constant/errorCode"
;
import
{
addOptLog
,
LogType
}
from
"./userOptLog.service"
;
let
_
=
require
(
'lodash'
);
let
{
logger
}
=
require
(
'@madex/ex-js-public'
);
export
interface
QueryVO
{
id
?:
number
;
user_id
?:
number
|
any
;
is_kyc
?:
number
;
have_money
?:
number
;
page
?:
number
,
size
?:
number
}
export
async
function
list
(
queryVO
:
QueryVO
)
{
let
where
=
Object
.
create
(
null
);
if
(
queryVO
.
user_id
)
{
where
.
user_id
=
queryVO
.
user_id
;
}
if
(
queryVO
.
is_kyc
)
{
where
.
is_kyc
=
queryVO
.
is_kyc
;
}
if
(
queryVO
.
have_money
)
{
where
.
have_money
=
queryVO
.
have_money
;
}
let
resList
=
await
userSub
.
prototype
.
findAndCount
({
where
:
where
,
limit
:
queryVO
.
size
,
offset
:
(
Number
(
queryVO
.
page
)
-
1
)
*
Number
(
queryVO
.
size
),
order
:
[[
"createdAt"
,
"desc"
]],
raw
:
true
});
return
resList
;
}
export
async
function
del
(
id
:
number
,
currentUserId
:
any
,
ip
:
string
|
undefined
)
{
let
dbInfo
=
await
userSub
.
prototype
.
findOne
({
where
:
{
id
:
id
},
raw
:
true
});
if
(
!
dbInfo
)
{
throw
ErrorCode
.
DATA_NOT_EXIST
;
}
await
userSub
.
prototype
.
update
({
status
:
0
,
},
{
where
:
{
id
:
Number
(
id
)
}
});
//管理后台操作日志
addOptLog
(
currentUserId
,
`ip:
${
ip
}
,删除用户订阅:
${
JSON
.
stringify
(
dbInfo
)}
`
,
LogType
.
DEL
);
return
'success'
}
export
async
function
count
()
{
let
res
=
{
money_and_kyc
:
0
,
money_and_no_kyc
:
0
,
no_money_and_kyc
:
0
,
no_money_and_no_kyc
:
0
,
}
let
dbInfoList
=
await
userSub
.
prototype
.
findAll
({
where
:
{
status
:
1
},
raw
:
true
});
if
(
dbInfoList
.
length
)
{
let
kycMap
=
_
.
groupBy
(
dbInfoList
,
'is_kyc'
);
let
throughList
=
kycMap
[
"1"
]
?
kycMap
[
"1"
]
:
[];
let
noThroughList
=
kycMap
[
"2"
]
?
kycMap
[
"2"
]
:
[];
if
(
throughList
.
length
)
{
let
moneyMap
=
_
.
groupBy
(
throughList
,
'have_money'
);
res
.
money_and_kyc
=
moneyMap
[
"1"
]
&&
moneyMap
[
"1"
].
length
?
moneyMap
[
"1"
].
length
:
0
res
.
no_money_and_kyc
=
moneyMap
[
"2"
]
&&
moneyMap
[
"2"
].
length
?
moneyMap
[
"2"
].
length
:
0
}
if
(
noThroughList
.
length
)
{
let
moneyMap
=
_
.
groupBy
(
noThroughList
,
'have_money'
);
res
.
money_and_no_kyc
=
moneyMap
[
"1"
]
&&
moneyMap
[
"1"
].
length
?
moneyMap
[
"1"
].
length
:
0
res
.
no_money_and_no_kyc
=
moneyMap
[
"2"
]
&&
moneyMap
[
"2"
].
length
?
moneyMap
[
"2"
].
length
:
0
}
}
return
res
;
}
src/functional/mvc/service/usefulLink.service.ts
0 → 100644
View file @
ea3f8ff2
import
{
ormDB
,
usefulLink
}
from
"@madex/ex-ts-dao"
;
import
{
ErrorCode
}
from
"../../../constant/errorCode"
;
import
{
addOptLog
,
LogType
}
from
"./userOptLog.service"
;
let
_
=
require
(
'lodash'
);
let
{
logger
}
=
require
(
'@madex/ex-js-public'
);
export
interface
UsefulLinkVO
{
id
?:
number
;
name
?:
string
|
any
;
url
?:
string
|
any
;
type
?:
number
|
any
;
weight
?:
number
;
is_active
?:
number
;
status
?:
number
;
time_per_day
?:
number
;
comment
?:
string
|
any
;
createdAt
?:
Date
|
any
;
updatedAt
?:
Date
|
any
;
}
export
interface
UsefulLinkPageVO
extends
UsefulLinkVO
{
page
?:
number
,
size
?:
number
}
export
async
function
list
(
usefulLinkPageVO
:
UsefulLinkPageVO
)
{
let
where
=
Object
.
create
(
null
);
if
(
usefulLinkPageVO
.
name
)
{
where
.
name
=
{
[
ormDB
.
Op
.
like
]:
`
${
usefulLinkPageVO
.
name
}
%`
};
}
if
(
usefulLinkPageVO
.
url
)
{
where
.
url
=
{
[
ormDB
.
Op
.
like
]:
`
${
usefulLinkPageVO
.
url
}
%`
};
}
if
(
usefulLinkPageVO
.
type
)
{
if
(
!
isNaN
(
Number
(
usefulLinkPageVO
.
type
))){
where
.
type
=
usefulLinkPageVO
.
type
;
}
else
{
let
typeList
=
usefulLinkPageVO
.
type
.
split
(
","
);
where
.
type
=
{
[
ormDB
.
Op
.
in
]:
typeList
};
}
}
if
(
!
isNaN
(
Number
(
usefulLinkPageVO
.
is_active
)))
{
where
.
is_active
=
usefulLinkPageVO
.
is_active
;
}
let
resList
=
await
usefulLink
.
prototype
.
findAndCount
({
where
:
where
,
limit
:
usefulLinkPageVO
.
size
,
offset
:
(
Number
(
usefulLinkPageVO
.
page
)
-
1
)
*
Number
(
usefulLinkPageVO
.
size
),
order
:
[[
"weight"
,
"desc"
]],
raw
:
true
});
return
resList
;
}
export
async
function
add
(
usefulLinkVO
:
UsefulLinkVO
,
currentUserId
:
any
,
ip
:
string
|
undefined
)
{
usefulLinkVO
.
createdAt
=
new
Date
();
usefulLinkVO
.
updatedAt
=
new
Date
();
let
dbInfo
=
await
usefulLink
.
prototype
.
create
(
usefulLinkVO
);
//日志
//管理后台操作日志
addOptLog
(
currentUserId
,
`ip:
${
ip
}
,添加链接记录:
${
JSON
.
stringify
(
dbInfo
.
id
)}
`
,
LogType
.
ADD
);
return
'success'
}
export
async
function
update
(
usefulLinkVO
:
UsefulLinkVO
,
currentUserId
:
any
,
ip
:
string
|
undefined
)
{
let
dbInfo
=
await
usefulLink
.
prototype
.
findOne
({
where
:
{
id
:
usefulLinkVO
.
id
},
raw
:
true
});
if
(
!
dbInfo
)
{
throw
ErrorCode
.
DATA_NOT_EXIST
;
}
let
updateInfo
=
{
updatedAt
:
new
Date
()
};
if
(
usefulLinkVO
.
name
)
{
updateInfo
[
"name"
]
=
usefulLinkVO
.
name
}
if
(
usefulLinkVO
.
url
)
{
updateInfo
[
"url"
]
=
usefulLinkVO
.
url
;
}
if
(
usefulLinkVO
.
type
)
{
updateInfo
[
"type"
]
=
usefulLinkVO
.
type
;
}
if
(
usefulLinkVO
.
weight
)
{
updateInfo
[
"weight"
]
=
usefulLinkVO
.
weight
;
}
if
(
!
isNaN
(
Number
(
usefulLinkVO
.
status
)))
{
updateInfo
[
"status"
]
=
usefulLinkVO
.
status
;
}
if
(
!
isNaN
(
Number
(
usefulLinkVO
.
time_per_day
)))
{
updateInfo
[
"time_per_day"
]
=
usefulLinkVO
.
time_per_day
;
}
if
(
!
isNaN
(
Number
(
usefulLinkVO
.
is_active
)))
{
updateInfo
[
"is_active"
]
=
usefulLinkVO
.
is_active
;
}
if
(
usefulLinkVO
.
comment
)
{
updateInfo
[
"comment"
]
=
usefulLinkVO
.
comment
;
}
await
usefulLink
.
prototype
.
update
(
updateInfo
,
{
where
:
{
id
:
Number
(
dbInfo
.
id
)
}
});
//管理后台操作日志
addOptLog
(
currentUserId
,
`ip:
${
ip
}
,修改链接记录:原记录:
${
JSON
.
stringify
(
dbInfo
.
id
)}
`
,
LogType
.
UPDATE
);
return
'success'
}
export
async
function
del
(
id
:
number
,
currentUserId
:
any
,
ip
:
string
|
undefined
)
{
let
dbInfo
=
await
usefulLink
.
prototype
.
findOne
({
where
:
{
id
:
id
},
raw
:
true
});
if
(
!
dbInfo
)
{
throw
ErrorCode
.
DATA_NOT_EXIST
;
}
await
usefulLink
.
prototype
.
destroy
({
where
:
{
id
:
Number
(
id
)
}
});
//管理后台操作日志
addOptLog
(
currentUserId
,
`ip:
${
ip
}
,删除链接记录:
${
JSON
.
stringify
(
dbInfo
.
id
)}
`
,
LogType
.
DEL
);
return
'success'
}
export
async
function
detail
(
id
:
number
)
{
let
dbInfo
=
await
usefulLink
.
prototype
.
findOne
({
where
:
{
id
:
id
},
raw
:
true
});
if
(
!
dbInfo
)
{
throw
ErrorCode
.
DATA_NOT_EXIST
;
}
return
dbInfo
;
}
src/functional/mvc/service/userOptLog.service.ts
View file @
ea3f8ff2
...
...
@@ -18,6 +18,8 @@ export const LogType = {
CLEAR_LOGIN_LIMIT
:
10
,
//清除用户登陆限制
WITHDRAW_24_LIMIT
:
11
,
//清除用户24小时限制
KYC_AUDIT
:
12
,
//用户实名认证审核
SUB_MAIL_SEND
:
13
,
//邮件订阅发送
SUB_MAIL_SEND_GROUP
:
14
,
//邮件订阅群发
}
export
const
addOptLog
=
async
function
(
user_id
:
any
,
msg
:
any
,
type
:
any
,
fail_reason
?:
any
,
session_id
?:
any
)
{
...
...
src/functional/router/v1/index.ts
View file @
ea3f8ff2
...
...
@@ -23,6 +23,8 @@ import * as noticeCtrl from "../../mvc/control/notice.control";
import
*
as
mUserOptLogCtrl
from
"../../mvc/control/mUserOptLog.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"
;
import
*
as
mUserSubscribeCtrl
from
"../../mvc/control/mUserSubscribe.control"
;
const
getFunc
=
{
'user/info'
:
userController
.
getUserInfo
,
};
...
...
@@ -105,6 +107,24 @@ const postFunc = {
'mUser/manage/kyc/oneDetail'
:
mUserRealNameCtrl
.
oneDetail
,
//Madex 用户管理 ->kyc详情
'mUser/manage/kyc/audit'
:
mUserRealNameCtrl
.
audit
,
//Madex 用户管理 ->kyc审核
//资源位管理
'link/useful/list'
:
usefulLinkCtrl
.
list
,
//链接记录列表
'link/useful/add'
:
usefulLinkCtrl
.
add
,
//添加链接记录
'link/useful/delete'
:
usefulLinkCtrl
.
del
,
//删除链接记录
'link/useful/update'
:
usefulLinkCtrl
.
update
,
//修改链接记录
'link/useful/detail'
:
usefulLinkCtrl
.
detail
,
//链接记录详情
//邮件订阅
'mUser/subscribe/list'
:
mUserSubscribeCtrl
.
list
,
//订阅列表
'mUser/subscribe/delete'
:
mUserSubscribeCtrl
.
del
,
//删除订阅
'mUser/subscribe/count'
:
mUserSubscribeCtrl
.
count
,
//订阅统计
'mUser/subscribe/mail/history'
:
mUserSubscribeCtrl
.
history
,
//发送历史
'mUser/subscribe/mail/send'
:
mUserSubscribeCtrl
.
mailSend
,
//邮件发送
'mUser/subscribe/mail/detail'
:
mUserSubscribeCtrl
.
mailDetail
,
//发送详情
'mUser/subscribe/mail/send/group'
:
mUserSubscribeCtrl
.
maiSendGroup
,
//群发邮件
};
...
...
src/setting/access-limit.ts
View file @
ea3f8ff2
...
...
@@ -65,6 +65,19 @@ let cmdWhiteList = {
'mUser/manage/kyc/list'
:
1
,
'mUser/manage/kyc/oneDetail'
:
1
,
'mUser/manage/kyc/audit'
:
1
,
'link/useful/list'
:
1
,
'link/useful/add'
:
1
,
'link/useful/delete'
:
1
,
'link/useful/update'
:
1
,
'link/useful/detail'
:
1
,
'mUser/subscribe/list'
:
1
,
'mUser/subscribe/delete'
:
1
,
'mUser/subscribe/count'
:
1
,
'mUser/subscribe/mail/history'
:
1
,
'mUser/subscribe/mail/send'
:
1
,
'mUser/subscribe/mail/detail'
:
1
,
'mUser/subscribe/mail/send/group'
:
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