1
Some checks failed
CI / verify (push) Has been cancelled

This commit is contained in:
2026-04-11 15:43:32 +08:00
parent f19e482c8f
commit 0981d6ee1b
78 changed files with 1102 additions and 8510 deletions

View File

@@ -33,6 +33,18 @@ function isAliyunConfigMissing(config: AppConfig['smsAuth']) {
return !config.accessKeyId || !config.accessKeySecret;
}
function assertAliyunRequiredConfig(config: AppConfig['smsAuth']) {
if (!config.signName.trim()) {
throw new Error('ALIYUN_SMS_SIGN_NAME 未配置');
}
if (!config.templateCode.trim()) {
throw new Error('ALIYUN_SMS_TEMPLATE_CODE 未配置');
}
if (!config.templateParamKey.trim()) {
throw new Error('ALIYUN_SMS_TEMPLATE_PARAM_KEY 未配置');
}
}
function buildProviderErrorMessage(prefix: string, message: string) {
const normalizedMessage = message.trim();
return normalizedMessage ? `${prefix}${normalizedMessage}` : prefix;
@@ -48,6 +60,7 @@ class AliyunSmsVerificationService implements SmsVerificationService {
if (isAliyunConfigMissing(config)) {
throw new Error('ALIYUN_SMS_ACCESS_KEY_ID 或 ALIYUN_SMS_ACCESS_KEY_SECRET 未配置');
}
assertAliyunRequiredConfig(config);
const clientConfig = new OpenApiClient.Config({
accessKeyId: config.accessKeyId,