refactor: 重构项目结构并优化类型定义
- 移除extension模块,将功能迁移至node-agent - 修复类型导出问题,使用export type明确类型导出 - 统一数据库连接方式,从直接导入改为使用config/database - 更新文档中的项目结构描述 - 添加多个服务的实用方法,如getForecast、getBalances等 - 修复类型错误和TS1205警告 - 优化RedisService调用方式 - 添加新的实体类型定义 - 更新审计日志格式,统一字段命名
This commit is contained in:
@@ -7,7 +7,7 @@
|
||||
import db from '../config/database';
|
||||
import { logger } from '../utils/logger';
|
||||
import { EventBusService } from './EventBusService';
|
||||
import { RedisService } from './RedisService';
|
||||
import RedisService from './RedisService';
|
||||
|
||||
// 自动化等级 (L1-L4)
|
||||
export type AutomationLevel = 'L1' | 'L2' | 'L3' | 'L4';
|
||||
@@ -532,11 +532,14 @@ export class AutoExecutionConfigService {
|
||||
}
|
||||
|
||||
// 发布事件
|
||||
await EventBusService.publish('auto_execution.config_updated', {
|
||||
configId,
|
||||
updates,
|
||||
userId,
|
||||
timestamp: new Date(),
|
||||
await EventBusService.publish({
|
||||
type: 'auto_execution.config_updated',
|
||||
data: {
|
||||
configId,
|
||||
updates,
|
||||
userId,
|
||||
timestamp: new Date(),
|
||||
}
|
||||
});
|
||||
|
||||
logger.info(`[AutoExecutionConfig] Updated config ${configId}`);
|
||||
@@ -642,14 +645,17 @@ export class AutoExecutionConfigService {
|
||||
});
|
||||
|
||||
// 发布事件
|
||||
await EventBusService.publish('auto_execution.level_upgraded', {
|
||||
tenantId,
|
||||
shopId,
|
||||
module,
|
||||
fromLevel: currentLevel,
|
||||
toLevel: targetLevel,
|
||||
approvedBy,
|
||||
timestamp: new Date(),
|
||||
await EventBusService.publish({
|
||||
type: 'auto_execution.level_upgraded',
|
||||
data: {
|
||||
tenantId,
|
||||
shopId,
|
||||
module,
|
||||
fromLevel: currentLevel,
|
||||
toLevel: targetLevel,
|
||||
approvedBy,
|
||||
timestamp: new Date(),
|
||||
}
|
||||
});
|
||||
|
||||
logger.info(`[AutoExecutionConfig] Upgraded ${module} from ${currentLevel} to ${targetLevel}`);
|
||||
@@ -710,15 +716,18 @@ export class AutoExecutionConfigService {
|
||||
});
|
||||
|
||||
// 发布事件
|
||||
await EventBusService.publish('auto_execution.level_downgraded', {
|
||||
tenantId,
|
||||
shopId,
|
||||
module,
|
||||
fromLevel: currentLevel,
|
||||
toLevel: targetLevel,
|
||||
approvedBy,
|
||||
reason,
|
||||
timestamp: new Date(),
|
||||
await EventBusService.publish({
|
||||
type: 'auto_execution.level_downgraded',
|
||||
data: {
|
||||
tenantId,
|
||||
shopId,
|
||||
module,
|
||||
fromLevel: currentLevel,
|
||||
toLevel: targetLevel,
|
||||
approvedBy,
|
||||
reason,
|
||||
timestamp: new Date(),
|
||||
}
|
||||
});
|
||||
|
||||
logger.info(`[AutoExecutionConfig] Downgraded ${module} from ${currentLevel} to ${targetLevel}`);
|
||||
|
||||
Reference in New Issue
Block a user