midway-fatcms 0.0.1-beta.4 → 0.0.1-beta.5
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/controller/manage/UserAccountManageApi.d.ts +1 -1
- package/dist/index.d.ts +26 -4
- package/dist/index.js +26 -4
- package/package.json +1 -1
- package/src/index.ts +32 -4
- 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.d.ts
CHANGED
|
@@ -30,10 +30,6 @@ export * from './controller/manage/SysConfigMangeApi';
|
|
|
30
30
|
export * from './controller/manage/SystemInfoManageApi';
|
|
31
31
|
export * from './controller/manage/UserAccountManageApi';
|
|
32
32
|
export * from './controller/manage/WorkbenchMangeApi';
|
|
33
|
-
export * from './controller/medstatistic/MedAdminController';
|
|
34
|
-
export * from './controller/medstatistic/MedClientController';
|
|
35
|
-
export * from './controller/medstatistic/MedMessageService';
|
|
36
|
-
export * from './controller/medstatistic/MedScoreService';
|
|
37
33
|
export * from './controller/myinfo/AuthController';
|
|
38
34
|
export * from './controller/myinfo/MyInfoController';
|
|
39
35
|
export * from './controller/render/AppRenderController';
|
|
@@ -69,3 +65,29 @@ export * from './service/curd/CurdMixService';
|
|
|
69
65
|
export * from './service/curd/CurdProService';
|
|
70
66
|
export * from './service/proxyapi/ProxyApiLoadService';
|
|
71
67
|
export * from './service/proxyapi/ProxyApiService';
|
|
68
|
+
export * from './models/userSession';
|
|
69
|
+
export * from './models/bizmodels';
|
|
70
|
+
export * from './models/SystemEntities';
|
|
71
|
+
export * from './models/SystemPerm';
|
|
72
|
+
export * from './models/contextLogger';
|
|
73
|
+
export * from './models/devops';
|
|
74
|
+
export * from './models/SystemTables';
|
|
75
|
+
export * from './libs/utils/common-dto';
|
|
76
|
+
export * from './libs/utils/crypto-utils';
|
|
77
|
+
export * from './libs/utils/fatcms-request';
|
|
78
|
+
export * from './libs/utils/functions';
|
|
79
|
+
export * from './libs/utils/ordernum-utils';
|
|
80
|
+
export * from './libs/utils/parseConfig';
|
|
81
|
+
export * from './libs/crud-pro/CrudPro';
|
|
82
|
+
export * from './libs/crud-pro/defaultConfigs';
|
|
83
|
+
export * from './libs/crud-pro/exceptions';
|
|
84
|
+
export * from './libs/crud-pro/interfaces';
|
|
85
|
+
export * from './libs/crud-pro/models/ExecuteContext';
|
|
86
|
+
export * from './libs/crud-pro/models/FuncContext';
|
|
87
|
+
export * from './libs/crud-pro/models/RequestModel';
|
|
88
|
+
export * from './libs/crud-pro/models/SqlCfgModel';
|
|
89
|
+
export * from './libs/crud-pro/models/Transaction';
|
|
90
|
+
export * from './libs/crud-pro/models/keys';
|
|
91
|
+
export * from './libs/crud-pro/models/ExecuteContextFunc';
|
|
92
|
+
export * from './libs/crud-pro/models/RequestCfgModel';
|
|
93
|
+
export * from './libs/crud-pro/models/SqlSegArg';
|
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);
|
|
@@ -87,3 +83,29 @@ __exportStar(require("./service/curd/CurdMixService"), exports);
|
|
|
87
83
|
__exportStar(require("./service/curd/CurdProService"), exports);
|
|
88
84
|
__exportStar(require("./service/proxyapi/ProxyApiLoadService"), exports);
|
|
89
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);
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -30,10 +30,6 @@ export * from './controller/manage/SysConfigMangeApi';
|
|
|
30
30
|
export * from './controller/manage/SystemInfoManageApi';
|
|
31
31
|
export * from './controller/manage/UserAccountManageApi';
|
|
32
32
|
export * from './controller/manage/WorkbenchMangeApi';
|
|
33
|
-
export * from './controller/medstatistic/MedAdminController';
|
|
34
|
-
export * from './controller/medstatistic/MedClientController';
|
|
35
|
-
export * from './controller/medstatistic/MedMessageService';
|
|
36
|
-
export * from './controller/medstatistic/MedScoreService';
|
|
37
33
|
export * from './controller/myinfo/AuthController';
|
|
38
34
|
export * from './controller/myinfo/MyInfoController';
|
|
39
35
|
export * from './controller/render/AppRenderController';
|
|
@@ -69,3 +65,35 @@ export * from './service/curd/CurdMixService';
|
|
|
69
65
|
export * from './service/curd/CurdProService';
|
|
70
66
|
export * from './service/proxyapi/ProxyApiLoadService';
|
|
71
67
|
export * from './service/proxyapi/ProxyApiService';
|
|
68
|
+
export * from './models/userSession';
|
|
69
|
+
export * from './models/bizmodels';
|
|
70
|
+
export * from './models/SystemEntities';
|
|
71
|
+
export * from './models/SystemPerm';
|
|
72
|
+
export * from './models/contextLogger';
|
|
73
|
+
export * from './models/devops';
|
|
74
|
+
export * from './models/SystemTables';
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
export * from './libs/utils/common-dto';
|
|
78
|
+
export * from './libs/utils/crypto-utils';
|
|
79
|
+
export * from './libs/utils/fatcms-request';
|
|
80
|
+
export * from './libs/utils/functions';
|
|
81
|
+
export * from './libs/utils/ordernum-utils';
|
|
82
|
+
export * from './libs/utils/parseConfig';
|
|
83
|
+
|
|
84
|
+
export * from './libs/crud-pro/CrudPro';
|
|
85
|
+
export * from './libs/crud-pro/defaultConfigs';
|
|
86
|
+
export * from './libs/crud-pro/exceptions';
|
|
87
|
+
export * from './libs/crud-pro/interfaces';
|
|
88
|
+
|
|
89
|
+
export * from './libs/crud-pro/models/ExecuteContext';
|
|
90
|
+
export * from './libs/crud-pro/models/FuncContext';
|
|
91
|
+
export * from './libs/crud-pro/models/RequestModel';
|
|
92
|
+
export * from './libs/crud-pro/models/SqlCfgModel';
|
|
93
|
+
export * from './libs/crud-pro/models/Transaction';
|
|
94
|
+
export * from './libs/crud-pro/models/keys';
|
|
95
|
+
export * from './libs/crud-pro/models/ExecuteContextFunc';
|
|
96
|
+
export * from './libs/crud-pro/models/RequestCfgModel';
|
|
97
|
+
export * from './libs/crud-pro/models/SqlSegArg';
|
|
98
|
+
|
|
99
|
+
|
|
@@ -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
|
-
}
|
|
@@ -1,188 +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.MedClientController = void 0;
|
|
13
|
-
const core_1 = require("@midwayjs/core");
|
|
14
|
-
const BaseApiController_1 = require("../base/BaseApiController");
|
|
15
|
-
const AuthService_1 = require("../../service/AuthService");
|
|
16
|
-
const common_dto_1 = require("../../libs/utils/common-dto");
|
|
17
|
-
const WorkbenchService_1 = require("../../service/WorkbenchService");
|
|
18
|
-
const keys_1 = require("../../libs/crud-pro/models/keys");
|
|
19
|
-
const MedMessageService_1 = require("./MedMessageService");
|
|
20
|
-
const CurdProService_1 = require("../../service/curd/CurdProService");
|
|
21
|
-
const constants_1 = require("./constants");
|
|
22
|
-
const permission_middleware_1 = require("../../middleware/permission.middleware");
|
|
23
|
-
const MED_STATISTIC_DB = "medstatistic";
|
|
24
|
-
/**
|
|
25
|
-
* medstatistic 用户端
|
|
26
|
-
*/
|
|
27
|
-
let MedClientController = class MedClientController extends BaseApiController_1.BaseApiController {
|
|
28
|
-
/**
|
|
29
|
-
* 充值
|
|
30
|
-
*/
|
|
31
|
-
async recharge() {
|
|
32
|
-
// const body = this.ctx.request.body as any; // {user_id}
|
|
33
|
-
// const pay_type = body.pay_type; // 类型:1=微信,2=支付宝,3=授权
|
|
34
|
-
// const recharge_type = body.recharge_type; // 充值方式:1=套餐,2=自定义积分
|
|
35
|
-
// const package_price = body.package_price; // 套餐充值 package_price 元人民币
|
|
36
|
-
// const custom_score = body.custom_score; // 自定义充值 custom_score 元人民币
|
|
37
|
-
//
|
|
38
|
-
//
|
|
39
|
-
return null;
|
|
40
|
-
}
|
|
41
|
-
/**
|
|
42
|
-
* 获取用户收到的消息。只需要登录即可
|
|
43
|
-
*/
|
|
44
|
-
async send_user_received_message() {
|
|
45
|
-
const msgObj = this.ctx.request.body; // {user_id}
|
|
46
|
-
const { msg_type, target_object_id, target_object_type } = msgObj || {};
|
|
47
|
-
// title:string, content: string, received_by: string | number, msgObj: ISendUserReceivedMsg
|
|
48
|
-
if (target_object_type === constants_1.TARGET_OBJECT_TYPE_BBS_TOPIC) {
|
|
49
|
-
const topicObj = await this.getBBSTopic(target_object_id);
|
|
50
|
-
// 点赞了一篇帖子,发送消息 给作者
|
|
51
|
-
if (msg_type === constants_1.MsgType.bbs_post_be_like) {
|
|
52
|
-
const title = "您的帖子收到了点赞";
|
|
53
|
-
const content = `《${topicObj.title}》`;
|
|
54
|
-
await this.medMessageService.insertMessage(title, content, topicObj.created_by, msgObj);
|
|
55
|
-
return common_dto_1.CommonResult.successRes("OK");
|
|
56
|
-
}
|
|
57
|
-
// 回复了一篇帖子,发送消息 给作者
|
|
58
|
-
if (msg_type === constants_1.MsgType.bbs_post_be_reply) {
|
|
59
|
-
const title = "您的帖子收到了回复";
|
|
60
|
-
const content = `《${topicObj.title}》`;
|
|
61
|
-
await this.medMessageService.insertMessage(title, content, topicObj.created_by, msgObj);
|
|
62
|
-
return common_dto_1.CommonResult.successRes("OK");
|
|
63
|
-
}
|
|
64
|
-
// 回复帖子被判定为违规
|
|
65
|
-
if (msg_type === constants_1.MsgType.bbs_post_be_violation) {
|
|
66
|
-
const title = "您的帖子被判定为违规";
|
|
67
|
-
const content = `《${topicObj.title}》`;
|
|
68
|
-
await this.medMessageService.insertMessage(title, content, topicObj.created_by, msgObj);
|
|
69
|
-
return common_dto_1.CommonResult.successRes("OK");
|
|
70
|
-
}
|
|
71
|
-
// 您的帖子被收藏
|
|
72
|
-
if (msg_type === constants_1.MsgType.bbs_post_be_favorite) {
|
|
73
|
-
const title = "您的帖子被收藏";
|
|
74
|
-
const content = `《${topicObj.title}》`;
|
|
75
|
-
await this.medMessageService.insertMessage(title, content, topicObj.created_by, msgObj);
|
|
76
|
-
return common_dto_1.CommonResult.successRes("OK");
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
if (target_object_type === constants_1.TARGET_OBJECT_TYPE_BBS_REPLY) {
|
|
80
|
-
const topicObj = await this.getBBSReply(target_object_id);
|
|
81
|
-
// 点赞了一篇帖子,发送消息 给作者
|
|
82
|
-
if (msg_type === constants_1.MsgType.bbs_reply_be_like) {
|
|
83
|
-
const title = "您的评论收到了点赞";
|
|
84
|
-
const content = `《${topicObj.title}》`;
|
|
85
|
-
await this.medMessageService.insertMessage(title, content, topicObj.created_by, msgObj);
|
|
86
|
-
return common_dto_1.CommonResult.successRes("OK");
|
|
87
|
-
}
|
|
88
|
-
// 回复了一篇帖子,发送消息 给作者
|
|
89
|
-
if (msg_type === constants_1.MsgType.bbs_reply_be_reply) {
|
|
90
|
-
const title = "您的评论收到了回复";
|
|
91
|
-
const content = `《${topicObj.title}》`;
|
|
92
|
-
await this.medMessageService.insertMessage(title, content, topicObj.created_by, msgObj);
|
|
93
|
-
return common_dto_1.CommonResult.successRes("OK");
|
|
94
|
-
}
|
|
95
|
-
// 回复帖子被判定为违规
|
|
96
|
-
if (msg_type === constants_1.MsgType.bbs_reply_be_violation) {
|
|
97
|
-
const title = "您的评论被判定为违规";
|
|
98
|
-
const content = `《${topicObj.title}》`;
|
|
99
|
-
await this.medMessageService.insertMessage(title, content, topicObj.created_by, msgObj);
|
|
100
|
-
return common_dto_1.CommonResult.successRes("OK");
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
// 联系我们 收到了回复
|
|
104
|
-
if (msg_type === constants_1.MsgType.contact_us_be_reply) {
|
|
105
|
-
const contactObj = await this.get_fa_contact(target_object_id);
|
|
106
|
-
this.logInfo("contact_us_be_reply==> " + JSON.stringify(contactObj));
|
|
107
|
-
if (contactObj && contactObj.created_by) {
|
|
108
|
-
const title = "您的主动联系收到了回复";
|
|
109
|
-
const content = contactObj.mark || "";
|
|
110
|
-
await this.medMessageService.insertMessage(title, content, contactObj.created_by, msgObj);
|
|
111
|
-
return common_dto_1.CommonResult.successRes("OK");
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
return common_dto_1.CommonResult.successRes("NULL");
|
|
115
|
-
}
|
|
116
|
-
async get_fa_contact(fa_contact_id) {
|
|
117
|
-
const topicRes = await this.curdMixService.executeCrudByCfg({
|
|
118
|
-
condition: {
|
|
119
|
-
id: fa_contact_id,
|
|
120
|
-
},
|
|
121
|
-
}, {
|
|
122
|
-
sqlSimpleName: keys_1.KeysOfSimpleSQL.SIMPLE_QUERY_ONE,
|
|
123
|
-
sqlTable: "fa_contact",
|
|
124
|
-
sqlDatabase: MED_STATISTIC_DB,
|
|
125
|
-
});
|
|
126
|
-
return topicRes.getOneObj();
|
|
127
|
-
}
|
|
128
|
-
async getBBSTopic(topicId) {
|
|
129
|
-
const topicRes = await this.curdMixService.executeCrudByCfg({
|
|
130
|
-
condition: {
|
|
131
|
-
id: topicId,
|
|
132
|
-
},
|
|
133
|
-
}, {
|
|
134
|
-
sqlSimpleName: keys_1.KeysOfSimpleSQL.SIMPLE_QUERY_ONE,
|
|
135
|
-
sqlTable: "fatbiz_bbs_topic",
|
|
136
|
-
sqlDatabase: MED_STATISTIC_DB,
|
|
137
|
-
});
|
|
138
|
-
return topicRes.getOneObj();
|
|
139
|
-
}
|
|
140
|
-
async getBBSReply(replyId) {
|
|
141
|
-
const topicRes = await this.curdMixService.executeCrudByCfg({
|
|
142
|
-
condition: {
|
|
143
|
-
id: replyId,
|
|
144
|
-
},
|
|
145
|
-
}, {
|
|
146
|
-
sqlSimpleName: keys_1.KeysOfSimpleSQL.SIMPLE_QUERY_ONE,
|
|
147
|
-
sqlTable: "fatbiz_bbs_replies",
|
|
148
|
-
sqlDatabase: MED_STATISTIC_DB,
|
|
149
|
-
});
|
|
150
|
-
return topicRes.getOneObj();
|
|
151
|
-
}
|
|
152
|
-
};
|
|
153
|
-
__decorate([
|
|
154
|
-
(0, core_1.Inject)(),
|
|
155
|
-
__metadata("design:type", Object)
|
|
156
|
-
], MedClientController.prototype, "ctx", void 0);
|
|
157
|
-
__decorate([
|
|
158
|
-
(0, core_1.Inject)(),
|
|
159
|
-
__metadata("design:type", AuthService_1.AuthService)
|
|
160
|
-
], MedClientController.prototype, "authService", void 0);
|
|
161
|
-
__decorate([
|
|
162
|
-
(0, core_1.Inject)(),
|
|
163
|
-
__metadata("design:type", WorkbenchService_1.WorkbenchService)
|
|
164
|
-
], MedClientController.prototype, "workbenchService", void 0);
|
|
165
|
-
__decorate([
|
|
166
|
-
(0, core_1.Inject)(),
|
|
167
|
-
__metadata("design:type", CurdProService_1.CurdProService)
|
|
168
|
-
], MedClientController.prototype, "curdProService", void 0);
|
|
169
|
-
__decorate([
|
|
170
|
-
(0, core_1.Inject)(),
|
|
171
|
-
__metadata("design:type", MedMessageService_1.MedMessageService)
|
|
172
|
-
], MedClientController.prototype, "medMessageService", void 0);
|
|
173
|
-
__decorate([
|
|
174
|
-
(0, core_1.Post)('/recharge'),
|
|
175
|
-
__metadata("design:type", Function),
|
|
176
|
-
__metadata("design:paramtypes", []),
|
|
177
|
-
__metadata("design:returntype", Promise)
|
|
178
|
-
], MedClientController.prototype, "recharge", null);
|
|
179
|
-
__decorate([
|
|
180
|
-
(0, core_1.Post)('/send_user_received_message'),
|
|
181
|
-
__metadata("design:type", Function),
|
|
182
|
-
__metadata("design:paramtypes", []),
|
|
183
|
-
__metadata("design:returntype", Promise)
|
|
184
|
-
], MedClientController.prototype, "send_user_received_message", null);
|
|
185
|
-
MedClientController = __decorate([
|
|
186
|
-
(0, core_1.Controller)('/ns/api/medclient', { middleware: [(0, permission_middleware_1.checkLogin)()] })
|
|
187
|
-
], MedClientController);
|
|
188
|
-
exports.MedClientController = MedClientController;
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { Context } from '@midwayjs/koa';
|
|
2
|
-
import { AuthService } from '../../service/AuthService';
|
|
3
|
-
import { WorkbenchService } from "../../service/WorkbenchService";
|
|
4
|
-
import { SysConfigService } from "../../service/SysConfigService";
|
|
5
|
-
import { BaseService } from "../../service/base/BaseService";
|
|
6
|
-
import { CurdProService } from "../../service/curd/CurdProService";
|
|
7
|
-
import { ISendUserReceivedMsg } from "./constants";
|
|
8
|
-
/**
|
|
9
|
-
* medstatistic 管理端
|
|
10
|
-
*/
|
|
11
|
-
export declare class MedMessageService extends BaseService {
|
|
12
|
-
protected ctx: Context;
|
|
13
|
-
protected authService: AuthService;
|
|
14
|
-
protected workbenchService: WorkbenchService;
|
|
15
|
-
protected sysConfigService: SysConfigService;
|
|
16
|
-
protected curdProService: CurdProService;
|
|
17
|
-
insertMessage(title: string, content: string, received_by: string | number, msgObj: ISendUserReceivedMsg): Promise<any>;
|
|
18
|
-
private insertMessageInner;
|
|
19
|
-
}
|