midway-fatcms 0.0.1-beta.2 → 0.0.1-beta.20

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.
Files changed (246) hide show
  1. package/.eslintrc.json +12 -0
  2. package/.prettierrc.js +4 -0
  3. package/README.md +7 -0
  4. package/dist/config/config.default.js +52 -15
  5. package/dist/configuration.d.ts +1 -0
  6. package/dist/configuration.js +33 -8
  7. package/dist/controller/base/BaseApiController.d.ts +1 -1
  8. package/dist/controller/base/BaseApiController.js +9 -6
  9. package/dist/controller/gateway/AsyncTaskController.d.ts +14 -0
  10. package/dist/controller/gateway/AsyncTaskController.js +108 -0
  11. package/dist/controller/gateway/CrudMtdGatewayController.d.ts +3 -3
  12. package/dist/controller/gateway/CrudMtdGatewayController.js +9 -6
  13. package/dist/controller/gateway/DocGatewayController.js +14 -9
  14. package/dist/controller/gateway/PublicApiController.js +4 -6
  15. package/dist/controller/gateway/StaticController.d.ts +2 -0
  16. package/dist/controller/gateway/StaticController.js +59 -40
  17. package/dist/controller/helpers.controller.d.ts +1 -1
  18. package/dist/controller/home.controller.js +2 -2
  19. package/dist/controller/manage/CrudStandardDesignApi.d.ts +1 -1
  20. package/dist/controller/manage/CrudStandardDesignApi.js +78 -75
  21. package/dist/controller/manage/DataDictManageApi.d.ts +1 -1
  22. package/dist/controller/manage/DeployManageApi.d.ts +1 -1
  23. package/dist/controller/manage/DeployManageApi.js +38 -34
  24. package/dist/controller/manage/MenuManageApi.js +1 -1
  25. package/dist/controller/manage/SuperAdminManageApi.d.ts +2 -2
  26. package/dist/controller/manage/SuperAdminManageApi.js +12 -8
  27. package/dist/controller/manage/SysConfigMangeApi.d.ts +1 -1
  28. package/dist/controller/manage/SysConfigMangeApi.js +6 -4
  29. package/dist/controller/manage/SystemInfoManageApi.d.ts +1 -1
  30. package/dist/controller/manage/SystemInfoManageApi.js +7 -1
  31. package/dist/controller/manage/UserAccountManageApi.d.ts +2 -2
  32. package/dist/controller/manage/UserAccountManageApi.js +5 -0
  33. package/dist/controller/manage/WorkbenchMangeApi.js +1 -1
  34. package/dist/controller/myinfo/AuthController.d.ts +0 -4
  35. package/dist/controller/myinfo/AuthController.js +1 -54
  36. package/dist/controller/render/AppRenderController.js +10 -4
  37. package/dist/controller/test.controller.d.ts +1 -1
  38. package/dist/controller/test.controller.js +5 -5
  39. package/dist/index.d.ts +34 -4
  40. package/dist/index.js +34 -4
  41. package/dist/libs/crud-pro/CrudPro.d.ts +1 -0
  42. package/dist/libs/crud-pro/CrudPro.js +5 -0
  43. package/dist/libs/crud-pro/defaultConfigs.js +2 -0
  44. package/dist/libs/crud-pro/interfaces.d.ts +7 -1
  45. package/dist/libs/crud-pro/models/ExecuteContext.d.ts +2 -1
  46. package/dist/libs/crud-pro/models/ExecuteContextFunc.d.ts +8 -1
  47. package/dist/libs/crud-pro/models/ExecuteContextFunc.js +8 -0
  48. package/dist/libs/crud-pro/models/RequestCfgModel.d.ts +1 -1
  49. package/dist/libs/crud-pro/models/ResModel.d.ts +16 -0
  50. package/dist/libs/crud-pro/models/ResModel.js +2 -0
  51. package/dist/libs/crud-pro/models/SqlCfgModel.d.ts +1 -1
  52. package/dist/libs/crud-pro/models/TransactionSqlServer.js +1 -1
  53. package/dist/libs/crud-pro/services/CrudProCachedCfgService.d.ts +1 -0
  54. package/dist/libs/crud-pro/services/CrudProCachedCfgService.js +22 -11
  55. package/dist/libs/crud-pro/services/CrudProExecuteSqlService.js +10 -9
  56. package/dist/libs/crud-pro/services/CrudProGenSqlCondition.d.ts +1 -1
  57. package/dist/libs/crud-pro/services/CrudProGenSqlCondition.js +10 -12
  58. package/dist/libs/crud-pro/services/CrudProGenSqlService.js +14 -23
  59. package/dist/libs/crud-pro/services/CrudProOriginToExecuteSql.js +7 -6
  60. package/dist/libs/crud-pro/services/CrudProServiceBase.d.ts +2 -6
  61. package/dist/libs/crud-pro/services/CrudProServiceBase.js +3 -2
  62. package/dist/libs/crud-pro/services/CrudProTableMetaService.d.ts +1 -0
  63. package/dist/libs/crud-pro/services/CrudProTableMetaService.js +31 -7
  64. package/dist/libs/crud-pro/utils/DatabaseName.js +24 -3
  65. package/dist/libs/crud-pro/utils/MixinUtils.js +1 -1
  66. package/dist/libs/crud-pro/utils/ValidateUtils.js +1 -1
  67. package/dist/libs/crud-pro/utils/sqlConvert/convertColumnName.js +2 -2
  68. package/dist/libs/global-config/global-config.d.ts +45 -0
  69. package/dist/libs/global-config/global-config.js +33 -0
  70. package/dist/libs/utils/errorToString.d.ts +2 -0
  71. package/dist/libs/utils/errorToString.js +57 -0
  72. package/dist/libs/utils/fatcms-request.js +2 -2
  73. package/dist/middleware/forbidden.middleware.js +4 -20
  74. package/dist/middleware/global.middleware.js +8 -1
  75. package/dist/models/AsyncTaskModel.d.ts +69 -0
  76. package/dist/models/AsyncTaskModel.js +26 -0
  77. package/dist/models/RedisKeys.d.ts +8 -0
  78. package/dist/models/RedisKeys.js +11 -0
  79. package/dist/models/SystemTables.d.ts +1 -3
  80. package/dist/models/SystemTables.js +2 -4
  81. package/dist/schedule/anonymousContext.d.ts +13 -0
  82. package/dist/schedule/anonymousContext.js +59 -0
  83. package/dist/schedule/index.d.ts +4 -3
  84. package/dist/schedule/index.js +8 -67
  85. package/dist/schedule/runSchedule.d.ts +15 -0
  86. package/dist/schedule/runSchedule.js +68 -0
  87. package/dist/schedule/scheduleNames.d.ts +13 -0
  88. package/dist/schedule/scheduleNames.js +17 -0
  89. package/dist/service/AuthService.js +8 -5
  90. package/dist/service/EnumInfoService.js +7 -4
  91. package/dist/service/FileCenterService.js +13 -9
  92. package/dist/service/SysConfigService.js +4 -2
  93. package/dist/service/UserAccountService.js +10 -6
  94. package/dist/service/UserSessionService.js +2 -1
  95. package/dist/service/VisitStatService.d.ts +1 -1
  96. package/dist/service/VisitStatService.js +20 -27
  97. package/dist/service/WorkbenchService.js +4 -2
  98. package/dist/service/anyapi/AnyApiService.js +4 -2
  99. package/dist/service/asyncTask/AsyncTaskRunnerService.d.ts +37 -0
  100. package/dist/service/asyncTask/AsyncTaskRunnerService.js +226 -0
  101. package/dist/service/asyncTask/AsyncTaskService.d.ts +7 -0
  102. package/dist/service/asyncTask/AsyncTaskService.js +34 -0
  103. package/dist/service/crudstd/CrudStdService.d.ts +1 -0
  104. package/dist/service/crudstd/CrudStdService.js +34 -3
  105. package/dist/service/curd/CrudProQuick.d.ts +24 -0
  106. package/dist/service/curd/CrudProQuick.js +105 -0
  107. package/dist/service/curd/CurdMixByAccountService.js +12 -6
  108. package/dist/service/curd/CurdMixByDictService.js +4 -2
  109. package/dist/service/curd/CurdMixByLinkToCustomService.d.ts +10 -1
  110. package/dist/service/curd/CurdMixByLinkToCustomService.js +72 -24
  111. package/dist/service/curd/CurdMixBySysConfigService.js +4 -2
  112. package/dist/service/curd/CurdMixByWorkbenchService.js +4 -2
  113. package/dist/service/curd/CurdMixService.d.ts +1 -1
  114. package/dist/service/curd/CurdMixService.js +2 -2
  115. package/dist/service/curd/CurdMixUtils.d.ts +7 -0
  116. package/dist/service/curd/CurdMixUtils.js +65 -28
  117. package/dist/service/curd/CurdProService.d.ts +2 -10
  118. package/dist/service/curd/CurdProService.js +31 -146
  119. package/dist/service/curd/fixCfgModel.d.ts +3 -0
  120. package/dist/service/curd/fixCfgModel.js +107 -0
  121. package/dist/service/proxyapi/ProxyApiLoadService.js +7 -4
  122. package/dist/views/404_app.html +31 -0
  123. package/dist/views/404_workbench.html +34 -0
  124. package/dist/views/static/favicon.ico +0 -0
  125. package/package.json +9 -2
  126. package/src/config/config.default.ts +58 -27
  127. package/src/configuration.ts +42 -9
  128. package/src/controller/base/BaseApiController.ts +19 -19
  129. package/src/controller/gateway/AnyApiGatewayController.ts +1 -1
  130. package/src/controller/gateway/AsyncTaskController.ts +83 -0
  131. package/src/controller/gateway/CrudMtdGatewayController.ts +17 -13
  132. package/src/controller/gateway/CrudStdGatewayController.ts +4 -4
  133. package/src/controller/gateway/DocGatewayController.ts +25 -17
  134. package/src/controller/gateway/FileController.ts +8 -9
  135. package/src/controller/gateway/ProxyApiGatewayController.ts +4 -4
  136. package/src/controller/gateway/PublicApiController.ts +19 -22
  137. package/src/controller/gateway/StaticController.ts +234 -242
  138. package/src/controller/helpers.controller.ts +1 -1
  139. package/src/controller/home.controller.ts +8 -15
  140. package/src/controller/manage/AnyApiMangeApi.ts +9 -9
  141. package/src/controller/manage/AppLogMangeApi.ts +3 -3
  142. package/src/controller/manage/AppMangeApi.ts +5 -5
  143. package/src/controller/manage/AppPageMangeApi.ts +3 -3
  144. package/src/controller/manage/AppSchemaHistoryApi.ts +1 -1
  145. package/src/controller/manage/CrudMethodsMangeApi.ts +3 -3
  146. package/src/controller/manage/CrudStandardDesignApi.ts +106 -113
  147. package/src/controller/manage/DataDictManageApi.ts +4 -4
  148. package/src/controller/manage/DeployManageApi.ts +85 -89
  149. package/src/controller/manage/DocLibManageApi.ts +3 -3
  150. package/src/controller/manage/DocManageApi.ts +8 -8
  151. package/src/controller/manage/MenuManageApi.ts +9 -14
  152. package/src/controller/manage/SuperAdminManageApi.ts +14 -13
  153. package/src/controller/manage/SysConfigMangeApi.ts +9 -9
  154. package/src/controller/manage/SystemInfoManageApi.ts +11 -6
  155. package/src/controller/manage/UserAccountManageApi.ts +8 -2
  156. package/src/controller/manage/WorkbenchMangeApi.ts +6 -6
  157. package/src/controller/myinfo/AuthController.ts +6 -72
  158. package/src/controller/render/AppRenderController.ts +24 -21
  159. package/src/controller/test.controller.ts +18 -18
  160. package/src/index.ts +38 -4
  161. package/src/libs/crud-pro/CrudPro.ts +7 -0
  162. package/src/libs/crud-pro/defaultConfigs.ts +2 -0
  163. package/src/libs/crud-pro/interfaces.ts +10 -3
  164. package/src/libs/crud-pro/models/ExecuteContext.ts +3 -3
  165. package/src/libs/crud-pro/models/ExecuteContextFunc.ts +11 -1
  166. package/src/libs/crud-pro/models/RequestCfgModel.ts +1 -1
  167. package/src/libs/crud-pro/models/RequestModel.ts +1 -1
  168. package/src/libs/crud-pro/models/ResModel.ts +19 -0
  169. package/src/libs/crud-pro/models/SqlCfgModel.ts +2 -2
  170. package/src/libs/crud-pro/models/Transaction.ts +8 -9
  171. package/src/libs/crud-pro/models/TransactionPostgres.ts +1 -1
  172. package/src/libs/crud-pro/models/TransactionSqlServer.ts +8 -13
  173. package/src/libs/crud-pro/services/CrudProCachedCfgService.ts +26 -19
  174. package/src/libs/crud-pro/services/CrudProExecuteSqlService.ts +38 -50
  175. package/src/libs/crud-pro/services/CrudProGenSqlCondition.ts +26 -45
  176. package/src/libs/crud-pro/services/CrudProGenSqlService.ts +23 -40
  177. package/src/libs/crud-pro/services/CrudProOriginToExecuteSql.ts +25 -29
  178. package/src/libs/crud-pro/services/CrudProServiceBase.ts +5 -9
  179. package/src/libs/crud-pro/services/CrudProTableMetaService.ts +35 -9
  180. package/src/libs/crud-pro/utils/DatabaseName.ts +35 -15
  181. package/src/libs/crud-pro/utils/DateTimeUtils.ts +2 -2
  182. package/src/libs/crud-pro/utils/MixinUtils.ts +1 -1
  183. package/src/libs/crud-pro/utils/ValidateUtils.ts +1 -3
  184. package/src/libs/crud-pro/utils/pool/MySQLUtils.ts +1 -1
  185. package/src/libs/crud-pro/utils/pool/PostgresUtils.ts +3 -3
  186. package/src/libs/crud-pro/utils/pool/SqlServerUtils.ts +3 -3
  187. package/src/libs/crud-pro/utils/sqlConvert/convertColumnName.ts +2 -2
  188. package/src/libs/global-config/global-config.ts +78 -0
  189. package/src/libs/utils/crypto-utils.ts +2 -4
  190. package/src/libs/utils/errorToString.ts +61 -0
  191. package/src/libs/utils/fatcms-request.ts +9 -21
  192. package/src/libs/utils/ordernum-utils.ts +2 -6
  193. package/src/libs/utils/parseConfig.ts +7 -15
  194. package/src/middleware/forbidden.middleware.ts +6 -25
  195. package/src/middleware/global.middleware.ts +18 -16
  196. package/src/models/AsyncTaskModel.ts +79 -0
  197. package/src/models/RedisKeys.ts +13 -0
  198. package/src/models/SystemTables.ts +1 -4
  199. package/src/models/bizmodels.ts +1 -2
  200. package/src/schedule/anonymousContext.ts +79 -0
  201. package/src/schedule/index.ts +11 -72
  202. package/src/schedule/runSchedule.ts +83 -0
  203. package/src/schedule/scheduleNames.ts +21 -0
  204. package/src/service/AuthService.ts +13 -8
  205. package/src/service/EnumInfoService.ts +8 -3
  206. package/src/service/FileCenterService.ts +12 -6
  207. package/src/service/SysConfigService.ts +10 -6
  208. package/src/service/UserAccountService.ts +14 -4
  209. package/src/service/UserSessionService.ts +5 -4
  210. package/src/service/VisitStatService.ts +57 -70
  211. package/src/service/WorkbenchService.ts +7 -2
  212. package/src/service/anyapi/AnyApiService.ts +11 -8
  213. package/src/service/asyncTask/AsyncTaskRunnerService.ts +249 -0
  214. package/src/service/asyncTask/AsyncTaskService.ts +21 -0
  215. package/src/service/base/BaseService.ts +2 -2
  216. package/src/service/crudstd/CrudStdService.ts +43 -5
  217. package/src/service/curd/CrudProQuick.ts +137 -0
  218. package/src/service/curd/CurdMixByAccountService.ts +14 -6
  219. package/src/service/curd/CurdMixByDictService.ts +8 -2
  220. package/src/service/curd/CurdMixByLinkToCustomService.ts +101 -50
  221. package/src/service/curd/CurdMixBySysConfigService.ts +7 -2
  222. package/src/service/curd/CurdMixByWorkbenchService.ts +6 -2
  223. package/src/service/curd/CurdMixService.ts +3 -3
  224. package/src/service/curd/CurdMixUtils.ts +82 -39
  225. package/src/service/curd/CurdProService.ts +45 -189
  226. package/src/service/curd/fixCfgModel.ts +139 -0
  227. package/src/service/proxyapi/ProxyApiLoadService.ts +12 -3
  228. package/src/views/404_app.html +31 -0
  229. package/src/views/404_workbench.html +34 -0
  230. package/src/views/static/favicon.ico +0 -0
  231. package/tsconfig.json +32 -0
  232. package/dist/controller/medstatistic/MedAdminController.d.ts +0 -35
  233. package/dist/controller/medstatistic/MedAdminController.js +0 -205
  234. package/dist/controller/medstatistic/MedClientController.d.ts +0 -28
  235. package/dist/controller/medstatistic/MedClientController.js +0 -188
  236. package/dist/controller/medstatistic/MedMessageService.d.ts +0 -19
  237. package/dist/controller/medstatistic/MedMessageService.js +0 -95
  238. package/dist/controller/medstatistic/MedScoreService.d.ts +0 -21
  239. package/dist/controller/medstatistic/MedScoreService.js +0 -107
  240. package/dist/controller/medstatistic/constants.d.ts +0 -32
  241. package/dist/controller/medstatistic/constants.js +0 -43
  242. package/src/controller/medstatistic/MedAdminController.ts +0 -221
  243. package/src/controller/medstatistic/MedClientController.ts +0 -188
  244. package/src/controller/medstatistic/MedMessageService.ts +0 -89
  245. package/src/controller/medstatistic/MedScoreService.ts +0 -108
  246. package/src/controller/medstatistic/constants.ts +0 -63
@@ -1,71 +1,70 @@
1
- import {Controller, Fields, Files, Inject, Post, Query} from '@midwayjs/core';
2
- import {Context} from '@midwayjs/koa';
3
- import {BaseApiController} from '../base/BaseApiController';
4
- import {checkPermission} from '../../middleware/permission.middleware';
5
- import {SystemFuncCode} from '../../models/SystemPerm';
6
- import {CommonResult} from "../../libs/utils/common-dto";
7
- import {AccessType, UploadCategoryType} from "../../models/bizmodels";
8
- import {BizException} from "../../models/devops";
9
- import {FileCenterService, toDownloadPaths} from '../../service/FileCenterService';
10
- import {SystemDbName, SystemDbType, SystemTables} from "../../models/SystemTables";
11
- import {KeysOfSimpleSQL} from "../../libs/crud-pro/models/keys";
12
- import {WorkbenchService} from "../../service/WorkbenchService";
13
-
1
+ import { Controller, Fields, Files, Inject, Post, Query } from '@midwayjs/core';
2
+ import { Context } from '@midwayjs/koa';
3
+ import { BaseApiController } from '../base/BaseApiController';
4
+ import { checkPermission } from '../../middleware/permission.middleware';
5
+ import { SystemFuncCode } from '../../models/SystemPerm';
6
+ import { CommonResult } from '../../libs/utils/common-dto';
7
+ import { AccessType, UploadCategoryType } from '../../models/bizmodels';
8
+ import { BizException } from '../../models/devops';
9
+ import { FileCenterService, toDownloadPaths } from '../../service/FileCenterService';
10
+ import { SystemTables } from '../../models/SystemTables';
11
+ import { KeysOfSimpleSQL } from '../../libs/crud-pro/models/keys';
12
+ import { WorkbenchService } from '../../service/WorkbenchService';
13
+ import { GLOBAL_STATIC_CONFIG } from '@/libs/global-config/global-config';
14
14
 
15
15
  interface IReleaseAssetsParams {
16
- cdnResources: any[],
17
- packageName: string,
18
- packageVersion: string,
16
+ cdnResources: any[];
17
+ packageName: string;
18
+ packageVersion: string;
19
19
  }
20
20
 
21
-
22
21
  function toAssetsSchema(fileList: any) {
23
22
  for (let i = 0; i < fileList.length; i++) {
24
23
  const fileListElement = fileList[i];
25
- fileListElement.settingKey = "assets"+i;
24
+ fileListElement.settingKey = 'assets' + i;
26
25
  }
27
26
  return {
28
- "schema": [{
29
- "title": "资源配置",
30
- "name": "fileList",
31
- "type": "array",
32
- "properties": {
33
- "fileUrl": {"label": "文件URL", "component": "Input", "xProps": {"hasClear": true}, "width": 500},
34
- "fileType": {
35
- "label": "文件类型",
36
- "component": "Select",
37
- enums: [
38
- {label: 'js', value: 'js'},
39
- {label: 'css', value: 'css'},
40
- ],
41
- "xProps": {
42
- "hasClear": true
27
+ schema: [
28
+ {
29
+ title: '资源配置',
30
+ name: 'fileList',
31
+ type: 'array',
32
+ properties: {
33
+ fileUrl: { label: '文件URL', component: 'Input', xProps: { hasClear: true }, width: 500 },
34
+ fileType: {
35
+ label: '文件类型',
36
+ component: 'Select',
37
+ enums: [
38
+ { label: 'js', value: 'js' },
39
+ { label: 'css', value: 'css' },
40
+ ],
41
+ xProps: {
42
+ hasClear: true,
43
+ },
44
+ width: 500,
43
45
  },
44
- width: 500
45
- },
46
- "isModule": {
47
- "label": "isModule",
48
- "component": "Select",
49
- enums: [
50
- {label: 'true', value: true},
51
- {label: 'false', value: false},
52
- ],
53
- "xProps": {
54
- "hasClear": true
46
+ isModule: {
47
+ label: 'isModule',
48
+ component: 'Select',
49
+ enums: [
50
+ { label: 'true', value: true },
51
+ { label: 'false', value: false },
52
+ ],
53
+ xProps: {
54
+ hasClear: true,
55
+ },
56
+ width: 500,
55
57
  },
56
- width: 500
57
58
  },
58
-
59
- }
60
- }],
61
- "data": {
62
- "fileList": fileList
63
- }
59
+ },
60
+ ],
61
+ data: {
62
+ fileList: fileList,
63
+ },
64
64
  };
65
65
  }
66
66
 
67
-
68
- @Controller('/ns/api/manage/deploy', { middleware: [checkPermission([ SystemFuncCode.AppMangeRead, SystemFuncCode.WorkbenchMangeRead])] })
67
+ @Controller('/ns/api/manage/deploy', { middleware: [checkPermission([SystemFuncCode.AppMangeRead, SystemFuncCode.WorkbenchMangeRead])] })
69
68
  export class DeployManageApi extends BaseApiController {
70
69
  @Inject()
71
70
  protected ctx: Context;
@@ -108,7 +107,6 @@ export class DeployManageApi extends BaseApiController {
108
107
  return CommonResult.successRes(data);
109
108
  }
110
109
 
111
-
112
110
  /**
113
111
  * 资源文件让其生效
114
112
  */
@@ -123,57 +121,55 @@ export class DeployManageApi extends BaseApiController {
123
121
  throw new BizException('packageName参数小于5');
124
122
  }
125
123
 
126
- const cdnResources = params.cdnResources
124
+ const cdnResources = params.cdnResources;
127
125
  if (!Array.isArray(cdnResources) || cdnResources.length === 0) {
128
126
  throw new BizException('cdnResources参数不存在');
129
127
  }
130
128
 
131
- const workbench = await this.curdMixService.executeCrudByCfg({
132
- data: {
133
- package_assets: JSON.stringify(toAssetsSchema(cdnResources)),
129
+ const { SystemDbName, SystemDbType } = GLOBAL_STATIC_CONFIG.getConfig();
130
+
131
+ const workbench = await this.curdMixService.executeCrudByCfg(
132
+ {
133
+ data: {
134
+ package_assets: JSON.stringify(toAssetsSchema(cdnResources)),
135
+ },
136
+ condition: {
137
+ package_name: params.packageName,
138
+ },
134
139
  },
135
- condition: {
136
- package_name: params.packageName
140
+ {
141
+ sqlTable: SystemTables.sys_workbench,
142
+ sqlDatabase: SystemDbName,
143
+ sqlDbType: SystemDbType,
144
+ sqlSimpleName: KeysOfSimpleSQL.SIMPLE_UPDATE,
137
145
  }
138
- },{
139
- sqlTable: SystemTables.sys_workbench,
140
- sqlDatabase: SystemDbName,
141
- sqlDdType: SystemDbType,
142
- sqlSimpleName: KeysOfSimpleSQL.SIMPLE_UPDATE
143
- });
146
+ );
144
147
 
145
-
146
-
147
- const app = await this.curdMixService.executeCrudByCfg({
148
- data: {
149
- package_assets: JSON.stringify(toAssetsSchema(cdnResources)),
148
+ const app = await this.curdMixService.executeCrudByCfg(
149
+ {
150
+ data: {
151
+ package_assets: JSON.stringify(toAssetsSchema(cdnResources)),
152
+ },
153
+ condition: {
154
+ package_name: params.packageName,
155
+ },
150
156
  },
151
- condition: {
152
- package_name: params.packageName
157
+ {
158
+ sqlTable: SystemTables.sys_app,
159
+ sqlDatabase: SystemDbName,
160
+ sqlDbType: SystemDbType,
161
+ sqlSimpleName: KeysOfSimpleSQL.SIMPLE_UPDATE,
153
162
  }
154
- },{
155
- sqlTable: SystemTables.sys_app,
156
- sqlDatabase: SystemDbName,
157
- sqlDdType: SystemDbType,
158
- sqlSimpleName: KeysOfSimpleSQL.SIMPLE_UPDATE
159
- });
160
-
163
+ );
161
164
 
162
165
  this.workbenchService.clearCache();
163
166
 
164
167
  const workbenchAffected = workbench.getResModelItem('affected') || {};
165
168
  const appAffected = app.getResModelItem('affected') || {};
166
169
 
167
- const result = CommonResult.successRes({workbenchAffected, appAffected});
170
+ const result = CommonResult.successRes({ workbenchAffected, appAffected });
168
171
 
169
- result.message = `${cdnResources.length}个文件,更新到${workbenchAffected.affectedRows}个站点模版;更新到${appAffected.affectedRows}个应用模版,`
172
+ result.message = `${cdnResources.length}个文件,更新到${workbenchAffected.affectedRows}个站点模版;更新到${appAffected.affectedRows}个应用模版,`;
170
173
  return result;
171
174
  }
172
-
173
-
174
-
175
-
176
-
177
-
178
-
179
175
  }
@@ -30,7 +30,7 @@ export class DocLibManageApi extends BaseApiController {
30
30
  });
31
31
  }
32
32
 
33
- @Post('/createDocLib', { middleware: [checkPermission(SystemFuncCode.DocMangeWrite)] })
33
+ @Post('/createDocLib', { middleware: [checkPermission(SystemFuncCode.DocMangeWrite)] })
34
34
  async createDocLib() {
35
35
  return this.executeSysSimpleSQL(SystemTables.sys_doc_lib, KeysOfSimpleSQL.SIMPLE_INSERT, {
36
36
  validateCfg: {
@@ -42,7 +42,7 @@ export class DocLibManageApi extends BaseApiController {
42
42
  });
43
43
  }
44
44
 
45
- @Post('/updateDocLib', { middleware: [checkPermission(SystemFuncCode.DocMangeWrite)] })
45
+ @Post('/updateDocLib', { middleware: [checkPermission(SystemFuncCode.DocMangeWrite)] })
46
46
  async updateDocLib() {
47
47
  return this.executeSysSimpleSQL(SystemTables.sys_doc_lib, KeysOfSimpleSQL.SIMPLE_UPDATE, {
48
48
  validateCfg: {
@@ -55,7 +55,7 @@ export class DocLibManageApi extends BaseApiController {
55
55
  });
56
56
  }
57
57
 
58
- @Post('/deleteDocLib', { middleware: [checkPermission(SystemFuncCode.DocMangeWrite)] })
58
+ @Post('/deleteDocLib', { middleware: [checkPermission(SystemFuncCode.DocMangeWrite)] })
59
59
  async deleteDocLib() {
60
60
  return this.executeSysSimpleSQL(SystemTables.sys_doc_lib, KeysOfSimpleSQL.SIMPLE_DELETE, {
61
61
  validateCfg: {
@@ -1,11 +1,11 @@
1
1
  import { Controller, Inject, Post } from '@midwayjs/core';
2
2
  import { Context } from '@midwayjs/koa';
3
- import { KeysOfSimpleSQL, KeysOfValidators } from '../../libs/crud-pro/models/keys';
3
+ import { KeysOfSimpleSQL, KeysOfValidators } from '@/libs/crud-pro/models/keys';
4
4
  import { BaseApiController } from '../base/BaseApiController';
5
- import { checkPermission } from '../../middleware/permission.middleware';
6
- import { SystemFuncCode } from '../../models/SystemPerm';
7
- import { SystemTables } from '../../models/SystemTables';
8
- import { CTX_VISITOR_ID, CTX_WORKBENCH_CODE } from '../../models/bizmodels';
5
+ import { checkPermission } from '@/middleware/permission.middleware';
6
+ import { SystemFuncCode } from '@/models/SystemPerm';
7
+ import { SystemTables } from '@/models/SystemTables';
8
+ import { CTX_VISITOR_ID, CTX_WORKBENCH_CODE } from '@/models/bizmodels';
9
9
 
10
10
  const publishUpdateCfg = {
11
11
  'data.last_publish_by': { contextAsString: CTX_VISITOR_ID },
@@ -57,7 +57,7 @@ export class DocManageApi extends BaseApiController {
57
57
  return false;
58
58
  }
59
59
 
60
- @Post('/createDoc', { middleware: [checkPermission(SystemFuncCode.DocMangeWrite)] })
60
+ @Post('/createDoc', { middleware: [checkPermission(SystemFuncCode.DocMangeWrite)] })
61
61
  async createDoc() {
62
62
  const isPublish = this.setReleaseData();
63
63
  return this.executeSysSimpleSQL('sys_doc', KeysOfSimpleSQL.SIMPLE_INSERT, {
@@ -70,7 +70,7 @@ export class DocManageApi extends BaseApiController {
70
70
  });
71
71
  }
72
72
 
73
- @Post('/updateDoc', { middleware: [checkPermission(SystemFuncCode.DocMangeWrite)] })
73
+ @Post('/updateDoc', { middleware: [checkPermission(SystemFuncCode.DocMangeWrite)] })
74
74
  async updateDoc() {
75
75
  const isPublish = this.setReleaseData();
76
76
  const updateCfg = isPublish ? publishUpdateCfg : {};
@@ -85,7 +85,7 @@ export class DocManageApi extends BaseApiController {
85
85
  });
86
86
  }
87
87
 
88
- @Post('/deleteDoc', { middleware: [checkPermission(SystemFuncCode.DocMangeWrite)] })
88
+ @Post('/deleteDoc', { middleware: [checkPermission(SystemFuncCode.DocMangeWrite)] })
89
89
  async deleteDoc() {
90
90
  return this.executeSysSimpleSQL('sys_doc', KeysOfSimpleSQL.SIMPLE_DELETE, {
91
91
  validateCfg: {
@@ -14,50 +14,45 @@ export class MenuManageApi extends BaseApiController {
14
14
  @Post('/getMenuList')
15
15
  async getMenuList() {
16
16
  return this.executeSysSimpleSQL(SystemTables.sys_menus, KeysOfSimpleSQL.SIMPLE_QUERY_PAGE, {
17
- updateCfg: {
18
- },
17
+ updateCfg: {},
19
18
  });
20
19
  }
21
20
 
22
21
  @Post('/getMenuOne')
23
22
  async getMenuOne() {
24
23
  return this.executeSysSimpleSQL(SystemTables.sys_menus, KeysOfSimpleSQL.SIMPLE_QUERY_ONE, {
25
- updateCfg: {
26
- },
24
+ updateCfg: {},
27
25
  });
28
26
  }
29
27
 
30
- @Post('/createMenu', { middleware: [checkPermission(SystemFuncCode.MenuMangeWrite)] })
28
+ @Post('/createMenu', { middleware: [checkPermission(SystemFuncCode.MenuMangeWrite)] })
31
29
  async createMenu() {
32
30
  return this.executeSysSimpleSQL(SystemTables.sys_menus, KeysOfSimpleSQL.SIMPLE_INSERT, {
33
31
  validateCfg: {
34
32
  'data.menu_code': [KeysOfValidators.REQUIRED, KeysOfValidators.STRING],
35
33
  'data.menu_title': [KeysOfValidators.REQUIRED, KeysOfValidators.STRING],
36
34
  },
37
- updateCfg: {
38
- },
35
+ updateCfg: {},
39
36
  });
40
37
  }
41
38
 
42
- @Post('/updateMenu', { middleware: [checkPermission(SystemFuncCode.MenuMangeWrite)] })
39
+ @Post('/updateMenu', { middleware: [checkPermission(SystemFuncCode.MenuMangeWrite)] })
43
40
  async updateMenu() {
44
41
  return this.executeSysSimpleSQL(SystemTables.sys_menus, KeysOfSimpleSQL.SIMPLE_UPDATE, {
45
42
  validateCfg: {
46
- 'condition.id': [KeysOfValidators.REQUIRED, KeysOfValidators.INTEGER]
47
- },
48
- updateCfg: {
43
+ 'condition.id': [KeysOfValidators.REQUIRED, KeysOfValidators.INTEGER],
49
44
  },
45
+ updateCfg: {},
50
46
  });
51
47
  }
52
48
 
53
- @Post('/deleteMenu', { middleware: [checkPermission(SystemFuncCode.MenuMangeWrite)] })
49
+ @Post('/deleteMenu', { middleware: [checkPermission(SystemFuncCode.MenuMangeWrite)] })
54
50
  async deleteMenu() {
55
51
  return this.executeSysSimpleSQL(SystemTables.sys_menus, KeysOfSimpleSQL.SIMPLE_DELETE, {
56
52
  validateCfg: {
57
53
  'condition.id': [KeysOfValidators.REQUIRED, KeysOfValidators.INTEGER],
58
54
  },
59
- updateCfg: {
60
- },
55
+ updateCfg: {},
61
56
  });
62
57
  }
63
58
  }
@@ -1,12 +1,13 @@
1
1
  import { Controller, Inject, Post, Get } from '@midwayjs/core';
2
2
  import { Context } from '@midwayjs/koa';
3
- import { VisitStatService } from "../../service/VisitStatService";
3
+ import { VisitStatService } from '../../service/VisitStatService';
4
4
  import { KeysOfSimpleSQL } from '../../libs/crud-pro/models/keys';
5
5
  import { BaseApiController } from '../base/BaseApiController';
6
6
  import { checkRole } from '../../middleware/permission.middleware';
7
7
  import { SystemFuncCodeNameMap, SystemRoleCode, SystemRoleCodeNameMap } from '../../models/SystemPerm';
8
- import {SystemDbName, SystemDbType, SystemTables} from '../../models/SystemTables';
9
- import {CommonResult} from "../../libs/utils/common-dto";
8
+ import { SystemTables } from '../../models/SystemTables';
9
+ import { CommonResult } from '../../libs/utils/common-dto';
10
+ import { GLOBAL_STATIC_CONFIG } from '@/libs/global-config/global-config';
10
11
 
11
12
  @Controller('/ns/api/manage/superAdmin', { middleware: [checkRole(SystemRoleCode.SuperAdmin)] })
12
13
  export class SuperAdminManageApi extends BaseApiController {
@@ -16,12 +17,13 @@ export class SuperAdminManageApi extends BaseApiController {
16
17
  @Inject()
17
18
  protected visitStatService: VisitStatService;
18
19
 
19
-
20
20
  /**
21
21
  * 预设系统内置功能点数据
22
22
  */
23
23
  @Post('/presetsFuncCode')
24
24
  async presetsFuncCode() {
25
+ const { SystemDbName, SystemDbType } = GLOBAL_STATIC_CONFIG.getConfig();
26
+
25
27
  const funcCodeList = Object.keys(SystemFuncCodeNameMap);
26
28
  for (let i = 0; i < funcCodeList.length; i++) {
27
29
  const funcCode = funcCodeList[i];
@@ -38,12 +40,11 @@ export class SuperAdminManageApi extends BaseApiController {
38
40
  sqlTable: SystemTables.sys_perm_func,
39
41
  sqlSimpleName: KeysOfSimpleSQL.SIMPLE_INSERT,
40
42
  sqlDatabase: SystemDbName,
41
- sqlDdType: SystemDbType,
43
+ sqlDbType: SystemDbType,
42
44
  }
43
45
  );
44
46
  }
45
47
 
46
-
47
48
  return CommonResult.successRes();
48
49
  }
49
50
 
@@ -52,6 +53,8 @@ export class SuperAdminManageApi extends BaseApiController {
52
53
  */
53
54
  @Post('/presetsRoleCode')
54
55
  async presetsRoleCode() {
56
+ const { SystemDbName, SystemDbType } = GLOBAL_STATIC_CONFIG.getConfig();
57
+
55
58
  const roleCodeList = [SystemRoleCode.DevOpsViewer, SystemRoleCode.DevOpsWriter];
56
59
 
57
60
  for (let i = 0; i < roleCodeList.length; i++) {
@@ -69,7 +72,7 @@ export class SuperAdminManageApi extends BaseApiController {
69
72
  sqlTable: SystemTables.sys_perm_role,
70
73
  sqlSimpleName: KeysOfSimpleSQL.SIMPLE_INSERT,
71
74
  sqlDatabase: SystemDbName,
72
- sqlDdType: SystemDbType,
75
+ sqlDbType: SystemDbType,
73
76
  }
74
77
  );
75
78
  }
@@ -82,6 +85,8 @@ export class SuperAdminManageApi extends BaseApiController {
82
85
  */
83
86
  @Post('/presetsRoleFuncList')
84
87
  async presetsRoleFuncList() {
88
+ const { SystemDbName, SystemDbType } = GLOBAL_STATIC_CONFIG.getConfig();
89
+
85
90
  const funcCodeList = Object.keys(SystemFuncCodeNameMap);
86
91
  for (let i = 0; i < funcCodeList.length; i++) {
87
92
  const funcCode = funcCodeList[i];
@@ -97,7 +102,7 @@ export class SuperAdminManageApi extends BaseApiController {
97
102
  sqlTable: SystemTables.sys_perm_role_func,
98
103
  sqlSimpleName: KeysOfSimpleSQL.SIMPLE_INSERT,
99
104
  sqlDatabase: SystemDbName,
100
- sqlDdType: SystemDbType,
105
+ sqlDbType: SystemDbType,
101
106
  }
102
107
  );
103
108
  }
@@ -116,7 +121,7 @@ export class SuperAdminManageApi extends BaseApiController {
116
121
  sqlTable: SystemTables.sys_perm_role_func,
117
122
  sqlSimpleName: KeysOfSimpleSQL.SIMPLE_INSERT,
118
123
  sqlDatabase: SystemDbName,
119
- sqlDdType: SystemDbType,
124
+ sqlDbType: SystemDbType,
120
125
  }
121
126
  );
122
127
  }
@@ -124,7 +129,6 @@ export class SuperAdminManageApi extends BaseApiController {
124
129
  return CommonResult.successRes();
125
130
  }
126
131
 
127
-
128
132
  /**
129
133
  * 将每天的访问数据,更新到数据库中
130
134
  */
@@ -132,7 +136,4 @@ export class SuperAdminManageApi extends BaseApiController {
132
136
  async flushVisitStatToDB() {
133
137
  return this.visitStatService.flushVisitStatToDB();
134
138
  }
135
-
136
-
137
-
138
139
  }
@@ -5,8 +5,9 @@ import { BaseApiController } from '../base/BaseApiController';
5
5
  import { checkPermission } from '../../middleware/permission.middleware';
6
6
  import { SystemFuncCode } from '../../models/SystemPerm';
7
7
  import { CTX_WORKBENCH_CODE } from '../../models/bizmodels';
8
- import {SystemDbName, SystemDbType, SystemTables} from "../../models/SystemTables";
9
- import {CommonResult} from "../../libs/utils/common-dto";
8
+ import { SystemTables } from '../../models/SystemTables';
9
+ import { CommonResult } from '../../libs/utils/common-dto';
10
+ import { GLOBAL_STATIC_CONFIG } from '@/libs/global-config/global-config';
10
11
 
11
12
  @Controller('/ns/api/manage/sysconfig', { middleware: [checkPermission(SystemFuncCode.SysConfigMangeRead)] })
12
13
  export class SysConfigMangeApi extends BaseApiController {
@@ -48,28 +49,27 @@ export class SysConfigMangeApi extends BaseApiController {
48
49
 
49
50
  @Post('/updateSysConfig', { middleware: [checkPermission(SystemFuncCode.SysConfigMangeWrite)] })
50
51
  async updateSysConfig() {
52
+ const { SystemDbName, SystemDbType } = GLOBAL_STATIC_CONFIG.getConfig();
51
53
 
52
54
  const body = this.ctx.request.body as any;
53
55
  const id = body.condition.id;
54
56
  if (!id) {
55
- return CommonResult.errorRes("id不能为空")
57
+ return CommonResult.errorRes('id不能为空');
56
58
  }
57
59
 
58
- const sysConfig = await this.curdMixService.getBbUtil(SystemDbName, SystemDbType).getOne({condition: body.condition}, SystemTables.sys_configs)
60
+ const sysConfig = await this.curdMixService.getBbUtil(SystemDbName, SystemDbType).getOne({ condition: body.condition }, SystemTables.sys_configs);
59
61
  if (!sysConfig) {
60
- return CommonResult.errorRes("配置项不存在")
62
+ return CommonResult.errorRes('配置项不存在');
61
63
  }
62
64
 
63
- const {edit_auth_type, edit_auth_config} = sysConfig;
65
+ const { edit_auth_type, edit_auth_config } = sysConfig;
64
66
  if (edit_auth_type) {
65
67
  const isOK = this.ctx.userSession.isAuthPass(edit_auth_type, edit_auth_config);
66
68
  if (!isOK) {
67
- return CommonResult.errorRes("编辑权限校验不通过:" + JSON.stringify({edit_auth_type, edit_auth_config}));
69
+ return CommonResult.errorRes('编辑权限校验不通过:' + JSON.stringify({ edit_auth_type, edit_auth_config }));
68
70
  }
69
71
  }
70
72
 
71
-
72
-
73
73
  return this.executeSysSimpleSQL('sys_configs', KeysOfSimpleSQL.SIMPLE_UPDATE, {
74
74
  validateCfg: {
75
75
  'data.workbench_code': [KeysOfValidators.REQUIRED, KeysOfValidators.STRING, 'length:1,64'],
@@ -2,9 +2,9 @@ import { Controller, Inject, Get } from '@midwayjs/core';
2
2
  import { InfoService } from '@midwayjs/info';
3
3
  import { Context } from '@midwayjs/koa';
4
4
  import { BaseApiController } from '../base/BaseApiController';
5
- import {checkPermission} from '../../middleware/permission.middleware';
6
- import {SystemFuncCode} from '../../models/SystemPerm';
7
- import {CommonResult} from "../../libs/utils/common-dto";
5
+ import { checkPermission } from '../../middleware/permission.middleware';
6
+ import { SystemFuncCode } from '../../models/SystemPerm';
7
+ import { CommonResult } from '../../libs/utils/common-dto';
8
8
 
9
9
  @Controller('/ns/api/manage/systemInfo', { middleware: [checkPermission(SystemFuncCode.SystemInfoManageApiRead)] })
10
10
  export class SystemInfoManageApi extends BaseApiController {
@@ -41,8 +41,13 @@ export class SystemInfoManageApi extends BaseApiController {
41
41
  const networkInfo = this.infoService.networkInfo();
42
42
 
43
43
  return CommonResult.successRes({
44
- projectInfo,systemInfo,resourceOccupationInfo,softwareInfo,timeInfo,envInfo,networkInfo
45
- })
44
+ projectInfo,
45
+ systemInfo,
46
+ resourceOccupationInfo,
47
+ softwareInfo,
48
+ timeInfo,
49
+ envInfo,
50
+ networkInfo,
51
+ });
46
52
  }
47
-
48
53
  }
@@ -7,6 +7,7 @@ import { checkPermission } from '../../middleware/permission.middleware';
7
7
  import { SystemFuncCode } from '../../models/SystemPerm';
8
8
  import { CommonException, Exceptions } from '../../libs/crud-pro/exceptions';
9
9
  import { SystemTables } from '../../models/SystemTables';
10
+ import { GLOBAL_STATIC_CONFIG } from '@/libs/global-config/global-config';
10
11
 
11
12
  const accountNameBlacklist = new Set(['sa', 'root', 'admin', 'superadmin', 'administrator', 'sys', 'sysop', 'schedule_user']);
12
13
  function checkAccountCreateBlacklist(value: string) {
@@ -18,12 +19,12 @@ function checkAccountCreateBlacklist(value: string) {
18
19
  }
19
20
  }
20
21
 
21
- const LOGIN_NAME_VALIDATE = [KeysOfValidators.STRING, KeysOfValidators.NAME, 'length:6,50', checkAccountCreateBlacklist]
22
+ const LOGIN_NAME_VALIDATE = [KeysOfValidators.STRING, KeysOfValidators.NAME, 'length:6,50', checkAccountCreateBlacklist];
22
23
 
23
24
  @Controller('/ns/api/manage/userAccount', { middleware: [checkPermission(SystemFuncCode.UserAccountMangeRead)] })
24
25
  export class UserAccountManageApi extends BaseApiController {
25
26
  @Inject()
26
- ctx: Context;
27
+ protected ctx: Context;
27
28
 
28
29
  @Post('/getUserAccountList')
29
30
  async getUserAccountList() {
@@ -58,6 +59,11 @@ export class UserAccountManageApi extends BaseApiController {
58
59
  const body = this.ctx.request.body as any;
59
60
  body.data.account_id = createUniqueId();
60
61
 
62
+ const { generateUserAccountId } = GLOBAL_STATIC_CONFIG.getConfig();
63
+ if (typeof generateUserAccountId === 'function') {
64
+ body.data.account_id = await generateUserAccountId(body.data);
65
+ }
66
+
61
67
  return this.executeSysSimpleSQL(SystemTables.sys_user_account, KeysOfSimpleSQL.SIMPLE_INSERT, {
62
68
  validateCfg: {
63
69
  'data.login_name': LOGIN_NAME_VALIDATE,
@@ -1,11 +1,11 @@
1
1
  import { Controller, Inject, Post } from '@midwayjs/core';
2
2
  import { Context } from '@midwayjs/koa';
3
- import { KeysOfSimpleSQL, KeysOfValidators } from '../../libs/crud-pro/models/keys';
3
+ import { KeysOfSimpleSQL, KeysOfValidators } from '@/libs/crud-pro/models/keys';
4
4
  import { BaseApiController } from '../base/BaseApiController';
5
- import { checkPermission } from '../../middleware/permission.middleware';
6
- import { SystemFuncCode } from '../../models/SystemPerm';
7
- import { SystemTables } from '../../models/SystemTables';
8
- import { WorkbenchService } from '../../service/WorkbenchService';
5
+ import { checkPermission } from '@/middleware/permission.middleware';
6
+ import { SystemFuncCode } from '@/models/SystemPerm';
7
+ import { SystemTables } from '@/models/SystemTables';
8
+ import { WorkbenchService } from '@/service/WorkbenchService';
9
9
 
10
10
  @Controller('/ns/api/manage/workbench', { middleware: [checkPermission(SystemFuncCode.WorkbenchMangeRead)] })
11
11
  export class WorkbenchMangeApi extends BaseApiController {
@@ -33,7 +33,7 @@ export class WorkbenchMangeApi extends BaseApiController {
33
33
  const body = this.ctx.request.body as any;
34
34
  const dataObj: any = body.data || {};
35
35
 
36
- dataObj.html_content = dataObj.html_content || "<html>hello</html>";
36
+ dataObj.html_content = dataObj.html_content || '<html>hello</html>';
37
37
 
38
38
  return this.executeSysSimpleSQL(SystemTables.sys_workbench, KeysOfSimpleSQL.SIMPLE_INSERT, {
39
39
  validateCfg: {