fix: 优化西部数据 500 already exists 的问题

This commit is contained in:
xiaojunnuo
2025-12-09 23:33:11 +08:00
parent 9f24c18f7f
commit 2bfad9fc65
3 changed files with 18 additions and 3 deletions

View File

@@ -158,6 +158,9 @@ export class WestAccess extends BaseAccess {
},
});
if (res.msg !== 'success') {
if(res.msg.includes('500 already exists')){
return res;
}
throw new Error(`${JSON.stringify(res.msg)}`);
}
return res;
@@ -253,6 +256,9 @@ token=md5(zhangsan + 5dh232kfg!* + 1554691950854)=cfcd208495d565ef66e7dff9f98764
});
this.ctx.logger.info(`request ${url} ${method} res:${JSON.stringify(res)}`);
if (res.msg !== 'success' && res.result!= 200) {
if(res.msg.includes('500 already exists')){
return res;
}
throw new Error(`${JSON.stringify(res.msg)}`);
}
return res;

View File

@@ -73,11 +73,16 @@ export class WestDnsProviderDomain extends AbstractDnsProvider<westRecord> {
}
//这里调用删除txt dns解析记录接口
const record_id = record?.body?.record_id;
if (!record_id) {
this.logger.info('record_id不存在');
return;
}
// 准备要发送到API的请求体
const requestBody = {
act: 'dnsrec.remove', // API动作类型
domain: domain, // 域名
record_id: record.body.record_id,
record_id: record_id,
hostname: fullRecord, // 完整的记录名
record_type: 'TXT', // DNS记录类型
record_line: '', // 记录线路

View File

@@ -107,12 +107,16 @@ export class WestDnsProvider extends AbstractDnsProvider<westRecord> {
return;
}
//这里调用删除txt dns解析记录接口
const record_id = record.data?.id;
if (!record_id) {
this.logger.info('record_id不存在');
return;
}
// 准备要发送到API的请求体
const requestBody = {
act: 'deldnsrecord', // API动作类型
domain: domain, // 域名
id: record.data?.id,
id: record_id,
};
const url = '/v2/domain/';