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",