midway-fatcms 0.0.1-beta.1 → 0.0.1-beta.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/config/config.default.js +52 -15
- package/dist/controller/base/BaseApiController.js +9 -6
- package/dist/controller/gateway/CrudMtdGatewayController.js +4 -1
- package/dist/controller/gateway/DocGatewayController.js +13 -8
- package/dist/controller/gateway/StaticController.d.ts +3 -0
- package/dist/controller/gateway/StaticController.js +41 -21
- package/dist/controller/home.controller.js +2 -2
- package/dist/controller/manage/CrudStandardDesignApi.js +89 -74
- package/dist/controller/manage/DeployManageApi.js +6 -4
- package/dist/controller/manage/SuperAdminManageApi.js +12 -8
- package/dist/controller/manage/SysConfigMangeApi.js +3 -1
- package/dist/controller/manage/UserAccountManageApi.d.ts +1 -1
- package/dist/controller/manage/UserAccountManageApi.js +5 -0
- package/dist/controller/myinfo/AuthController.d.ts +0 -4
- package/dist/controller/myinfo/AuthController.js +0 -53
- package/dist/controller/render/AppRenderController.js +4 -2
- package/dist/controller/test.controller.js +1 -1
- package/dist/index.d.ts +28 -4
- package/dist/index.js +28 -4
- package/dist/libs/crud-pro/interfaces.d.ts +1 -1
- package/dist/libs/crud-pro/models/RequestCfgModel.d.ts +1 -1
- package/dist/libs/crud-pro/models/SqlCfgModel.d.ts +1 -1
- package/dist/libs/crud-pro/services/CrudProExecuteSqlService.js +4 -4
- package/dist/libs/crud-pro/services/CrudProGenSqlCondition.js +4 -4
- package/dist/libs/crud-pro/services/CrudProGenSqlService.js +8 -8
- package/dist/libs/crud-pro/services/CrudProOriginToExecuteSql.js +2 -2
- package/dist/libs/crud-pro/utils/sqlConvert/convertColumnName.js +2 -2
- package/dist/libs/global-config/global-config.d.ts +39 -0
- package/dist/libs/global-config/global-config.js +32 -0
- package/dist/models/SystemTables.d.ts +0 -3
- package/dist/models/SystemTables.js +1 -4
- package/dist/service/AuthService.js +8 -5
- package/dist/service/EnumInfoService.js +7 -4
- package/dist/service/FileCenterService.js +13 -9
- package/dist/service/SysConfigService.js +4 -2
- package/dist/service/UserAccountService.js +10 -6
- package/dist/service/VisitStatService.js +4 -2
- package/dist/service/WorkbenchService.js +4 -2
- package/dist/service/anyapi/AnyApiService.js +4 -2
- package/dist/service/crudstd/CrudStdService.js +7 -3
- package/dist/service/curd/CurdMixByAccountService.js +12 -6
- package/dist/service/curd/CurdMixByDictService.js +4 -2
- package/dist/service/curd/CurdMixByLinkToCustomService.js +1 -1
- package/dist/service/curd/CurdMixBySysConfigService.js +4 -2
- package/dist/service/curd/CurdMixByWorkbenchService.js +4 -2
- package/dist/service/curd/CurdMixService.d.ts +1 -1
- package/dist/service/curd/CurdMixService.js +2 -2
- package/dist/service/curd/CurdMixUtils.d.ts +7 -0
- package/dist/service/curd/CurdMixUtils.js +31 -1
- package/dist/service/curd/CurdProService.d.ts +3 -3
- package/dist/service/curd/CurdProService.js +9 -9
- package/dist/service/proxyapi/ProxyApiLoadService.js +7 -4
- package/dist/views/404_app.html +31 -0
- package/dist/views/404_workbench.html +34 -0
- package/dist/views/static/favicon.ico +0 -0
- package/package.json +5 -1
- package/src/config/config.default.ts +58 -27
- package/src/controller/base/BaseApiController.ts +14 -14
- package/src/controller/gateway/CrudMtdGatewayController.ts +6 -2
- package/src/controller/gateway/DocGatewayController.ts +13 -5
- package/src/controller/gateway/StaticController.ts +50 -25
- package/src/controller/home.controller.ts +8 -10
- package/src/controller/manage/CrudStandardDesignApi.ts +145 -100
- package/src/controller/manage/DeployManageApi.ts +6 -3
- package/src/controller/manage/SuperAdminManageApi.ts +15 -6
- package/src/controller/manage/SysConfigMangeApi.ts +4 -1
- package/src/controller/manage/UserAccountManageApi.ts +6 -0
- package/src/controller/myinfo/AuthController.ts +4 -66
- package/src/controller/render/AppRenderController.ts +18 -15
- package/src/controller/test.controller.ts +1 -1
- package/src/index.ts +33 -4
- package/src/libs/crud-pro/interfaces.ts +1 -1
- package/src/libs/crud-pro/models/RequestCfgModel.ts +1 -1
- package/src/libs/crud-pro/models/SqlCfgModel.ts +1 -1
- package/src/libs/crud-pro/services/CrudProExecuteSqlService.ts +4 -4
- package/src/libs/crud-pro/services/CrudProGenSqlCondition.ts +4 -4
- package/src/libs/crud-pro/services/CrudProGenSqlService.ts +8 -8
- package/src/libs/crud-pro/services/CrudProOriginToExecuteSql.ts +2 -2
- package/src/libs/crud-pro/utils/sqlConvert/convertColumnName.ts +2 -2
- package/src/libs/global-config/global-config.ts +72 -0
- package/src/models/SystemTables.ts +0 -4
- package/src/service/AuthService.ts +13 -8
- package/src/service/EnumInfoService.ts +8 -3
- package/src/service/FileCenterService.ts +12 -6
- package/src/service/SysConfigService.ts +10 -6
- package/src/service/UserAccountService.ts +14 -4
- package/src/service/VisitStatService.ts +6 -2
- package/src/service/WorkbenchService.ts +7 -2
- package/src/service/anyapi/AnyApiService.ts +5 -2
- package/src/service/crudstd/CrudStdService.ts +13 -3
- package/src/service/curd/CurdMixByAccountService.ts +14 -6
- package/src/service/curd/CurdMixByDictService.ts +8 -2
- package/src/service/curd/CurdMixByLinkToCustomService.ts +1 -1
- package/src/service/curd/CurdMixBySysConfigService.ts +7 -2
- package/src/service/curd/CurdMixByWorkbenchService.ts +6 -2
- package/src/service/curd/CurdMixService.ts +2 -2
- package/src/service/curd/CurdMixUtils.ts +42 -12
- package/src/service/curd/CurdProService.ts +10 -10
- package/src/service/proxyapi/ProxyApiLoadService.ts +11 -3
- package/src/views/404_app.html +31 -0
- package/src/views/404_workbench.html +34 -0
- package/src/views/static/favicon.ico +0 -0
- package/dist/controller/medstatistic/MedAdminController.d.ts +0 -35
- package/dist/controller/medstatistic/MedAdminController.js +0 -205
- package/dist/controller/medstatistic/MedClientController.d.ts +0 -28
- package/dist/controller/medstatistic/MedClientController.js +0 -188
- package/dist/controller/medstatistic/MedMessageService.d.ts +0 -19
- package/dist/controller/medstatistic/MedMessageService.js +0 -95
- package/dist/controller/medstatistic/MedScoreService.d.ts +0 -21
- package/dist/controller/medstatistic/MedScoreService.js +0 -107
- package/dist/controller/medstatistic/constants.d.ts +0 -32
- package/dist/controller/medstatistic/constants.js +0 -43
- package/src/controller/medstatistic/MedAdminController.ts +0 -221
- package/src/controller/medstatistic/MedClientController.ts +0 -188
- package/src/controller/medstatistic/MedMessageService.ts +0 -89
- package/src/controller/medstatistic/MedScoreService.ts +0 -108
- package/src/controller/medstatistic/constants.ts +0 -63
package/dist/index.js
CHANGED
|
@@ -48,10 +48,6 @@ __exportStar(require("./controller/manage/SysConfigMangeApi"), exports);
|
|
|
48
48
|
__exportStar(require("./controller/manage/SystemInfoManageApi"), exports);
|
|
49
49
|
__exportStar(require("./controller/manage/UserAccountManageApi"), exports);
|
|
50
50
|
__exportStar(require("./controller/manage/WorkbenchMangeApi"), exports);
|
|
51
|
-
__exportStar(require("./controller/medstatistic/MedAdminController"), exports);
|
|
52
|
-
__exportStar(require("./controller/medstatistic/MedClientController"), exports);
|
|
53
|
-
__exportStar(require("./controller/medstatistic/MedMessageService"), exports);
|
|
54
|
-
__exportStar(require("./controller/medstatistic/MedScoreService"), exports);
|
|
55
51
|
__exportStar(require("./controller/myinfo/AuthController"), exports);
|
|
56
52
|
__exportStar(require("./controller/myinfo/MyInfoController"), exports);
|
|
57
53
|
__exportStar(require("./controller/render/AppRenderController"), exports);
|
|
@@ -61,6 +57,7 @@ __exportStar(require("./filter/notfound.filter"), exports);
|
|
|
61
57
|
__exportStar(require("./middleware/forbidden.middleware"), exports);
|
|
62
58
|
__exportStar(require("./middleware/global.middleware"), exports);
|
|
63
59
|
__exportStar(require("./middleware/tx.middleware"), exports);
|
|
60
|
+
__exportStar(require("./middleware/permission.middleware"), exports);
|
|
64
61
|
__exportStar(require("./service/AuthService"), exports);
|
|
65
62
|
__exportStar(require("./service/EnumInfoService"), exports);
|
|
66
63
|
__exportStar(require("./service/FileCenterService"), exports);
|
|
@@ -86,3 +83,30 @@ __exportStar(require("./service/curd/CurdMixService"), exports);
|
|
|
86
83
|
__exportStar(require("./service/curd/CurdProService"), exports);
|
|
87
84
|
__exportStar(require("./service/proxyapi/ProxyApiLoadService"), exports);
|
|
88
85
|
__exportStar(require("./service/proxyapi/ProxyApiService"), exports);
|
|
86
|
+
__exportStar(require("./models/userSession"), exports);
|
|
87
|
+
__exportStar(require("./models/bizmodels"), exports);
|
|
88
|
+
__exportStar(require("./models/SystemEntities"), exports);
|
|
89
|
+
__exportStar(require("./models/SystemPerm"), exports);
|
|
90
|
+
__exportStar(require("./models/contextLogger"), exports);
|
|
91
|
+
__exportStar(require("./models/devops"), exports);
|
|
92
|
+
__exportStar(require("./models/SystemTables"), exports);
|
|
93
|
+
__exportStar(require("./libs/utils/common-dto"), exports);
|
|
94
|
+
__exportStar(require("./libs/utils/crypto-utils"), exports);
|
|
95
|
+
__exportStar(require("./libs/utils/fatcms-request"), exports);
|
|
96
|
+
__exportStar(require("./libs/utils/functions"), exports);
|
|
97
|
+
__exportStar(require("./libs/utils/ordernum-utils"), exports);
|
|
98
|
+
__exportStar(require("./libs/utils/parseConfig"), exports);
|
|
99
|
+
__exportStar(require("./libs/crud-pro/CrudPro"), exports);
|
|
100
|
+
__exportStar(require("./libs/crud-pro/defaultConfigs"), exports);
|
|
101
|
+
__exportStar(require("./libs/crud-pro/exceptions"), exports);
|
|
102
|
+
__exportStar(require("./libs/crud-pro/interfaces"), exports);
|
|
103
|
+
__exportStar(require("./libs/crud-pro/models/ExecuteContext"), exports);
|
|
104
|
+
__exportStar(require("./libs/crud-pro/models/FuncContext"), exports);
|
|
105
|
+
__exportStar(require("./libs/crud-pro/models/RequestModel"), exports);
|
|
106
|
+
__exportStar(require("./libs/crud-pro/models/SqlCfgModel"), exports);
|
|
107
|
+
__exportStar(require("./libs/crud-pro/models/Transaction"), exports);
|
|
108
|
+
__exportStar(require("./libs/crud-pro/models/keys"), exports);
|
|
109
|
+
__exportStar(require("./libs/crud-pro/models/ExecuteContextFunc"), exports);
|
|
110
|
+
__exportStar(require("./libs/crud-pro/models/RequestCfgModel"), exports);
|
|
111
|
+
__exportStar(require("./libs/crud-pro/models/SqlSegArg"), exports);
|
|
112
|
+
__exportStar(require("./libs/global-config/global-config"), exports);
|
|
@@ -32,7 +32,7 @@ class CrudProExecuteSqlService extends CrudProServiceBase_1.CrudProServiceBase {
|
|
|
32
32
|
const executeSqlArgs = this.handleExecuteSqlArgsByResModel(exeCtx, sqlCfgModel.executeSqlArgs || []);
|
|
33
33
|
let sqlRes;
|
|
34
34
|
let queryRes;
|
|
35
|
-
if (sqlCfgModel.
|
|
35
|
+
if (sqlCfgModel.sqlDbType === keys_1.SqlDbType.postgres) { // import { PoolClient } from 'pg';
|
|
36
36
|
const pgClient = connection;
|
|
37
37
|
const pgSql = (0, convertPgSql_1.replaceQuestionMarks)(sqlCfgModel.executeSql);
|
|
38
38
|
this.logger.info('executeSqlCfgModel_postgres', pgSql, executeSqlArgs, sqlCfgModel.resPicker);
|
|
@@ -42,7 +42,7 @@ class CrudProExecuteSqlService extends CrudProServiceBase_1.CrudProServiceBase {
|
|
|
42
42
|
});
|
|
43
43
|
sqlRes = (0, convertPgType_1.pickAndConvertPgRows)(queryRes);
|
|
44
44
|
}
|
|
45
|
-
else if (sqlCfgModel.
|
|
45
|
+
else if (sqlCfgModel.sqlDbType === keys_1.SqlDbType.sqlserver) {
|
|
46
46
|
const mssql = (0, convertMsSql_1.replaceQuestionMarksForMssql)(sqlCfgModel.executeSql);
|
|
47
47
|
this.logger.info('executeSqlCfgModel_sqlserver', mssql, executeSqlArgs, sqlCfgModel.resPicker);
|
|
48
48
|
// SQLServer
|
|
@@ -198,13 +198,13 @@ class CrudProExecuteSqlService extends CrudProServiceBase_1.CrudProServiceBase {
|
|
|
198
198
|
}
|
|
199
199
|
// 增删改res的内容是修改结果:包括: insert\delete\update
|
|
200
200
|
if (keys_1.KeysOfSqlResPicker.UPDATE_RESULT === resPicker) {
|
|
201
|
-
if (sqlCfgModel.
|
|
201
|
+
if (sqlCfgModel.sqlDbType === keys_1.SqlDbType.postgres) {
|
|
202
202
|
return {
|
|
203
203
|
insertId: _.get(queryRes, 'rows[0].id'),
|
|
204
204
|
affectedRows: _.get(queryRes, 'rowCount')
|
|
205
205
|
};
|
|
206
206
|
}
|
|
207
|
-
if (sqlCfgModel.
|
|
207
|
+
if (sqlCfgModel.sqlDbType === keys_1.SqlDbType.sqlserver) {
|
|
208
208
|
return {
|
|
209
209
|
insertId: _.get(queryRes, 'recordset[0].id'),
|
|
210
210
|
affectedRows: _.get(queryRes, 'rowsAffected[0]')
|
|
@@ -192,28 +192,28 @@ class CrudProGenSqlCondition {
|
|
|
192
192
|
else if (equalsIgnoreCase(keys_1.KeysOfConditions.$LIKE, compare)) {
|
|
193
193
|
tmpArgList.push(value0);
|
|
194
194
|
tmpSql = `${toSqlColumnName(key)} COLLATE UTF8MB4_GENERAL_CI like concat(?, '%')`; // like前缀匹配
|
|
195
|
-
if (this.sqlCfg.
|
|
195
|
+
if (this.sqlCfg.sqlDbType === keys_1.SqlDbType.postgres) {
|
|
196
196
|
tmpSql = `${toSqlColumnName(key)} like concat(?, '%')`; // like前缀匹配
|
|
197
197
|
}
|
|
198
198
|
}
|
|
199
199
|
else if (equalsIgnoreCase(keys_1.KeysOfConditions.$NOT_LIKE, compare)) {
|
|
200
200
|
tmpArgList.push(value0);
|
|
201
201
|
tmpSql = `${toSqlColumnName(key)} COLLATE UTF8MB4_GENERAL_CI not like concat(?, '%')`;
|
|
202
|
-
if (this.sqlCfg.
|
|
202
|
+
if (this.sqlCfg.sqlDbType === keys_1.SqlDbType.postgres) {
|
|
203
203
|
tmpSql = `${toSqlColumnName(key)} not like concat(?, '%')`;
|
|
204
204
|
}
|
|
205
205
|
}
|
|
206
206
|
else if (equalsIgnoreCase(keys_1.KeysOfConditions.$LIKE_INCLUDE, compare)) {
|
|
207
207
|
tmpArgList.push(value0);
|
|
208
208
|
tmpSql = `${toSqlColumnName(key)} COLLATE UTF8MB4_GENERAL_CI like concat('%', ?, '%')`; // like包含
|
|
209
|
-
if (this.sqlCfg.
|
|
209
|
+
if (this.sqlCfg.sqlDbType === keys_1.SqlDbType.postgres) {
|
|
210
210
|
tmpSql = `${toSqlColumnName(key)} like concat('%', ?, '%')`; // like包含
|
|
211
211
|
}
|
|
212
212
|
}
|
|
213
213
|
else if (equalsIgnoreCase(keys_1.KeysOfConditions.$NOT_LIKE_INCLUDE, compare)) {
|
|
214
214
|
tmpArgList.push(value0);
|
|
215
215
|
tmpSql = `${toSqlColumnName(key)} COLLATE UTF8MB4_GENERAL_CI not like concat('%',?, '%')`; // like不包含
|
|
216
|
-
if (this.sqlCfg.
|
|
216
|
+
if (this.sqlCfg.sqlDbType === keys_1.SqlDbType.postgres) {
|
|
217
217
|
tmpSql = `${toSqlColumnName(key)} not like concat('%',?, '%')`; // like不包含
|
|
218
218
|
}
|
|
219
219
|
}
|
|
@@ -91,10 +91,10 @@ class CrudProGenSqlService extends CrudProServiceBase_1.CrudProServiceBase {
|
|
|
91
91
|
* @private
|
|
92
92
|
*/
|
|
93
93
|
generateOriginSqlForDelete(cfgModel) {
|
|
94
|
-
if (cfgModel.
|
|
94
|
+
if (cfgModel.sqlDbType === keys_1.SqlDbType.postgres) {
|
|
95
95
|
return 'delete from @@table where @@asWhere:condition ';
|
|
96
96
|
}
|
|
97
|
-
if (cfgModel.
|
|
97
|
+
if (cfgModel.sqlDbType === keys_1.SqlDbType.sqlserver) {
|
|
98
98
|
return 'delete from @@table where @@asWhere:condition ';
|
|
99
99
|
}
|
|
100
100
|
return 'delete from @@table where @@asWhere:condition limit 100 '; // 删除操作,不能一次性删除太多
|
|
@@ -105,7 +105,7 @@ class CrudProGenSqlService extends CrudProServiceBase_1.CrudProServiceBase {
|
|
|
105
105
|
* @private
|
|
106
106
|
*/
|
|
107
107
|
generateOriginSqlForDuplicateInsert(cfgModel) {
|
|
108
|
-
if (cfgModel.
|
|
108
|
+
if (cfgModel.sqlDbType === keys_1.SqlDbType.postgres) {
|
|
109
109
|
const uniqueColumn = cfgModel.uniqueColumn; // id
|
|
110
110
|
if (!Array.isArray(uniqueColumn) || uniqueColumn.length === 0) {
|
|
111
111
|
throw new exceptions_1.CommonException(exceptions_1.Exceptions.CFG_ERROR_POSTGRES_UNIQUE_COLUMNS_NULL);
|
|
@@ -115,7 +115,7 @@ class CrudProGenSqlService extends CrudProServiceBase_1.CrudProServiceBase {
|
|
|
115
115
|
}).join(",");
|
|
116
116
|
return `insert into @@table ( @@asInsertKeys:data ) values( @@asInsertValues:data ) ON CONFLICT (${unique_column}) DO UPDATE set @@asUpdate:data `; // 关键字的前后,必须有空格
|
|
117
117
|
}
|
|
118
|
-
if (cfgModel.
|
|
118
|
+
if (cfgModel.sqlDbType === keys_1.SqlDbType.sqlserver) {
|
|
119
119
|
const uniqueColumn = cfgModel.uniqueColumn; // id
|
|
120
120
|
if (uniqueColumn.length !== 1) {
|
|
121
121
|
throw new exceptions_1.CommonException(exceptions_1.Exceptions.CFG_UNIQUE_COLUMN_COUNT_MUST_ONE);
|
|
@@ -144,10 +144,10 @@ class CrudProGenSqlService extends CrudProServiceBase_1.CrudProServiceBase {
|
|
|
144
144
|
* @private
|
|
145
145
|
*/
|
|
146
146
|
generateOriginSqlForInsert(cfgModel) {
|
|
147
|
-
if (cfgModel.
|
|
147
|
+
if (cfgModel.sqlDbType === keys_1.SqlDbType.postgres) {
|
|
148
148
|
return 'insert into @@table ( @@asInsertKeys:data ) values( @@asInsertValues:data ) RETURNING * ';
|
|
149
149
|
}
|
|
150
|
-
if (cfgModel.
|
|
150
|
+
if (cfgModel.sqlDbType === keys_1.SqlDbType.sqlserver) {
|
|
151
151
|
return 'insert into @@table ( @@asInsertKeys:data ) OUTPUT INSERTED.* values( @@asInsertValues:data ) ';
|
|
152
152
|
}
|
|
153
153
|
return 'insert into @@table ( @@asInsertKeys:data ) values( @@asInsertValues:data )'; // 关键字的前后,必须有空格
|
|
@@ -156,10 +156,10 @@ class CrudProGenSqlService extends CrudProServiceBase_1.CrudProServiceBase {
|
|
|
156
156
|
const exeCtx = this.getExecuteContext();
|
|
157
157
|
const reqCfgModel = exeCtx.getCfgModel();
|
|
158
158
|
const sqlCfgList = reqCfgModel.sqlCfgList || [];
|
|
159
|
-
const { sqlTable, sqlSchema, sqlDatabase,
|
|
159
|
+
const { sqlTable, sqlSchema, sqlDatabase, sqlDbType, maxLimit, columns, columnsRelation } = reqCfgModel;
|
|
160
160
|
for (let i = 0; i < sqlCfgList.length; i++) {
|
|
161
161
|
const sqlCfgModel = sqlCfgList[i];
|
|
162
|
-
sqlCfgModel.
|
|
162
|
+
sqlCfgModel.sqlDbType = MixinUtils_1.MixinUtils.selectNotEmpty(sqlCfgModel.sqlDbType, sqlDbType);
|
|
163
163
|
sqlCfgModel.sqlDatabase = MixinUtils_1.MixinUtils.selectNotEmpty(sqlCfgModel.sqlDatabase, sqlDatabase);
|
|
164
164
|
sqlCfgModel.sqlSchema = MixinUtils_1.MixinUtils.selectNotEmpty(sqlCfgModel.sqlSchema, sqlSchema);
|
|
165
165
|
sqlCfgModel.sqlTable = MixinUtils_1.MixinUtils.selectNotEmpty(sqlCfgModel.sqlTable, sqlTable);
|
|
@@ -198,10 +198,10 @@ class CrudProOriginToExecuteSql extends CrudProServiceBase_1.CrudProServiceBase
|
|
|
198
198
|
const maxLimit = ModelUtils_1.ModelUtils.getMaxLimit(sqlCfg, requestCfg);
|
|
199
199
|
const reqLimit = req.limit;
|
|
200
200
|
const limit = Math.min(maxLimit, reqLimit);
|
|
201
|
-
if (sqlCfg.
|
|
201
|
+
if (sqlCfg.sqlDbType === keys_1.SqlDbType.postgres) {
|
|
202
202
|
return new SqlSegArg_1.SqlSegArg(' LIMIT ? OFFSET ? ', [limit, req.offset]);
|
|
203
203
|
}
|
|
204
|
-
if (sqlCfg.
|
|
204
|
+
if (sqlCfg.sqlDbType === keys_1.SqlDbType.sqlserver) {
|
|
205
205
|
return new SqlSegArg_1.SqlSegArg(' OFFSET ? ROWS FETCH NEXT ? ROWS ONLY ', [req.offset, limit]);
|
|
206
206
|
}
|
|
207
207
|
return new SqlSegArg_1.SqlSegArg(' limit ?,? ', [req.offset, limit]);
|
|
@@ -3,10 +3,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.toSqlColumnNamesJoin = exports.toSqlColumnName = void 0;
|
|
4
4
|
const keys_1 = require("../../models/keys");
|
|
5
5
|
function toSqlColumnName(columnName, sqlCfgModel) {
|
|
6
|
-
if (sqlCfgModel.
|
|
6
|
+
if (sqlCfgModel.sqlDbType === keys_1.SqlDbType.postgres) {
|
|
7
7
|
return '"' + columnName + '"';
|
|
8
8
|
}
|
|
9
|
-
if (sqlCfgModel.
|
|
9
|
+
if (sqlCfgModel.sqlDbType === keys_1.SqlDbType.sqlserver) {
|
|
10
10
|
return '[' + columnName + ']';
|
|
11
11
|
}
|
|
12
12
|
return '`' + columnName + '`';
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { SqlDbType } from '../crud-pro/models/keys';
|
|
2
|
+
interface IGlobalStaticConfig {
|
|
3
|
+
/**
|
|
4
|
+
* CrudStd: 业务系统自定义的修改cfgModel
|
|
5
|
+
* @param reqJson
|
|
6
|
+
* @param cfgModel
|
|
7
|
+
* @param appInfo
|
|
8
|
+
* @param ctx
|
|
9
|
+
*/
|
|
10
|
+
bizUpdateCfgModelForCrudStd(reqJson: any, cfgModel: any, appInfo: any, ctx: any): Promise<any>;
|
|
11
|
+
/**
|
|
12
|
+
* CrudMtd: 业务系统自定义的修改cfgModel
|
|
13
|
+
* @param reqJson
|
|
14
|
+
* @param cfgModel
|
|
15
|
+
* @param methodInfo
|
|
16
|
+
* @param ctx
|
|
17
|
+
*/
|
|
18
|
+
bizUpdateCfgModelForCrudMtd(reqJson: any, cfgModel: any, methodInfo: any, ctx: any): Promise<any>;
|
|
19
|
+
/**
|
|
20
|
+
* 生成用户的账号ID,业务系统可以生成类似工号的ID
|
|
21
|
+
* @param userSubmitData
|
|
22
|
+
*/
|
|
23
|
+
generateUserAccountId(userSubmitData: any): Promise<string>;
|
|
24
|
+
/**
|
|
25
|
+
* 将业务系统表中的userId映射为fatcms的UserAccountId
|
|
26
|
+
* @param bizTableUserId 业余系统表中的UserId
|
|
27
|
+
*/
|
|
28
|
+
toFatcmsUserAccountId(bizTableUserId: any): string;
|
|
29
|
+
SystemDbName: string;
|
|
30
|
+
SystemDbType: SqlDbType;
|
|
31
|
+
}
|
|
32
|
+
declare class GlobalStaticConfig {
|
|
33
|
+
private configObject;
|
|
34
|
+
constructor();
|
|
35
|
+
getConfig(): IGlobalStaticConfig;
|
|
36
|
+
setConfig(configObject: any): void;
|
|
37
|
+
}
|
|
38
|
+
declare const GLOBAL_STATIC_CONFIG: GlobalStaticConfig;
|
|
39
|
+
export { GLOBAL_STATIC_CONFIG };
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.GLOBAL_STATIC_CONFIG = void 0;
|
|
4
|
+
const keys_1 = require("../crud-pro/models/keys");
|
|
5
|
+
const noop = () => {
|
|
6
|
+
return Promise.resolve();
|
|
7
|
+
};
|
|
8
|
+
class GlobalStaticConfig {
|
|
9
|
+
constructor() {
|
|
10
|
+
this.configObject = {
|
|
11
|
+
bizUpdateCfgModelForCrudStd: noop,
|
|
12
|
+
bizUpdateCfgModelForCrudMtd: noop,
|
|
13
|
+
generateUserAccountId: null,
|
|
14
|
+
toFatcmsUserAccountId: (bizTableUserId) => {
|
|
15
|
+
return bizTableUserId;
|
|
16
|
+
},
|
|
17
|
+
SystemDbName: 'fatcms',
|
|
18
|
+
SystemDbType: keys_1.SqlDbType.mysql,
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
getConfig() {
|
|
22
|
+
return this.configObject;
|
|
23
|
+
}
|
|
24
|
+
setConfig(configObject) {
|
|
25
|
+
if (!configObject || typeof configObject !== 'object') {
|
|
26
|
+
throw new Error('参数configObject不能为空');
|
|
27
|
+
}
|
|
28
|
+
Object.assign(this.configObject, configObject);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
const GLOBAL_STATIC_CONFIG = new GlobalStaticConfig();
|
|
32
|
+
exports.GLOBAL_STATIC_CONFIG = GLOBAL_STATIC_CONFIG;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { SqlDbType } from "../libs/crud-pro/models/keys";
|
|
2
1
|
export declare const SystemTables: {
|
|
3
2
|
sys_workbench: string;
|
|
4
3
|
sys_user_account: string;
|
|
@@ -22,6 +21,4 @@ export declare const SystemTables: {
|
|
|
22
21
|
sys_proxyapi: string;
|
|
23
22
|
sys_visit_stats: string;
|
|
24
23
|
};
|
|
25
|
-
export declare const SystemDbName = "fatcms";
|
|
26
|
-
export declare const SystemDbType = SqlDbType.mysql;
|
|
27
24
|
export declare const SystemDevOpsWorkbench = "devops";
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.SystemDevOpsWorkbench = exports.
|
|
4
|
-
const keys_1 = require("../libs/crud-pro/models/keys");
|
|
3
|
+
exports.SystemDevOpsWorkbench = exports.SystemTables = void 0;
|
|
5
4
|
exports.SystemTables = {
|
|
6
5
|
sys_workbench: 'sys_workbench',
|
|
7
6
|
sys_user_account: 'sys_user_account',
|
|
@@ -25,6 +24,4 @@ exports.SystemTables = {
|
|
|
25
24
|
sys_proxyapi: 'sys_proxyapi',
|
|
26
25
|
sys_visit_stats: 'sys_visit_stats',
|
|
27
26
|
};
|
|
28
|
-
exports.SystemDbName = 'fatcms';
|
|
29
|
-
exports.SystemDbType = keys_1.SqlDbType.mysql;
|
|
30
27
|
exports.SystemDevOpsWorkbench = 'devops';
|
|
@@ -22,6 +22,7 @@ const UserSessionService_1 = require("./UserSessionService");
|
|
|
22
22
|
const common_dto_1 = require("../libs/utils/common-dto");
|
|
23
23
|
const fatcms_request_1 = require("../libs/utils/fatcms-request");
|
|
24
24
|
const exceptions_1 = require("../libs/crud-pro/exceptions");
|
|
25
|
+
const global_config_1 = require("../libs/global-config/global-config");
|
|
25
26
|
let AuthService = class AuthService {
|
|
26
27
|
/**
|
|
27
28
|
* 明文密码转unsaltedPwd密码
|
|
@@ -116,7 +117,7 @@ let AuthService = class AuthService {
|
|
|
116
117
|
sessionId,
|
|
117
118
|
accountId,
|
|
118
119
|
workbenchCode,
|
|
119
|
-
accountType: userSession_1.SYS_ACCOUNT_TYPE
|
|
120
|
+
accountType: userSession_1.SYS_ACCOUNT_TYPE,
|
|
120
121
|
};
|
|
121
122
|
await this.userSessionService.saveUserSession(sessionInfo);
|
|
122
123
|
return {
|
|
@@ -171,14 +172,15 @@ let AuthService = class AuthService {
|
|
|
171
172
|
* @private
|
|
172
173
|
*/
|
|
173
174
|
async queryUserRoleCodeList(accountId) {
|
|
175
|
+
const { SystemDbName, SystemDbType } = global_config_1.GLOBAL_STATIC_CONFIG.getConfig();
|
|
174
176
|
const res = await this.curdMixService.executeCrudByCfg({
|
|
175
177
|
condition: { account_id: accountId },
|
|
176
178
|
limit: 10000,
|
|
177
179
|
}, {
|
|
178
180
|
sqlTable: SystemTables_1.SystemTables.sys_perm_user_role,
|
|
179
181
|
sqlSimpleName: keys_1.KeysOfSimpleSQL.SIMPLE_QUERY,
|
|
180
|
-
sqlDatabase:
|
|
181
|
-
|
|
182
|
+
sqlDatabase: SystemDbName,
|
|
183
|
+
sqlDbType: SystemDbType,
|
|
182
184
|
});
|
|
183
185
|
const rows = res.getResModel().rows || [];
|
|
184
186
|
const roleCodes = rows.map(({ role_code }) => {
|
|
@@ -195,14 +197,15 @@ let AuthService = class AuthService {
|
|
|
195
197
|
if (!roleCodeList || roleCodeList.length === 0) {
|
|
196
198
|
return [];
|
|
197
199
|
}
|
|
200
|
+
const { SystemDbName, SystemDbType } = global_config_1.GLOBAL_STATIC_CONFIG.getConfig();
|
|
198
201
|
const res = await this.curdMixService.executeCrudByCfg({
|
|
199
202
|
condition: { role_code: { $in: roleCodeList } },
|
|
200
203
|
limit: 10000,
|
|
201
204
|
}, {
|
|
202
205
|
sqlTable: SystemTables_1.SystemTables.sys_perm_role_func,
|
|
203
206
|
sqlSimpleName: keys_1.KeysOfSimpleSQL.SIMPLE_QUERY,
|
|
204
|
-
sqlDatabase:
|
|
205
|
-
|
|
207
|
+
sqlDatabase: SystemDbName,
|
|
208
|
+
sqlDbType: SystemDbType,
|
|
206
209
|
});
|
|
207
210
|
const rows = res.getResModel().rows || [];
|
|
208
211
|
const funcCodes = rows.map(({ func_code }) => {
|
|
@@ -18,6 +18,7 @@ const SystemTables_1 = require("../models/SystemTables");
|
|
|
18
18
|
const parseConfig_1 = require("../libs/utils/parseConfig");
|
|
19
19
|
const RedisCacheService_1 = require("./base/RedisCacheService");
|
|
20
20
|
const CurdMixByLinkToCustomService_1 = require("./curd/CurdMixByLinkToCustomService");
|
|
21
|
+
const global_config_1 = require("../libs/global-config/global-config");
|
|
21
22
|
function filterEmpty(e) {
|
|
22
23
|
return e.label && typeof e.value !== 'undefined';
|
|
23
24
|
}
|
|
@@ -70,13 +71,14 @@ let EnumInfoService = class EnumInfoService {
|
|
|
70
71
|
});
|
|
71
72
|
}
|
|
72
73
|
async queryEnumInfoBySysCfgEnum(code) {
|
|
74
|
+
const { SystemDbName, SystemDbType } = global_config_1.GLOBAL_STATIC_CONFIG.getConfig();
|
|
73
75
|
const res1 = await this.curdProService.executeCrudByCfg({
|
|
74
76
|
condition: { config_code: code },
|
|
75
77
|
}, {
|
|
76
78
|
sqlTable: SystemTables_1.SystemTables.sys_configs,
|
|
77
79
|
sqlSimpleName: keys_1.KeysOfSimpleSQL.SIMPLE_QUERY_ONE,
|
|
78
|
-
sqlDatabase:
|
|
79
|
-
|
|
80
|
+
sqlDatabase: SystemDbName,
|
|
81
|
+
sqlDbType: SystemDbType,
|
|
80
82
|
});
|
|
81
83
|
const obj = res1.getOneObj();
|
|
82
84
|
if (!obj) {
|
|
@@ -86,13 +88,14 @@ let EnumInfoService = class EnumInfoService {
|
|
|
86
88
|
return rows.map(e => ({ label: e.label, value: e.value, children: e.children })).filter(filterEmpty);
|
|
87
89
|
}
|
|
88
90
|
async queryEnumInfoItemByDict(code) {
|
|
91
|
+
const { SystemDbName, SystemDbType } = global_config_1.GLOBAL_STATIC_CONFIG.getConfig();
|
|
89
92
|
const res1 = await this.curdProService.executeCrudByCfg({
|
|
90
93
|
condition: { dict_code: code },
|
|
91
94
|
}, {
|
|
92
95
|
sqlTable: SystemTables_1.SystemTables.sys_data_dict_item,
|
|
93
96
|
sqlSimpleName: keys_1.KeysOfSimpleSQL.SIMPLE_QUERY,
|
|
94
|
-
sqlDatabase:
|
|
95
|
-
|
|
97
|
+
sqlDatabase: SystemDbName,
|
|
98
|
+
sqlDbType: SystemDbType,
|
|
96
99
|
});
|
|
97
100
|
const obj = res1.getResRows();
|
|
98
101
|
if (!obj) {
|
|
@@ -20,7 +20,7 @@ const CurdMixService_1 = require("./curd/CurdMixService");
|
|
|
20
20
|
const keys_1 = require("../libs/crud-pro/models/keys");
|
|
21
21
|
const bizmodels_1 = require("../models/bizmodels");
|
|
22
22
|
const BaseService_1 = require("./base/BaseService");
|
|
23
|
-
const
|
|
23
|
+
const global_config_1 = require("../libs/global-config/global-config");
|
|
24
24
|
function getSuffix(s) {
|
|
25
25
|
if (s) {
|
|
26
26
|
const indexOf = s.lastIndexOf('.');
|
|
@@ -93,12 +93,13 @@ class FileDB {
|
|
|
93
93
|
this.curdMixService = curdMixService;
|
|
94
94
|
}
|
|
95
95
|
async getFileInfo(fileKey) {
|
|
96
|
+
const { SystemDbName, SystemDbType } = global_config_1.GLOBAL_STATIC_CONFIG.getConfig();
|
|
96
97
|
const condition = { file_key: fileKey };
|
|
97
98
|
const cfgModel = {
|
|
98
99
|
sqlTable: 'sys_file',
|
|
99
100
|
sqlSimpleName: keys_1.KeysOfSimpleSQL.SIMPLE_QUERY_ONE,
|
|
100
|
-
sqlDatabase:
|
|
101
|
-
|
|
101
|
+
sqlDatabase: SystemDbName,
|
|
102
|
+
sqlDbType: SystemDbType,
|
|
102
103
|
validateCfg: {
|
|
103
104
|
'condition.file_key': [keys_1.KeysOfValidators.REQUIRED, keys_1.KeysOfValidators.STRING],
|
|
104
105
|
},
|
|
@@ -107,11 +108,12 @@ class FileDB {
|
|
|
107
108
|
return res.getOneObj();
|
|
108
109
|
}
|
|
109
110
|
async saveFileInfo(fileInfo) {
|
|
111
|
+
const { SystemDbName, SystemDbType } = global_config_1.GLOBAL_STATIC_CONFIG.getConfig();
|
|
110
112
|
const cfgModel = {
|
|
111
113
|
sqlTable: 'sys_file',
|
|
112
114
|
sqlSimpleName: keys_1.KeysOfSimpleSQL.SIMPLE_INSERT,
|
|
113
|
-
sqlDatabase:
|
|
114
|
-
|
|
115
|
+
sqlDatabase: SystemDbName,
|
|
116
|
+
sqlDbType: SystemDbType,
|
|
115
117
|
};
|
|
116
118
|
return await this.curdMixService.executeCrudByCfg({
|
|
117
119
|
data: fileInfo,
|
|
@@ -121,20 +123,22 @@ class FileDB {
|
|
|
121
123
|
}, cfgModel);
|
|
122
124
|
}
|
|
123
125
|
async saveAssetsLog(fileInfo) {
|
|
126
|
+
const { SystemDbName, SystemDbType } = global_config_1.GLOBAL_STATIC_CONFIG.getConfig();
|
|
124
127
|
const cfgModel = {
|
|
125
128
|
sqlTable: 'sys_assets_log',
|
|
126
129
|
sqlSimpleName: keys_1.KeysOfSimpleSQL.SIMPLE_INSERT,
|
|
127
|
-
sqlDatabase:
|
|
128
|
-
|
|
130
|
+
sqlDatabase: SystemDbName,
|
|
131
|
+
sqlDbType: SystemDbType,
|
|
129
132
|
};
|
|
130
133
|
return await this.curdMixService.executeCrudByCfg({ data: fileInfo }, cfgModel);
|
|
131
134
|
}
|
|
132
135
|
async deleteFileInfo(id) {
|
|
136
|
+
const { SystemDbName, SystemDbType } = global_config_1.GLOBAL_STATIC_CONFIG.getConfig();
|
|
133
137
|
const cfgModel = {
|
|
134
138
|
sqlTable: 'sys_file',
|
|
135
139
|
sqlSimpleName: keys_1.KeysOfSimpleSQL.SIMPLE_DELETE,
|
|
136
|
-
sqlDatabase:
|
|
137
|
-
|
|
140
|
+
sqlDatabase: SystemDbName,
|
|
141
|
+
sqlDbType: SystemDbType,
|
|
138
142
|
validateCfg: {
|
|
139
143
|
'condition.id': [keys_1.KeysOfValidators.REQUIRED, keys_1.KeysOfValidators.NUMBER],
|
|
140
144
|
},
|
|
@@ -15,18 +15,20 @@ const keys_1 = require("../libs/crud-pro/models/keys");
|
|
|
15
15
|
const SystemTables_1 = require("../models/SystemTables");
|
|
16
16
|
const BaseService_1 = require("./base/BaseService");
|
|
17
17
|
const CurdProService_1 = require("./curd/CurdProService");
|
|
18
|
+
const global_config_1 = require("../libs/global-config/global-config");
|
|
18
19
|
let SysConfigService = class SysConfigService extends BaseService_1.BaseService {
|
|
19
20
|
async getSysConfigOne(config_code) {
|
|
20
21
|
if (!config_code) {
|
|
21
22
|
throw new Error('[getSysConfigOne] config_code required');
|
|
22
23
|
}
|
|
24
|
+
const { SystemDbName, SystemDbType } = global_config_1.GLOBAL_STATIC_CONFIG.getConfig();
|
|
23
25
|
const res1 = await this.curdProService.executeCrudByCfg({
|
|
24
26
|
condition: { config_code },
|
|
25
27
|
}, {
|
|
26
28
|
sqlTable: SystemTables_1.SystemTables.sys_configs,
|
|
27
29
|
sqlSimpleName: keys_1.KeysOfSimpleSQL.SIMPLE_QUERY_ONE,
|
|
28
|
-
sqlDatabase:
|
|
29
|
-
|
|
30
|
+
sqlDatabase: SystemDbName,
|
|
31
|
+
sqlDbType: SystemDbType,
|
|
30
32
|
});
|
|
31
33
|
return res1.getOneObj();
|
|
32
34
|
}
|
|
@@ -18,20 +18,22 @@ const functions_1 = require("../libs/utils/functions");
|
|
|
18
18
|
const exceptions_1 = require("../libs/crud-pro/exceptions");
|
|
19
19
|
const SystemTables_1 = require("../models/SystemTables");
|
|
20
20
|
const common_dto_1 = require("../libs/utils/common-dto");
|
|
21
|
+
const global_config_1 = require("../libs/global-config/global-config");
|
|
21
22
|
let UserAccountService = class UserAccountService {
|
|
22
23
|
/**
|
|
23
24
|
* 查询用户: 根据loginName查询
|
|
24
25
|
* @param loginName
|
|
25
26
|
*/
|
|
26
27
|
async queryUserAccountByLoginName(loginName) {
|
|
28
|
+
const { SystemDbName, SystemDbType } = global_config_1.GLOBAL_STATIC_CONFIG.getConfig();
|
|
27
29
|
const query = await this.curdMixService.executeCrudByCfg({
|
|
28
30
|
condition: { login_name: loginName },
|
|
29
31
|
}, {
|
|
30
32
|
method: 'UserAccountService.queryUserAccountByLoginName',
|
|
31
33
|
sqlTable: SystemTables_1.SystemTables.sys_user_account,
|
|
32
34
|
sqlSimpleName: keys_1.KeysOfSimpleSQL.SIMPLE_QUERY_ONE,
|
|
33
|
-
sqlDatabase:
|
|
34
|
-
|
|
35
|
+
sqlDatabase: SystemDbName,
|
|
36
|
+
sqlDbType: SystemDbType,
|
|
35
37
|
});
|
|
36
38
|
const { row } = query.getResModel();
|
|
37
39
|
return row;
|
|
@@ -45,6 +47,7 @@ let UserAccountService = class UserAccountService {
|
|
|
45
47
|
if (!accountIdList || accountIdList.length === 0) {
|
|
46
48
|
return [];
|
|
47
49
|
}
|
|
50
|
+
const { SystemDbName, SystemDbType } = global_config_1.GLOBAL_STATIC_CONFIG.getConfig();
|
|
48
51
|
const accountIds = accountIdList.map(userId => {
|
|
49
52
|
return `${userId}`;
|
|
50
53
|
});
|
|
@@ -52,8 +55,8 @@ let UserAccountService = class UserAccountService {
|
|
|
52
55
|
method: 'UserAccountService.queryAccountBasicInfoByIds',
|
|
53
56
|
sqlTable: SystemTables_1.SystemTables.sys_user_account,
|
|
54
57
|
sqlSimpleName: keys_1.KeysOfSimpleSQL.SIMPLE_QUERY,
|
|
55
|
-
sqlDatabase:
|
|
56
|
-
|
|
58
|
+
sqlDatabase: SystemDbName,
|
|
59
|
+
sqlDbType: SystemDbType,
|
|
57
60
|
};
|
|
58
61
|
const reqJson = {
|
|
59
62
|
columns: columns,
|
|
@@ -75,6 +78,7 @@ let UserAccountService = class UserAccountService {
|
|
|
75
78
|
if (!loginName) {
|
|
76
79
|
throw new exceptions_1.CommonException(exceptions_1.Exceptions.OTHER_EXCEPTION, 'loginName不存在');
|
|
77
80
|
}
|
|
81
|
+
const { SystemDbName, SystemDbType } = global_config_1.GLOBAL_STATIC_CONFIG.getConfig();
|
|
78
82
|
const pwd_salt = (0, functions_1.createUniqueId)();
|
|
79
83
|
const pwd_md5 = md5(unsaltedPwd + pwd_salt);
|
|
80
84
|
const res1 = await this.curdMixService.executeCrudByCfg({
|
|
@@ -83,8 +87,8 @@ let UserAccountService = class UserAccountService {
|
|
|
83
87
|
}, {
|
|
84
88
|
sqlTable: SystemTables_1.SystemTables.sys_user_account,
|
|
85
89
|
sqlSimpleName: keys_1.KeysOfSimpleSQL.SIMPLE_UPDATE,
|
|
86
|
-
sqlDatabase:
|
|
87
|
-
|
|
90
|
+
sqlDatabase: SystemDbName,
|
|
91
|
+
sqlDbType: SystemDbType,
|
|
88
92
|
});
|
|
89
93
|
return common_dto_1.CommonResult.successRes(res1.getResModel());
|
|
90
94
|
}
|
|
@@ -17,6 +17,7 @@ const SystemTables_1 = require("../models/SystemTables");
|
|
|
17
17
|
const keys_1 = require("../libs/crud-pro/models/keys");
|
|
18
18
|
const bizmodels_1 = require("../models/bizmodels");
|
|
19
19
|
const common_dto_1 = require("../libs/utils/common-dto");
|
|
20
|
+
const global_config_1 = require("../libs/global-config/global-config");
|
|
20
21
|
// 3天 的秒数
|
|
21
22
|
const EXPIRE_TIME = 3 * 24 * 60 * 60;
|
|
22
23
|
const STAT_TYPES = {
|
|
@@ -31,6 +32,7 @@ let VisitStatService = class VisitStatService extends BaseService_1.BaseService
|
|
|
31
32
|
return this.flushVisitStatToDB();
|
|
32
33
|
}
|
|
33
34
|
async flushVisitStatToDB() {
|
|
35
|
+
const { SystemDbName, SystemDbType } = global_config_1.GLOBAL_STATIC_CONFIG.getConfig();
|
|
34
36
|
// 统计昨天的数据。
|
|
35
37
|
const stat_date = new Date(Date.now() - 24 * 3600 * 1000).toISOString().split('T')[0];
|
|
36
38
|
const lockKey = `vs_lock_${stat_date}`;
|
|
@@ -74,8 +76,8 @@ let VisitStatService = class VisitStatService extends BaseService_1.BaseService
|
|
|
74
76
|
}
|
|
75
77
|
}, {
|
|
76
78
|
sqlSimpleName: keys_1.KeysOfSimpleSQL.SIMPLE_INSERT,
|
|
77
|
-
sqlDatabase:
|
|
78
|
-
|
|
79
|
+
sqlDatabase: SystemDbName,
|
|
80
|
+
sqlDbType: SystemDbType,
|
|
79
81
|
sqlTable: SystemTables_1.SystemTables.sys_visit_stats,
|
|
80
82
|
});
|
|
81
83
|
await client.del(key);
|
|
@@ -20,6 +20,7 @@ const exceptions_1 = require("../libs/crud-pro/exceptions");
|
|
|
20
20
|
const functions_1 = require("../libs/utils/functions");
|
|
21
21
|
const fatcms_request_1 = require("../libs/utils/fatcms-request");
|
|
22
22
|
const MixinUtils_1 = require("../libs/crud-pro/utils/MixinUtils");
|
|
23
|
+
const global_config_1 = require("../libs/global-config/global-config");
|
|
23
24
|
//
|
|
24
25
|
// const lruCache = new LRUCache<string, any>({
|
|
25
26
|
// max: 500,
|
|
@@ -38,14 +39,15 @@ let WorkbenchService = class WorkbenchService extends BaseService_1.BaseService
|
|
|
38
39
|
await this.getAllWorkbenchInfoMap(true);
|
|
39
40
|
}
|
|
40
41
|
async getAllWorkbenchInfoList(isForceRefresh) {
|
|
42
|
+
const { SystemDbName, SystemDbType } = global_config_1.GLOBAL_STATIC_CONFIG.getConfig();
|
|
41
43
|
let listData = lruCache.get(CACHE_KEY_WORKBENCH_LIST);
|
|
42
44
|
if (!listData || isForceRefresh === true) {
|
|
43
45
|
const reqJson = { condition: {}, pageSize: 1000, limit: 1000 };
|
|
44
46
|
const res = await this.curdProService.executeCrudByCfg(reqJson, {
|
|
45
47
|
sqlTable: SystemTables_1.SystemTables.sys_workbench,
|
|
46
48
|
sqlSimpleName: keys_1.KeysOfSimpleSQL.SIMPLE_QUERY,
|
|
47
|
-
sqlDatabase:
|
|
48
|
-
|
|
49
|
+
sqlDatabase: SystemDbName,
|
|
50
|
+
sqlDbType: SystemDbType,
|
|
49
51
|
});
|
|
50
52
|
listData = res.getResRows();
|
|
51
53
|
lruCache.set(CACHE_KEY_WORKBENCH_LIST, listData);
|