更新域名解析记录成功后异步更新jingrow系统对应的记录
This commit is contained in:
parent
852ce46ad7
commit
3adac89d89
@ -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",
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user