From e85bb9bb5afe4de7e0b383955dbbc592aad70b3a Mon Sep 17 00:00:00 2001 From: jingrow Date: Tue, 5 Aug 2025 02:10:59 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=A0=E9=99=A4=E5=9F=9F=E5=90=8D=E8=A7=A3?= =?UTF-8?q?=E6=9E=90=E8=AE=B0=E5=BD=95=E6=88=90=E5=8A=9F=E5=90=8E=E5=BC=82?= =?UTF-8?q?=E6=AD=A5=E5=88=A0=E9=99=A4jingrow=E7=B3=BB=E7=BB=9F=E5=AF=B9?= =?UTF-8?q?=E5=BA=94=E7=9A=84=E8=AE=B0=E5=BD=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- jcloud/api/domain_west.py | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/jcloud/api/domain_west.py b/jcloud/api/domain_west.py index bc535f5..3e2c5e1 100644 --- a/jcloud/api/domain_west.py +++ b/jcloud/api/domain_west.py @@ -1142,6 +1142,25 @@ def west_domain_delete_dns_record(**data): error_msg = response.get('msg', response.get('message', '未知错误')) return {"status": "error", "message": f"删除DNS记录失败: {error_msg}"} + # 异步删除本地数据库中的对应记录 + if record_id: + try: + dns_records = jingrow.get_all( + "Dns Resolution", + {"record_id": record_id}, + ["name"] + ) + + if dns_records: + dns_record = dns_records[0] + jingrow.enqueue( + "jingrow.client.delete_pg", + pagetype="Dns Resolution", + name=dns_record.name + ) + except Exception as e: + jingrow.log_error(f"域名 {domain} DNS记录异步删除失败", f"错误: {str(e)}") + # 返回成功结果 return { "status": "success", @@ -1205,6 +1224,25 @@ def west_domain_delete_dns_records(**data): "record_id": record_id, "status": "success" }) + + # 异步删除本地数据库中的对应记录 + try: + dns_records = jingrow.get_all( + "Dns Resolution", + {"record_id": record_id}, + ["name"] + ) + + if dns_records: + dns_record = dns_records[0] + jingrow.enqueue( + "jingrow.client.delete_pg", + pagetype="Dns Resolution", + name=dns_record.name + ) + except Exception as e: + jingrow.log_error(f"域名 {domain} DNS记录异步删除失败", f"记录ID: {record_id}, 错误: {str(e)}") + except Exception as e: error_count += 1 results.append({