feat: add application interface controls

This commit is contained in:
hectorzhao
2026-07-09 18:32:26 +08:00
parent 767f0ca9aa
commit ff0756ff9c
14 changed files with 260 additions and 26 deletions
+9
View File
@@ -1396,6 +1396,9 @@ export class SendChainService implements OnModuleInit, OnModuleDestroy {
if (!application || application.status !== 'active' || application.tenant.status !== 'active') {
throw new BadRequestException('CMPP account is invalid or disabled');
}
if (!application.interfaceEnabled) {
throw new BadRequestException('CMPP interface is disabled for this application');
}
if (application.tenant.certificationStatus !== 'approved') {
throw new BadRequestException('Enterprise certification is not approved');
}
@@ -1419,6 +1422,9 @@ export class SendChainService implements OnModuleInit, OnModuleDestroy {
if (!application || application.status !== 'active' || application.tenant.status !== 'active') {
throw new BadRequestException('CMPP account is invalid or disabled');
}
if (!application.interfaceEnabled) {
throw new BadRequestException('CMPP interface is disabled for this application');
}
if (data.remoteIp && !isApplicationIpAllowed(data.remoteIp, application.ipAllowlist.map((item) => item.ipCidr))) {
throw new BadRequestException('CMPP source IP is not in application allowlist');
}
@@ -1787,6 +1793,9 @@ export class SendChainService implements OnModuleInit, OnModuleDestroy {
if (!application || application.tenantId !== tenantId || application.status !== 'active') {
throw new BadRequestException('短信应用不存在或已停用');
}
if (!application.interfaceEnabled) {
throw new BadRequestException('短信应用接口未开通,不能发送短信');
}
if (!templateId) {
return;
}