midway-fatcms 0.0.1-beta.1 → 0.0.1-beta.10

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 (91) hide show
  1. package/dist/config/config.default.js +52 -15
  2. package/dist/controller/base/BaseApiController.js +9 -6
  3. package/dist/controller/gateway/CrudMtdGatewayController.js +3 -0
  4. package/dist/controller/gateway/DocGatewayController.js +13 -8
  5. package/dist/controller/gateway/StaticController.d.ts +3 -0
  6. package/dist/controller/gateway/StaticController.js +41 -21
  7. package/dist/controller/home.controller.js +2 -2
  8. package/dist/controller/manage/CrudStandardDesignApi.js +83 -68
  9. package/dist/controller/manage/DeployManageApi.js +6 -4
  10. package/dist/controller/manage/SuperAdminManageApi.js +12 -8
  11. package/dist/controller/manage/SysConfigMangeApi.js +3 -1
  12. package/dist/controller/manage/UserAccountManageApi.d.ts +1 -1
  13. package/dist/controller/manage/UserAccountManageApi.js +5 -0
  14. package/dist/controller/myinfo/AuthController.d.ts +0 -4
  15. package/dist/controller/myinfo/AuthController.js +0 -53
  16. package/dist/controller/render/AppRenderController.js +4 -2
  17. package/dist/index.d.ts +28 -4
  18. package/dist/index.js +28 -4
  19. package/dist/libs/global-config/global-config.d.ts +39 -0
  20. package/dist/libs/global-config/global-config.js +32 -0
  21. package/dist/models/SystemTables.d.ts +0 -3
  22. package/dist/models/SystemTables.js +1 -4
  23. package/dist/service/AuthService.js +8 -5
  24. package/dist/service/EnumInfoService.js +7 -4
  25. package/dist/service/FileCenterService.js +13 -9
  26. package/dist/service/SysConfigService.js +4 -2
  27. package/dist/service/UserAccountService.js +10 -6
  28. package/dist/service/VisitStatService.js +4 -2
  29. package/dist/service/WorkbenchService.js +4 -2
  30. package/dist/service/anyapi/AnyApiService.js +4 -2
  31. package/dist/service/crudstd/CrudStdService.js +6 -2
  32. package/dist/service/curd/CurdMixByAccountService.js +12 -6
  33. package/dist/service/curd/CurdMixByDictService.js +4 -2
  34. package/dist/service/curd/CurdMixBySysConfigService.js +4 -2
  35. package/dist/service/curd/CurdMixByWorkbenchService.js +4 -2
  36. package/dist/service/curd/CurdMixUtils.d.ts +7 -0
  37. package/dist/service/curd/CurdMixUtils.js +31 -1
  38. package/dist/service/proxyapi/ProxyApiLoadService.js +7 -4
  39. package/dist/views/404_app.html +31 -0
  40. package/dist/views/404_workbench.html +34 -0
  41. package/dist/views/static/favicon.ico +0 -0
  42. package/package.json +5 -1
  43. package/src/config/config.default.ts +58 -27
  44. package/src/controller/base/BaseApiController.ts +13 -13
  45. package/src/controller/gateway/CrudMtdGatewayController.ts +5 -1
  46. package/src/controller/gateway/DocGatewayController.ts +9 -1
  47. package/src/controller/gateway/StaticController.ts +50 -25
  48. package/src/controller/home.controller.ts +8 -10
  49. package/src/controller/manage/CrudStandardDesignApi.ts +139 -94
  50. package/src/controller/manage/DeployManageApi.ts +4 -1
  51. package/src/controller/manage/SuperAdminManageApi.ts +11 -2
  52. package/src/controller/manage/SysConfigMangeApi.ts +4 -1
  53. package/src/controller/manage/UserAccountManageApi.ts +6 -0
  54. package/src/controller/myinfo/AuthController.ts +4 -66
  55. package/src/controller/render/AppRenderController.ts +17 -14
  56. package/src/index.ts +33 -4
  57. package/src/libs/global-config/global-config.ts +72 -0
  58. package/src/models/SystemTables.ts +0 -4
  59. package/src/service/AuthService.ts +11 -6
  60. package/src/service/EnumInfoService.ts +6 -1
  61. package/src/service/FileCenterService.ts +8 -2
  62. package/src/service/SysConfigService.ts +9 -5
  63. package/src/service/UserAccountService.ts +11 -1
  64. package/src/service/VisitStatService.ts +5 -1
  65. package/src/service/WorkbenchService.ts +6 -1
  66. package/src/service/anyapi/AnyApiService.ts +4 -1
  67. package/src/service/crudstd/CrudStdService.ts +11 -1
  68. package/src/service/curd/CurdMixByAccountService.ts +13 -5
  69. package/src/service/curd/CurdMixByDictService.ts +7 -1
  70. package/src/service/curd/CurdMixBySysConfigService.ts +6 -1
  71. package/src/service/curd/CurdMixByWorkbenchService.ts +5 -1
  72. package/src/service/curd/CurdMixUtils.ts +42 -12
  73. package/src/service/proxyapi/ProxyApiLoadService.ts +9 -1
  74. package/src/views/404_app.html +31 -0
  75. package/src/views/404_workbench.html +34 -0
  76. package/src/views/static/favicon.ico +0 -0
  77. package/dist/controller/medstatistic/MedAdminController.d.ts +0 -35
  78. package/dist/controller/medstatistic/MedAdminController.js +0 -205
  79. package/dist/controller/medstatistic/MedClientController.d.ts +0 -28
  80. package/dist/controller/medstatistic/MedClientController.js +0 -188
  81. package/dist/controller/medstatistic/MedMessageService.d.ts +0 -19
  82. package/dist/controller/medstatistic/MedMessageService.js +0 -95
  83. package/dist/controller/medstatistic/MedScoreService.d.ts +0 -21
  84. package/dist/controller/medstatistic/MedScoreService.js +0 -107
  85. package/dist/controller/medstatistic/constants.d.ts +0 -32
  86. package/dist/controller/medstatistic/constants.js +0 -43
  87. package/src/controller/medstatistic/MedAdminController.ts +0 -221
  88. package/src/controller/medstatistic/MedClientController.ts +0 -188
  89. package/src/controller/medstatistic/MedMessageService.ts +0 -89
  90. package/src/controller/medstatistic/MedScoreService.ts +0 -108
  91. package/src/controller/medstatistic/constants.ts +0 -63
@@ -1,4 +1,4 @@
1
- import {ColumnRelation, CopyAttr} from '../../libs/crud-pro/interfaces';
1
+ import { ColumnRelation, CopyAttr } from '../../libs/crud-pro/interfaces';
2
2
  import { ExecuteContext } from '../../libs/crud-pro/models/ExecuteContext';
3
3
  import { KeyOfCrudTypes } from '../../libs/crud-pro/models/keys';
4
4
  import { MixinUtils } from '../../libs/crud-pro/utils/MixinUtils';
@@ -33,7 +33,7 @@ function getColumnsRelationAll(sqlCfg: SqlCfgModel, cfgModel: RequestCfgModel):
33
33
 
34
34
 
35
35
 
36
- function copyBySingleSourceValue(row: any, sourceValue:any, targetColumns: CopyAttr[], getValue: any ){
36
+ function copyBySingleSourceValue(row: any, sourceValue: any, targetColumns: CopyAttr[], getValue: any) {
37
37
  // const codeObject = map.get(sourceValue);
38
38
  const codeObject = getValue(sourceValue);
39
39
  if (typeof codeObject === 'undefined' || codeObject === null) {
@@ -59,7 +59,7 @@ function copyBySingleSourceValue(row: any, sourceValue:any, targetColumns: CopyA
59
59
 
60
60
 
61
61
 
62
- function copyByArraySourceValue(row: any, sourceValue:any, targetColumns: CopyAttr[], getValue: any ): boolean {
62
+ function copyByArraySourceValue(row: any, sourceValue: any, targetColumns: CopyAttr[], getValue: any): boolean {
63
63
  let isSetArray = false;
64
64
  // 支持关联JSON数组
65
65
  if (typeof sourceValue === 'string' && sourceValue.startsWith('[') && sourceValue.endsWith(']')) {
@@ -80,15 +80,12 @@ function copyByArraySourceValue(row: any, sourceValue:any, targetColumns: CopyAt
80
80
  _.set(row, toStr, codeObject);
81
81
 
82
82
  isSetArray = true;
83
-
84
83
  } else {
85
-
86
84
  const dictAttrValue = _.get(codeObject, targetColumn.from);
87
- if (typeof dictAttrValue !== "undefined" && dictAttrValue !== null) {
85
+ if (typeof dictAttrValue !== 'undefined' && dictAttrValue !== null) {
88
86
  const toStr = targetColumn.to.replace('$ARRAY_INDEX', `${codeIndex}`);
89
87
  _.set(row, toStr, dictAttrValue);
90
88
  isSetArray = true;
91
-
92
89
  }
93
90
  }
94
91
  }
@@ -101,8 +98,6 @@ function copyByArraySourceValue(row: any, sourceValue:any, targetColumns: CopyAt
101
98
  return isSetArray;
102
99
  }
103
100
 
104
-
105
-
106
101
  class CrudMixUtils {
107
102
  private readonly relatedType: RelatedType;
108
103
  constructor(relatedType: RelatedType) {
@@ -134,7 +129,7 @@ class CrudMixUtils {
134
129
  }
135
130
  }
136
131
  }
137
- return _.uniqBy(relationResult,(obj: ColumnRelation)=> {
132
+ return _.uniqBy(relationResult, (obj: ColumnRelation) => {
138
133
  return `${obj.relatedCode}_${obj.relatedType}_${obj.sourceColumn}_${JSON.stringify(obj.targetColumns)}`;
139
134
  });
140
135
  }
@@ -191,7 +186,7 @@ class CrudMixUtils {
191
186
  }
192
187
 
193
188
  const sourceValue = _.get(row, sourceColumn);
194
- if (typeof sourceValue ==='undefined' || sourceValue ===null) {
189
+ if (typeof sourceValue === 'undefined' || sourceValue === null) {
195
190
  return;
196
191
  }
197
192
 
@@ -216,7 +211,7 @@ class CrudMixUtils {
216
211
  * @param columnRelation
217
212
  */
218
213
  public copyColumnRelationToRowNoRelatedCode(row: any, map: Map<string, any>, columnRelation: ColumnRelation) {
219
- const {sourceColumn, targetColumns} = columnRelation;
214
+ const { sourceColumn, targetColumns } = columnRelation;
220
215
  if (!sourceColumn || !targetColumns) {
221
216
  return;
222
217
  }
@@ -243,6 +238,41 @@ class CrudMixUtils {
243
238
 
244
239
  }
245
240
 
241
+
242
+ /**
243
+ * 专门COPY用户信息到row上面。无relatedCode模式
244
+ * @param row
245
+ * @param map
246
+ * @param columnRelation
247
+ */
248
+ public copyUserInfoToRowNoRelatedCode(row: any, map: Map<string, any>, columnRelation: ColumnRelation) {
249
+ const { targetColumns } = columnRelation;
250
+ if (!targetColumns) {
251
+ return;
252
+ }
253
+
254
+ const tmpSourceColumn = '__fatcmsUserAccountId__';
255
+
256
+ const sourceValue = _.get(row, tmpSourceColumn);
257
+ if (!sourceValue) {
258
+ return;
259
+ }
260
+
261
+ const getValue = (code: string) => {
262
+ if (!map) {
263
+ return null;
264
+ }
265
+ if (typeof map.get === 'function') {
266
+ return map.get(`${code}`);
267
+ }
268
+ return map[code];
269
+ };
270
+
271
+ const isSetArray = copyByArraySourceValue(row, sourceValue, targetColumns, getValue);
272
+ if (!isSetArray) {
273
+ copyBySingleSourceValue(row, sourceValue, targetColumns, getValue);
274
+ }
275
+ }
246
276
  }
247
277
 
248
278
  export { CrudMixUtils, RelatedType, FuncRowColumnRelation };
@@ -5,7 +5,7 @@ import { BaseService } from '../base/BaseService';
5
5
  import { getRouteTrie, RouteTrie } from './RouteTrie';
6
6
  import { RouteHandler } from './RouteHandler';
7
7
  import { CurdProService } from '../curd/CurdProService';
8
- import {SystemDbName, SystemDbType, SystemTables} from '../../models/SystemTables';
8
+ import { SystemTables} from '../../models/SystemTables';
9
9
  import { KeysOfSimpleSQL } from '../../libs/crud-pro/models/keys';
10
10
  import { IProxyApiEntity, IUpstreamInfo } from '../../models/SystemEntities';
11
11
  import { parseJsonObject } from '../../libs/utils/functions';
@@ -15,6 +15,7 @@ import { WeightedRoundRobin } from './WeightedRoundRobin';
15
15
  import { IScheduleService } from '../../interface';
16
16
  import { WorkbenchService } from '../WorkbenchService';
17
17
  import { CommonException } from '../../libs/crud-pro/exceptions';
18
+ import { GLOBAL_STATIC_CONFIG } from '@/libs/global-config/global-config';
18
19
 
19
20
  function toUpstreamInfo(config_content: any): IUpstreamInfo {
20
21
  const obj = parseJsonObject(config_content);
@@ -85,6 +86,9 @@ export class ProxyApiLoadService extends BaseService implements IScheduleService
85
86
  }
86
87
 
87
88
  private async buildUpstreamMap() {
89
+
90
+ const { SystemDbName, SystemDbType } = GLOBAL_STATIC_CONFIG.getConfig();
91
+
88
92
  // biz_tag={'upstream'}
89
93
  const res = await this.curdProService.executeCrudByCfg(
90
94
  {
@@ -110,6 +114,10 @@ export class ProxyApiLoadService extends BaseService implements IScheduleService
110
114
  }
111
115
 
112
116
  private async loadProxyApiEntity(workbench_code: string, upstreamMap: Record<string, IUpstreamInfo>): Promise<IProxyApiEntity[]> {
117
+
118
+ const { SystemDbName, SystemDbType } = GLOBAL_STATIC_CONFIG.getConfig();
119
+
120
+
113
121
  const res = await this.curdProService.executeCrudByCfg(
114
122
  {
115
123
  condition: {},
@@ -0,0 +1,31 @@
1
+ <html dir="ltr" lang="zh">
2
+ <head>
3
+ <meta charset="utf-8">
4
+ <meta name="color-scheme" content="light dark">
5
+ <meta name="theme-color" content="#fff">
6
+ <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
7
+ <title>无法访问此应用</title>
8
+ <link rel="stylesheet" href="https://cdnjsx.oss-cn-shanghai.aliyuncs.com/styles/chrome-error.css">
9
+ </head>
10
+ <body class="neterror" style="font-family: system-ui,PingFang SC,STHeiti,sans-serif; font-size: 75%">
11
+
12
+ <div id="content">
13
+ <div id="main-frame-error" class="interstitial-wrapper ">
14
+ <div id="main-content">
15
+ <div class="icon icon-generic"></div>
16
+ <div id="main-message">
17
+ <h1><span>无法访问此应用</span></h1>
18
+ <p>此应用存在如下可能的状态导致无法访问:应用不存在、应用已下线、站点不支持</p>
19
+ <p>appCode: <%=appCode%></p>
20
+ <div>
21
+ <p>errorMsg: <%=errorMsg%></p>
22
+ </div>
23
+ </div>
24
+ </div>
25
+ </div>
26
+ </div>
27
+
28
+ </body>
29
+ </html>
30
+
31
+
@@ -0,0 +1,34 @@
1
+ <html dir="ltr" lang="zh">
2
+ <head>
3
+ <meta charset="utf-8">
4
+ <meta name="color-scheme" content="light dark">
5
+ <meta name="theme-color" content="#fff">
6
+ <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
7
+ <title>无法访问此网站</title>
8
+ <link rel="stylesheet" href="https://cdnjsx.oss-cn-shanghai.aliyuncs.com/styles/chrome-error.css">
9
+ </head>
10
+ <body class="neterror" style="font-family: system-ui,PingFang SC,STHeiti,sans-serif; font-size: 75%">
11
+
12
+ <div id="content">
13
+ <div id="main-frame-error" class="interstitial-wrapper ">
14
+ <div id="main-content">
15
+ <div class="icon icon-generic"></div>
16
+ <div id="main-message">
17
+ <h1>
18
+ <span>无法访问此网站</span>
19
+ </h1>
20
+ <p>检查 <span id="domain_span"><%-host%></span> 中是否有拼写错误。</p>
21
+ <div class="error-code" style="text-transform: none;"><%-errorInfo%></div>
22
+ </div>
23
+ </div>
24
+ </div>
25
+ </div>
26
+ <script>
27
+ setTimeout(function () {
28
+ document.getElementById('domain_span').innerHTML = location.host
29
+ }, 10)
30
+ </script>
31
+ </body>
32
+ </html>
33
+
34
+
Binary file
@@ -1,35 +0,0 @@
1
- import { Context } from '@midwayjs/koa';
2
- import { BaseApiController } from '../base/BaseApiController';
3
- import { AuthService } from '../../service/AuthService';
4
- import { CommonResult } from '../../libs/utils/common-dto';
5
- import { WorkbenchService } from "../../service/WorkbenchService";
6
- import { SysConfigService } from "../../service/SysConfigService";
7
- import { MedScoreService } from "./MedScoreService";
8
- import { MedMessageService } from "./MedMessageService";
9
- interface IUserRechargeRule {
10
- score: number;
11
- authentication_score: number;
12
- recharge_package: any[];
13
- vip_package: any[];
14
- }
15
- /**
16
- * medstatistic 管理端
17
- */
18
- export declare class MedAdminController extends BaseApiController {
19
- protected ctx: Context;
20
- protected authService: AuthService;
21
- protected workbenchService: WorkbenchService;
22
- protected sysConfigService: SysConfigService;
23
- protected medScoreService: MedScoreService;
24
- protected medMessageService: MedMessageService;
25
- /**
26
- * 审批后自动充值30个积分
27
- */
28
- recharge_by_authentication_success(): Promise<CommonResult>;
29
- /**
30
- * 将DB中的数据同步到Redis,因为PHP的程序需要。
31
- */
32
- sync_med_user_recharge_rule_to_redis(): Promise<CommonResult>;
33
- get_med_user_recharge_rule(): Promise<IUserRechargeRule>;
34
- }
35
- export {};
@@ -1,205 +0,0 @@
1
- "use strict";
2
- var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
- return c > 3 && r && Object.defineProperty(target, key, r), r;
7
- };
8
- var __metadata = (this && this.__metadata) || function (k, v) {
9
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
- };
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.MedAdminController = void 0;
13
- const core_1 = require("@midwayjs/core");
14
- const _ = require("lodash");
15
- const BaseApiController_1 = require("../base/BaseApiController");
16
- const AuthService_1 = require("../../service/AuthService");
17
- const common_dto_1 = require("../../libs/utils/common-dto");
18
- const WorkbenchService_1 = require("../../service/WorkbenchService");
19
- const permission_middleware_1 = require("../../middleware/permission.middleware");
20
- const SysConfigService_1 = require("../../service/SysConfigService");
21
- const functions_1 = require("../../libs/utils/functions");
22
- const exceptions_1 = require("../../libs/crud-pro/exceptions");
23
- const keys_1 = require("../../libs/crud-pro/models/keys");
24
- const ordernum_utils_1 = require("../../libs/utils/ordernum-utils");
25
- const MedScoreService_1 = require("./MedScoreService");
26
- const DateTimeUtils_1 = require("../../libs/crud-pro/utils/DateTimeUtils");
27
- const MedMessageService_1 = require("./MedMessageService");
28
- const constants_1 = require("./constants");
29
- const MED_STATISTIC_DB = "medstatistic";
30
- /**
31
- * medstatistic 管理端
32
- */
33
- let MedAdminController = class MedAdminController extends BaseApiController_1.BaseApiController {
34
- /**
35
- * 审批后自动充值30个积分
36
- */
37
- async recharge_by_authentication_success() {
38
- const body = this.ctx.request.body; // {user_id}
39
- const user_id = parseInt(body.user_id); // med的C端用户user_id
40
- if (!user_id) {
41
- throw new exceptions_1.CommonException("user_id不存在");
42
- }
43
- const authRes = await this.curdMixService.executeCrudByCfg({
44
- condition: {
45
- user_id: user_id,
46
- },
47
- }, {
48
- sqlSimpleName: keys_1.KeysOfSimpleSQL.SIMPLE_QUERY_ONE,
49
- sqlTable: "fa_user_authentication",
50
- sqlDatabase: MED_STATISTIC_DB,
51
- });
52
- const authResOne = authRes.getOneObj();
53
- if (!authResOne || `${authResOne.status}` !== '1') {
54
- throw new exceptions_1.CommonException("未提交认证资料或认证审批未通过");
55
- }
56
- const RECHARGE_TYPE_FOR_AUTH = '3';
57
- // 查询之前有没有通过积分认证获得积分
58
- const fa_user_rechargeRes = await this.curdMixService.executeCrudByCfg({
59
- condition: {
60
- user_id: user_id,
61
- type: RECHARGE_TYPE_FOR_AUTH
62
- },
63
- }, {
64
- sqlSimpleName: keys_1.KeysOfSimpleSQL.SIMPLE_QUERY_ONE,
65
- sqlTable: "fa_user_recharge",
66
- sqlDatabase: MED_STATISTIC_DB,
67
- });
68
- const fa_user_rechargeResOne = fa_user_rechargeRes.getOneObj();
69
- if (fa_user_rechargeResOne) {
70
- return common_dto_1.CommonResult.errorRes("用户已经获得认证积分");
71
- }
72
- const rechargeRule = await this.get_med_user_recharge_rule();
73
- // 插入充值记录
74
- await this.curdMixService.executeCrudByCfg({
75
- data: {
76
- user_id: user_id,
77
- type: RECHARGE_TYPE_FOR_AUTH,
78
- paid: 1,
79
- order_no: (0, ordernum_utils_1.generateOrderNumber)('CZ'),
80
- money: 0,
81
- score: rechargeRule.authentication_score,
82
- pay_time: DateTimeUtils_1.DateTimeUtils.getCurrentTimeStampSecond(),
83
- createtime: DateTimeUtils_1.DateTimeUtils.getCurrentTimeStampSecond(),
84
- },
85
- }, {
86
- sqlSimpleName: keys_1.KeysOfSimpleSQL.SIMPLE_INSERT,
87
- sqlTable: "fa_user_recharge",
88
- sqlDatabase: MED_STATISTIC_DB,
89
- });
90
- // 查询用户信息
91
- const userRes = await this.curdMixService.executeCrudByCfg({
92
- condition: {
93
- id: user_id,
94
- },
95
- }, {
96
- sqlSimpleName: keys_1.KeysOfSimpleSQL.SIMPLE_QUERY_ONE,
97
- sqlTable: "fa_user",
98
- sqlDatabase: MED_STATISTIC_DB,
99
- });
100
- const userOne = userRes.getOneObj();
101
- if (!userOne) {
102
- return common_dto_1.CommonResult.errorRes("用户信息没有查询到");
103
- }
104
- // 更新用户日志。
105
- await this.medScoreService.updateScore(user_id, MedScoreService_1.UpdateScorePM.increase, rechargeRule.authentication_score, "用户认证通过获得积分");
106
- // 更新认证状态
107
- await this.curdMixService.executeCrudByCfg({
108
- condition: {
109
- id: user_id,
110
- },
111
- data: {
112
- is_authentication: 1
113
- }
114
- }, {
115
- sqlSimpleName: keys_1.KeysOfSimpleSQL.SIMPLE_UPDATE,
116
- sqlTable: "fa_user",
117
- sqlDatabase: MED_STATISTIC_DB,
118
- });
119
- // 发送消息
120
- // title:string, content: string, received_by: string | number, msgObj: ISendUserReceivedMsg
121
- const title = "您的身份认证请求,已经审批通过";
122
- await this.medMessageService.insertMessage(title, title, user_id, {
123
- target_object_id: authResOne.id,
124
- target_object_type: constants_1.TARGET_OBJECT_TYPE_USER_AUTHENTICATION,
125
- msg_type: constants_1.MsgType.user_auth_pass
126
- });
127
- return common_dto_1.CommonResult.successMsg('用户认证审批通过获得积分' + rechargeRule.authentication_score);
128
- }
129
- /**
130
- * 将DB中的数据同步到Redis,因为PHP的程序需要。
131
- */
132
- async sync_med_user_recharge_rule_to_redis() {
133
- const ruleObj = await this.get_med_user_recharge_rule();
134
- await this.redisService.set("score", ruleObj.score);
135
- await this.redisService.set("authentication_score", ruleObj.authentication_score);
136
- await this.redisService.set("recharge_package", JSON.stringify(ruleObj.recharge_package.map((obj0) => {
137
- const obj = {};
138
- obj.score = "" + obj0.score;
139
- obj.price = "" + obj0.price;
140
- return obj;
141
- })));
142
- await this.redisService.set("vip_package", JSON.stringify(ruleObj.vip_package.map((obj0) => {
143
- const obj = {};
144
- obj.score = "" + obj0.score;
145
- obj.day = "" + obj0.day;
146
- return obj;
147
- })));
148
- return common_dto_1.CommonResult.successRes("SUCCESS");
149
- }
150
- async get_med_user_recharge_rule() {
151
- const rowObj = await this.sysConfigService.getSysConfigOne("med_user_recharge_rule");
152
- const configContentObj = (0, functions_1.parseJsonObject)(rowObj.config_content);
153
- const configContentData = configContentObj.data || {};
154
- const recharge_package = configContentData.recharge_package || [];
155
- const vip_package = configContentData.vip_package || [];
156
- const authentication_score = Number(_.get(configContentData, 'score_setting.authentication_score')) || 30;
157
- const score = Number(_.get(configContentData, 'score_setting.score')) || 1;
158
- return {
159
- score,
160
- authentication_score,
161
- recharge_package,
162
- vip_package
163
- };
164
- }
165
- };
166
- __decorate([
167
- (0, core_1.Inject)(),
168
- __metadata("design:type", Object)
169
- ], MedAdminController.prototype, "ctx", void 0);
170
- __decorate([
171
- (0, core_1.Inject)(),
172
- __metadata("design:type", AuthService_1.AuthService)
173
- ], MedAdminController.prototype, "authService", void 0);
174
- __decorate([
175
- (0, core_1.Inject)(),
176
- __metadata("design:type", WorkbenchService_1.WorkbenchService)
177
- ], MedAdminController.prototype, "workbenchService", void 0);
178
- __decorate([
179
- (0, core_1.Inject)(),
180
- __metadata("design:type", SysConfigService_1.SysConfigService)
181
- ], MedAdminController.prototype, "sysConfigService", void 0);
182
- __decorate([
183
- (0, core_1.Inject)(),
184
- __metadata("design:type", MedScoreService_1.MedScoreService)
185
- ], MedAdminController.prototype, "medScoreService", void 0);
186
- __decorate([
187
- (0, core_1.Inject)(),
188
- __metadata("design:type", MedMessageService_1.MedMessageService)
189
- ], MedAdminController.prototype, "medMessageService", void 0);
190
- __decorate([
191
- (0, core_1.Post)('/recharge_by_authentication_success', { middleware: [(0, permission_middleware_1.checkPermission)("BizOperationUserAdmin")] }),
192
- __metadata("design:type", Function),
193
- __metadata("design:paramtypes", []),
194
- __metadata("design:returntype", Promise)
195
- ], MedAdminController.prototype, "recharge_by_authentication_success", null);
196
- __decorate([
197
- (0, core_1.Post)('/sync_med_user_recharge_rule_to_redis', { middleware: [(0, permission_middleware_1.checkPermission)("BizOperationUserAdmin")] }),
198
- __metadata("design:type", Function),
199
- __metadata("design:paramtypes", []),
200
- __metadata("design:returntype", Promise)
201
- ], MedAdminController.prototype, "sync_med_user_recharge_rule_to_redis", null);
202
- MedAdminController = __decorate([
203
- (0, core_1.Controller)('/ns/api/medadmin')
204
- ], MedAdminController);
205
- exports.MedAdminController = MedAdminController;
@@ -1,28 +0,0 @@
1
- import { Context } from '@midwayjs/koa';
2
- import { BaseApiController } from '../base/BaseApiController';
3
- import { AuthService } from '../../service/AuthService';
4
- import { CommonResult } from '../../libs/utils/common-dto';
5
- import { WorkbenchService } from "../../service/WorkbenchService";
6
- import { MedMessageService } from "./MedMessageService";
7
- import { CurdProService } from "../../service/curd/CurdProService";
8
- /**
9
- * medstatistic 用户端
10
- */
11
- export declare class MedClientController extends BaseApiController {
12
- protected ctx: Context;
13
- protected authService: AuthService;
14
- protected workbenchService: WorkbenchService;
15
- protected curdProService: CurdProService;
16
- protected medMessageService: MedMessageService;
17
- /**
18
- * 充值
19
- */
20
- recharge(): Promise<CommonResult>;
21
- /**
22
- * 获取用户收到的消息。只需要登录即可
23
- */
24
- send_user_received_message(): Promise<CommonResult>;
25
- private get_fa_contact;
26
- private getBBSTopic;
27
- private getBBSReply;
28
- }