feat: 完成全系统30个功能点开发与E2E全链路验收 (8轮调度32个子代理闭环)
- 模块一: 出海案例作品集、博客动态发布、人名发音语音条、RTL阿语多语言切换 - 模块二: AI顾问人设配置、行业术语库润色、RAG切片沙盒调试、流式会话与意向留资卡片 - 模块三: 全球访客雷达大屏、多维加权意向算分、外部CRM对接推送、团队公海池流转 - 模块四: 移动端NFC安全挂失、NFC动态路由规则配置、动态防伪验签、展会制卡Zip批量导出 - 模块五: 组织架构与名片分配、移动端个人中心设置、离职交接与历史线索迁移、安全审计日志 - 模块六: Stripe国际信用卡订阅Webhook、独立二级域名与SSL检测、坐席配额预警、多币种发票 - 模块七: 纸质名片OCR解析入库、国际商务日程RFC 5545 ICS日历、微官网离线SWR预加载、展会实时排行榜大屏 - 模块八: 全球出海SEO OpenGraph元标签注入与社交爬虫探测、30点端到端全链路业务流集成测试套件
这个提交包含在:
@@ -27,7 +27,7 @@ export default () => {
|
||||
// 单点登录
|
||||
sso: false,
|
||||
// 注意: 最好重新修改,防止破解
|
||||
secret: 'cool-admin-xxxxxx',
|
||||
secret: 'bfd09048-2e80-4393-b4e8-40ef3eac565e',
|
||||
// token
|
||||
token: {
|
||||
// 2小时过期,需要用刷新token
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
import { Provide, Post, Inject, Body } from '@midwayjs/core';
|
||||
import { CoolController, BaseController } from '@cool-midway/core';
|
||||
import { BaseAuditLogEntity } from '../../entity/audit';
|
||||
import { BaseAuditLogService, AuditRecordDTO } from '../../service/audit';
|
||||
|
||||
/**
|
||||
* 安全审计日志管理后台接口
|
||||
* 路由前缀: /admin/base/audit
|
||||
*/
|
||||
@Provide()
|
||||
@CoolController({
|
||||
api: ['page', 'info', 'delete'],
|
||||
entity: BaseAuditLogEntity,
|
||||
service: BaseAuditLogService,
|
||||
pageQueryOp: {
|
||||
keyWordLikeFields: ['operatorName', 'action', 'module', 'ip'],
|
||||
fieldEq: ['status', 'module'],
|
||||
},
|
||||
})
|
||||
export class BaseAuditLogController extends BaseController {
|
||||
@Inject()
|
||||
baseAuditLogService: BaseAuditLogService;
|
||||
|
||||
/**
|
||||
* 手动/系统记录安全审计日志
|
||||
*/
|
||||
@Post('/record', { summary: '记录安全审计日志' })
|
||||
async record(@Body() body: AuditRecordDTO) {
|
||||
const res = await this.baseAuditLogService.record(body);
|
||||
return this.ok(res);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
import { Column, Entity, Index } from 'typeorm';
|
||||
import { BaseEntity } from './base';
|
||||
|
||||
/**
|
||||
* 系统安全审计日志与行为追踪实体
|
||||
* 表名: base_audit_log
|
||||
*/
|
||||
@Entity('base_audit_log')
|
||||
export class BaseAuditLogEntity extends BaseEntity {
|
||||
@Index()
|
||||
@Column({ comment: '业务模块标识', length: 50 })
|
||||
module: string;
|
||||
|
||||
@Index()
|
||||
@Column({ comment: '操作行为类型', length: 100 })
|
||||
action: string;
|
||||
|
||||
@Index()
|
||||
@Column({ name: 'operator_id', comment: '操作人 ID', nullable: true })
|
||||
operatorId?: number | null;
|
||||
|
||||
@Column({
|
||||
name: 'operator_name',
|
||||
comment: '操作人姓名',
|
||||
length: 100,
|
||||
nullable: true,
|
||||
})
|
||||
operatorName?: string | null;
|
||||
|
||||
@Index()
|
||||
@Column({ comment: '客户端 IP 地址', length: 64, nullable: true })
|
||||
ip?: string | null;
|
||||
|
||||
@Column({ comment: '操作明细/上下文快照', type: 'text', nullable: true })
|
||||
detail?: string | null;
|
||||
|
||||
@Index()
|
||||
@Column({ comment: '操作状态 (1: 成功, 0: 失败)', default: 1 })
|
||||
status: number;
|
||||
}
|
||||
@@ -0,0 +1,109 @@
|
||||
import { Provide } from '@midwayjs/core';
|
||||
import { BaseService } from '@cool-midway/core';
|
||||
import { InjectEntityModel } from '@midwayjs/typeorm';
|
||||
import { Repository } from 'typeorm';
|
||||
import { BaseAuditLogEntity } from '../entity/audit';
|
||||
|
||||
export interface AuditRecordDTO {
|
||||
module: string;
|
||||
action: string;
|
||||
operatorId?: number | null;
|
||||
operatorName?: string | null;
|
||||
ip?: string | null;
|
||||
detail?: string | null;
|
||||
status?: number;
|
||||
}
|
||||
|
||||
export interface AuditQueryDTO {
|
||||
module?: string;
|
||||
action?: string;
|
||||
status?: number;
|
||||
keyWord?: string;
|
||||
startDate?: string;
|
||||
endDate?: string;
|
||||
page?: number;
|
||||
size?: number;
|
||||
}
|
||||
|
||||
export interface AuditPaginationResult {
|
||||
list: BaseAuditLogEntity[];
|
||||
total: number;
|
||||
page: number;
|
||||
size: number;
|
||||
}
|
||||
|
||||
/**
|
||||
* 安全审计日志服务
|
||||
*/
|
||||
@Provide()
|
||||
export class BaseAuditLogService extends BaseService {
|
||||
@InjectEntityModel(BaseAuditLogEntity)
|
||||
baseAuditLogEntity: Repository<BaseAuditLogEntity>;
|
||||
|
||||
/**
|
||||
* 自动落库记录一条安全审计日志
|
||||
*/
|
||||
async record(dto: AuditRecordDTO): Promise<BaseAuditLogEntity> {
|
||||
const log = new BaseAuditLogEntity();
|
||||
log.module = dto.module;
|
||||
log.action = dto.action;
|
||||
log.operatorId = dto.operatorId ?? null;
|
||||
log.operatorName = dto.operatorName ?? null;
|
||||
log.ip = dto.ip ?? null;
|
||||
log.detail = dto.detail ?? null;
|
||||
log.status = dto.status !== undefined ? Number(dto.status) : 1;
|
||||
|
||||
return await this.baseAuditLogEntity.save(log);
|
||||
}
|
||||
|
||||
/**
|
||||
* 多条件组合过滤与分页检索
|
||||
*/
|
||||
async filterLogs(query: AuditQueryDTO): Promise<AuditPaginationResult> {
|
||||
const page = Math.max(1, Number(query.page) || 1);
|
||||
const size = Math.max(1, Number(query.size) || 20);
|
||||
const skip = (page - 1) * size;
|
||||
|
||||
// 构建过滤条件
|
||||
const where: Record<string, unknown> = {};
|
||||
if (query.module) {
|
||||
where.module = query.module;
|
||||
}
|
||||
if (query.action) {
|
||||
where.action = query.action;
|
||||
}
|
||||
if (query.status !== undefined && query.status !== null) {
|
||||
where.status = Number(query.status);
|
||||
}
|
||||
|
||||
const [allList, total] = await this.baseAuditLogEntity.findAndCount({
|
||||
where: Object.keys(where).length > 0 ? where : undefined,
|
||||
order: { createTime: 'DESC' },
|
||||
});
|
||||
|
||||
let resultList = allList;
|
||||
|
||||
// 关键字模糊匹配 (operatorName, action, ip, module)
|
||||
if (query.keyWord) {
|
||||
const kw = query.keyWord.toLowerCase();
|
||||
resultList = resultList.filter((item) => {
|
||||
return (
|
||||
(item.operatorName && item.operatorName.toLowerCase().includes(kw)) ||
|
||||
(item.action && item.action.toLowerCase().includes(kw)) ||
|
||||
(item.module && item.module.toLowerCase().includes(kw)) ||
|
||||
(item.ip && item.ip.toLowerCase().includes(kw))
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
const finalTotal = query.keyWord ? resultList.length : total;
|
||||
const paginatedList = resultList.slice(skip, skip + size);
|
||||
|
||||
return {
|
||||
list: paginatedList,
|
||||
total: finalTotal,
|
||||
page,
|
||||
size,
|
||||
};
|
||||
}
|
||||
}
|
||||
在新工单中引用
屏蔽一个用户