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
a9f7fc8b
Commit
a9f7fc8b
authored
Aug 08, 2024
by
ml
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
管理后台 权限 角色 登陆 谷歌 相关功能
parent
abd07b9b
Hide whitespace changes
Inline
Side-by-side
Showing
28 changed files
with
2618 additions
and
86 deletions
+2618
-86
config.development.ts
config/config.development.ts
+3
-1
config.production.ts
config/config.production.ts
+1
-1
index.ts
config/index.ts
+8
-1
index.ts
index.ts
+8
-25
package-lock.json
package-lock.json
+6
-5
package.json
package.json
+1
-1
aclUserAuthConfigConstant.ts
src/constant/aclUserAuthConfigConstant.ts
+11
-0
aclUserConstant.ts
src/constant/aclUserConstant.ts
+18
-0
errorCode.ts
src/constant/errorCode.ts
+28
-0
redis-val.ts
src/constant/redis-val.ts
+13
-0
aclRoleAuth.control.ts
src/functional/mvc/control/aclRoleAuth.control.ts
+289
-0
aclUser.control.ts
src/functional/mvc/control/aclUser.control.ts
+116
-0
i18n.control.ts
src/functional/mvc/control/i18n.control.ts
+18
-17
i18nlog.control.ts
src/functional/mvc/control/i18nlog.control.ts
+9
-8
userAuthConfig.control.ts
src/functional/mvc/control/userAuthConfig.control.ts
+89
-0
userOpt.control.ts
src/functional/mvc/control/userOpt.control.ts
+194
-0
aclRoleAuth.service.ts
src/functional/mvc/service/aclRoleAuth.service.ts
+651
-0
aclUser.service.ts
src/functional/mvc/service/aclUser.service.ts
+228
-0
i18n.service.ts
src/functional/mvc/service/i18n.service.ts
+4
-3
i18nlog.service.ts
src/functional/mvc/service/i18nlog.service.ts
+2
-1
userAuthConfig.service.ts
src/functional/mvc/service/userAuthConfig.service.ts
+266
-0
userOpt.service.ts
src/functional/mvc/service/userOpt.service.ts
+293
-0
index.ts
src/functional/router/v1/index.ts
+54
-23
access-limit.ts
src/setting/access-limit.ts
+68
-0
login-filter.ts
src/setting/login-filter.ts
+50
-0
aclUserUtils.ts
src/utils/aclUserUtils.ts
+87
-0
crypt-utils.ts
src/utils/crypt-utils.ts
+15
-0
req-utils.ts
src/utils/req-utils.ts
+88
-0
No files found.
config/config.development.ts
View file @
a9f7fc8b
// 配置文件暂时和 js 的导出方式保持一致,涉及到线上环境变量的替换等
// 配置文件暂时和 js 的导出方式保持一致,涉及到线上环境变量的替换等
module
.
exports
=
{};
module
.
exports
=
{
\ No newline at end of file
BASE_URL
:
"/backend/v1/"
};
\ No newline at end of file
config/config.production.ts
View file @
a9f7fc8b
// 配置文件暂时和 js 的导出方式保持一致,涉及到线上环境变量的替换等
// 配置文件暂时和 js 的导出方式保持一致,涉及到线上环境变量的替换等
module
.
exports
=
{
module
.
exports
=
{
BASE_URL
:
"/backend/v1/"
}
}
\ No newline at end of file
config/index.ts
View file @
a9f7fc8b
...
@@ -15,5 +15,12 @@ export default _.merge(
...
@@ -15,5 +15,12 @@ export default _.merge(
{
{
port
:
8080
,
//服务端口
port
:
8080
,
//服务端口
contractData
:
{}
contractData
:
{}
}
},
{
LOGIN_ERROR_LIMIT
:
10
,
LOGIN_EXPIRED
:
16
*
60
*
60
,
LOGIN_IP_LIMIT
:
40
,
MIN_RATIO_LIMIT
:
0
,
// 由0.01 =>变为0
MAX_RATIO_LIMIT
:
1
,
},
);
);
\ No newline at end of file
index.ts
View file @
a9f7fc8b
...
@@ -2,15 +2,15 @@ let express = require('express');
...
@@ -2,15 +2,15 @@ let express = require('express');
let
errorHandler
=
require
(
'errorhandler'
);
let
errorHandler
=
require
(
'errorhandler'
);
let
logger
=
require
(
"@madex/ex-js-public"
).
logger
;
let
logger
=
require
(
"@madex/ex-js-public"
).
logger
;
import
configSetting
from
"./config"
import
{
apiRouterV1
}
from
"./src/functional/router/v1/index"
/* ======================================================================
/* ======================================================================
* Config
* Config
* ====================================================================== */
* ====================================================================== */
let
app
=
express
();
let
app
=
express
();
logger
.
use
(
app
);
logger
.
use
(
app
);
const
tfUrl
=
"/api/v1/tf"
;
// express 全局设定
// express 全局设定
require
(
'@madex/ex-js-common'
).
expressSetting
(
app
);
require
(
'@madex/ex-js-common'
).
expressSetting
(
app
);
// Request frequency limit
// Request frequency limit
...
@@ -22,7 +22,10 @@ const limitList = [
...
@@ -22,7 +22,10 @@ const limitList = [
require
(
"@madex/ex-js-common"
).
frequencyLimiting
.
cookieLimitForCmd
(
app
,
limitList
);
require
(
"@madex/ex-js-common"
).
frequencyLimiting
.
cookieLimitForCmd
(
app
,
limitList
);
require
(
"@madex/ex-js-common"
).
apiExceedAlertUtils
.
check
(
app
,
{
projectNO
:
20
,
expireTime
:
1000
})
// 检查
require
(
"@madex/ex-js-common"
).
apiExceedAlertUtils
.
check
(
app
,
{
projectNO
:
20
,
expireTime
:
1000
})
// 检查
import
configSetting
from
"./config"
require
(
"./src/setting/access-limit"
).
filter
(
app
);
require
(
"./src/setting/login-filter"
).
filter
(
app
);
if
(
configSetting
.
node_env
==
"development"
)
{
if
(
configSetting
.
node_env
==
"development"
)
{
app
.
use
(
errorHandler
());
app
.
use
(
errorHandler
());
...
@@ -34,29 +37,9 @@ else {
...
@@ -34,29 +37,9 @@ else {
});
});
}
}
/* ======================================================================
* internal Router
* ====================================================================== */
// require('./setting/access-limit')(app);
// require('./setting/apikey-filter')(app);
// require('./setting/need-login')(app);
// require('./setting/need-newotc')(app);
// if (configSetting.node_env === 'development') {
// require("./setting/swagger-setting")(app);
// app.listen(3020, () => logger.info("South Gate to Heaven swagger started!! suffix : 3020/southHeaven"));
// }
import
{
apiRouterV1
}
from
"./src/functional/router/v1/index"
app
.
use
(
'/demo/v1'
,
apiRouterV1
);
app
.
use
(
apiRouterV1
);
//启动Server
// app.listen(configSetting.port, function () {
// // logger.info("Wallet Gateway-(bibox_b020_southgatetoheaven) server listening on %d, in %s mode", configSetting.port, app.get("env"));
// // wxUtils.serviceStartSend('bibox_b020_southgatetoheaven');
// });
// 输出进程错误
// 输出进程错误
process
.
on
(
'uncaughtException'
,
(
error
)
=>
{
process
.
on
(
'uncaughtException'
,
(
error
)
=>
{
...
@@ -74,7 +57,7 @@ process.on('unhandledRejection', (error, promise) => {
...
@@ -74,7 +57,7 @@ process.on('unhandledRejection', (error, promise) => {
// console.log(configSetting)
// console.log(configSetting)
app
.
listen
(
configSetting
.
port
,
'0.0.0.0'
,
()
=>
{
app
.
listen
(
configSetting
.
port
,
'0.0.0.0'
,
()
=>
{
logger
.
info
(
logger
.
info
(
'
demo
'
,
'
backend
'
,
configSetting
.
port
,
configSetting
.
port
,
app
.
get
(
'env'
),
app
.
get
(
'env'
),
);
);
...
...
package-lock.json
View file @
a9f7fc8b