docs/ai-reading-guide-20260115 #50

Merged
moyin merged 8 commits from docs/ai-reading-guide-20260115 into main 2026-01-15 14:31:33 +08:00
3 changed files with 25 additions and 29 deletions
Showing only changes of commit 223ba2abb8 - Show all commits

View File

@@ -17,22 +17,21 @@
* - 并发控制:使用悲观锁防止竞态条件
*
* 最近修改:
* - 2026-01-15: 代码规范优化 - 清理未使用的导入FindOptionsWhere (修改者: moyin)
* - 2026-01-12: 性能优化 - 集成AppLoggerService优化查询和批量操作
* - 2026-01-07: 代码规范优化 - 使用统一的常量文件,提高代码质量
* - 2026-01-07: 代码规范优化 - 完善文件头注释和方法三级注释
* - 2026-01-07: 功能新增 - 添加事务支持防止并发竞态条件
* - 2026-01-07: 性能优化 - 优化查询语句添加LIMIT限制
* - 2026-01-07: 功能新增 - 新增existsByGameUserId方法
*
* @author angjustinl
* @version 1.2.0
* @version 1.2.1
* @since 2025-01-05
* @lastModified 2026-01-12
* @lastModified 2026-01-15
*/
import { Injectable, Inject } from '@nestjs/common';
import { InjectRepository } from '@nestjs/typeorm';
import { Repository, FindOptionsWhere, DataSource, SelectQueryBuilder } from 'typeorm';
import { Repository, DataSource, SelectQueryBuilder } from 'typeorm';
import { ZulipAccounts } from './zulip_accounts.entity';
import { AppLoggerService } from '../../utils/logger/logger.service';
import {

View File

@@ -16,28 +16,19 @@
* 注意:业务逻辑已转移到 src/core/zulip_core/services/zulip_accounts_business.service.ts
*
* 最近修改:
* - 2026-01-15: 代码规范优化 - 清理未使用的导入NotFoundException (修改者: moyin)
* - 2026-01-12: 代码规范优化 - 修复依赖注入配置,添加@Inject装饰器确保正确的参数注入 (修改者: moyin)
* - 2026-01-12: 功能修改 - 优化create方法错误处理正确转换重复创建错误为ConflictException (修改者: moyin)
* - 2026-01-12: 架构优化 - 移除业务逻辑转移到zulip_core业务服务 (修改者: moyin)
* - 2026-01-12: 代码质量优化 - 清理重复导入,统一使用@Inject装饰器 (修改者: moyin)
* - 2026-01-12: 代码质量优化 - 完成所有性能监控代码优化统一使用createPerformanceMonitor方法 (修改者: moyin)
* - 2026-01-12: 代码质量优化 - 修复所有遗漏的BigInt转换使用列表响应构建工具方法 (修改者: moyin)
* - 2026-01-12: 代码质量优化 - 完善所有BigInt转换和数组映射的优化彻底消除重复代码 (修改者: moyin)
* - 2026-01-12: 代码质量优化 - 使用基类工具方法优化性能监控和BigInt转换减少重复代码 (修改者: moyin)
* - 2026-01-12: 性能优化 - 集成AppLoggerService和缓存机制添加性能监控
* - 2026-01-07: 代码规范优化 - 使用统一的常量文件,提高代码质量
* - 2026-01-07: 代码规范优化 - 修复导入路径,完善方法三级注释
* - 2026-01-07: 代码规范优化 - 完善文件头注释和方法三级注释
* - 2026-01-07: 功能修改 - 优化异常处理逻辑规范Repository和Service职责边界
* - 2026-01-07: 性能优化 - 移除Service层的重复唯一性检查依赖Repository事务
*
* @author angjustinl
* @version 2.1.0
* @version 2.1.1
* @since 2025-01-07
* @lastModified 2026-01-12
* @lastModified 2026-01-15
*/
import { Injectable, Inject, ConflictException, NotFoundException } from '@nestjs/common';
import { Injectable, Inject, ConflictException } from '@nestjs/common';
import { CACHE_MANAGER } from '@nestjs/cache-manager';
import { BaseZulipAccountsService } from './base_zulip_accounts.service';
import { ZulipAccountsRepository } from './zulip_accounts.repository';
@@ -126,8 +117,10 @@ export class ZulipAccountsService extends BaseZulipAccountsService {
errorMessage.includes('unique constraint')) {
const conflictError = new ConflictException(`游戏用户 ${createDto.gameUserId} 已存在Zulip账号关联`);
monitor.error(conflictError);
throw conflictError;
} else {
monitor.error(error);
throw error;
}
}
}
@@ -322,6 +315,7 @@ export class ZulipAccountsService extends BaseZulipAccountsService {
} catch (error) {
monitor.error(error);
throw error;
}
}
@@ -363,6 +357,7 @@ export class ZulipAccountsService extends BaseZulipAccountsService {
} catch (error) {
monitor.error(error);
throw error;
}
}
@@ -404,6 +399,7 @@ export class ZulipAccountsService extends BaseZulipAccountsService {
} catch (error) {
monitor.error(error);
throw error;
}
}
@@ -424,6 +420,7 @@ export class ZulipAccountsService extends BaseZulipAccountsService {
} catch (error) {
monitor.error(error);
throw error;
}
}
@@ -444,6 +441,7 @@ export class ZulipAccountsService extends BaseZulipAccountsService {
} catch (error) {
monitor.error(error);
throw error;
}
}

View File

@@ -15,26 +15,19 @@
* 注意:业务逻辑已转移到 src/core/zulip_core/services/zulip_accounts_business.service.ts
*
* 最近修改:
* - 2026-01-15: 代码规范优化 - 清理未使用的导入ConflictException和NotFoundException (修改者: moyin)
* - 2026-01-12: 架构优化 - 移除业务逻辑转移到zulip_core业务服务 (修改者: moyin)
* - 2026-01-12: 代码质量优化 - 修复导入语句添加缺失的AppLoggerService导入 (修改者: moyin)
* - 2026-01-12: 代码质量优化 - 修复logger初始化问题统一使用AppLoggerService (修改者: moyin)
* - 2026-01-12: 代码质量优化 - 完成所有性能监控代码优化统一使用createPerformanceMonitor方法 (修改者: moyin)
* - 2026-01-12: 代码质量优化 - 修复所有遗漏的BigInt转换使用列表响应构建工具方法 (修改者: moyin)
* - 2026-01-12: 代码质量优化 - 完善所有BigInt转换和数组映射的优化彻底消除重复代码 (修改者: moyin)
* - 2026-01-12: 代码质量优化 - 使用基类工具方法优化性能监控和BigInt转换减少重复代码 (修改者: moyin)
* - 2026-01-07: 代码规范优化 - 使用统一的常量文件,提高代码质量
* - 2026-01-07: 代码规范优化 - 修复导入路径,完善方法三级注释
* - 2026-01-07: 代码规范优化 - 完善文件头注释和方法三级注释
* - 2026-01-07: 功能完善 - 优化异常处理逻辑和日志记录
* - 2025-01-07: 架构优化 - 统一Service层的职责边界和接口设计
*
* @author angjustinl
* @version 2.0.0
* @version 2.0.1
* @since 2025-01-07
* @lastModified 2026-01-12
* @lastModified 2026-01-15
*/
import { Injectable, Inject, ConflictException, NotFoundException } from '@nestjs/common';
import { Injectable, Inject } from '@nestjs/common';
import { BaseZulipAccountsService } from './base_zulip_accounts.service';
import { ZulipAccountsMemoryRepository } from './zulip_accounts_memory.repository';
import { ZulipAccounts } from './zulip_accounts.entity';
@@ -101,6 +94,7 @@ export class ZulipAccountsMemoryService extends BaseZulipAccountsService {
} catch (error) {
monitor.error(error);
throw error;
}
}
@@ -146,6 +140,7 @@ export class ZulipAccountsMemoryService extends BaseZulipAccountsService {
} catch (error) {
monitor.error(error);
throw error;
}
}
@@ -259,6 +254,7 @@ export class ZulipAccountsMemoryService extends BaseZulipAccountsService {
} catch (error) {
monitor.error(error);
throw error;
}
}
@@ -281,6 +277,7 @@ export class ZulipAccountsMemoryService extends BaseZulipAccountsService {
} catch (error) {
monitor.error(error);
throw error;
}
}
@@ -301,6 +298,7 @@ export class ZulipAccountsMemoryService extends BaseZulipAccountsService {
} catch (error) {
monitor.error(error);
throw error;
}
}
@@ -321,6 +319,7 @@ export class ZulipAccountsMemoryService extends BaseZulipAccountsService {
} catch (error) {
monitor.error(error);
throw error;
}
}