From 3adac89d891f44d3f203a10c3755af15a46e787f Mon Sep 17 00:00:00 2001 From: jingrow Date: Tue, 5 Aug 2025 02:02:05 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=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=E6=9B=B4=E6=96=B0jingrow=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 | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/jcloud/api/domain_west.py b/jcloud/api/domain_west.py index 8a3bf02..bc535f5 100644 --- a/jcloud/api/domain_west.py +++ b/jcloud/api/domain_west.py @@ -2281,7 +2281,7 @@ def west_domain_modify_dns_record(**data): # 只传递可修改的字段给底层API response = client.modify_dns_record( - domain, value, ttl, level, record_id, None, None, line, None + domain, value, ttl, level, record_id, line ) if response.get("status") == "error": @@ -2293,6 +2293,33 @@ def west_domain_modify_dns_record(**data): error_msg = response.get('msg', response.get('message', '未知错误')) return {"status": "error", "message": f"修改DNS记录失败: {error_msg}"} + # 异步更新本地数据库中的对应记录 + if record_id: + try: + # 查找对应的DNS记录 + dns_records = jingrow.get_all( + "Dns Resolution", + {"record_id": record_id}, + ["name"] + ) + + if dns_records: + dns_record = dns_records[0] + # 使用jingrow自带的异步更新方法 + jingrow.enqueue( + "jingrow.client.set_value", + pagetype="Dns Resolution", + name=dns_record.name, + fieldname={ + "value": value, + "ttl": str(ttl), + "level": str(level), + "line": line + } + ) + except Exception as e: + jingrow.log_error(f"域名 {domain} DNS记录异步更新失败", f"错误: {str(e)}") + # 返回成功结果 return { "status": "success",