fix(planting): 移除个人最大认种数量限制
删除 MAX_TREES_PER_USER = 1000 的限制和 checkRiskControl 方法 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
7ab1d73f5b
commit
1cc27731d9
|
|
@ -24,9 +24,6 @@ import {
|
|||
FailureStage,
|
||||
} from '../../infrastructure/persistence/repositories/payment-compensation.repository';
|
||||
|
||||
// 个人最大认种数量限制
|
||||
const MAX_TREES_PER_USER = 1000;
|
||||
|
||||
export interface CreateOrderResult {
|
||||
orderNo: string;
|
||||
treeCount: number;
|
||||
|
|
@ -84,9 +81,6 @@ export class PlantingApplicationService {
|
|||
): Promise<CreateOrderResult> {
|
||||
this.logger.log(`Creating order for user ${userId}, treeCount: ${treeCount}`);
|
||||
|
||||
// 风控检查
|
||||
await this.checkRiskControl(userId, treeCount);
|
||||
|
||||
// 检查余额
|
||||
const balance = await this.walletService.getBalance(userId.toString());
|
||||
const requiredAmount = treeCount * PRICE_PER_TREE;
|
||||
|
|
@ -464,22 +458,6 @@ export class PlantingApplicationService {
|
|||
return { success: true };
|
||||
}
|
||||
|
||||
/**
|
||||
* 风控检查
|
||||
*/
|
||||
private async checkRiskControl(
|
||||
userId: bigint,
|
||||
treeCount: number,
|
||||
): Promise<void> {
|
||||
// 检查用户限购
|
||||
const existingCount = await this.orderRepository.countTreesByUserId(userId);
|
||||
if (existingCount + treeCount > MAX_TREES_PER_USER) {
|
||||
throw new Error(
|
||||
`超过个人最大认种数量限制: 已认种 ${existingCount} 棵, 本次 ${treeCount} 棵, 上限 ${MAX_TREES_PER_USER} 棵`,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 构建 Outbox 事件数据
|
||||
*
|
||||
|
|
|
|||
Loading…
Reference in New Issue