域名详情页增加获取域名解析记录的api端点
This commit is contained in:
parent
79be92fb69
commit
e723ada8fb
@ -280,6 +280,23 @@ class WestDomain:
|
|||||||
}
|
}
|
||||||
return self._make_request('/domain/?act=getdns', 'POST', body_params=body_params)
|
return self._make_request('/domain/?act=getdns', 'POST', body_params=body_params)
|
||||||
|
|
||||||
|
def get_dns_records_paginated(self, domain: str, limit: int = 20, pageno: int = 1) -> Dict[str, Any]:
|
||||||
|
"""
|
||||||
|
获取域名解析记录(支持分页)
|
||||||
|
|
||||||
|
Args:
|
||||||
|
domain: 域名
|
||||||
|
limit: 每页大小,默认20
|
||||||
|
pageno: 第几页,默认为1
|
||||||
|
"""
|
||||||
|
body_params = {
|
||||||
|
'act': 'getdnsrecord',
|
||||||
|
'domain': domain,
|
||||||
|
'limit': limit,
|
||||||
|
'pageno': pageno,
|
||||||
|
}
|
||||||
|
return self._make_request('/domain/', 'POST', body_params=body_params)
|
||||||
|
|
||||||
def modify_dns_records(self, domain: str, records: List[Dict]) -> Dict[str, Any]:
|
def modify_dns_records(self, domain: str, records: List[Dict]) -> Dict[str, Any]:
|
||||||
"""
|
"""
|
||||||
修改域名DNS记录
|
修改域名DNS记录
|
||||||
@ -754,6 +771,49 @@ def west_domain_get_dns(**data):
|
|||||||
return client.get_dns_records(domain)
|
return client.get_dns_records(domain)
|
||||||
|
|
||||||
|
|
||||||
|
@jingrow.whitelist()
|
||||||
|
def get_west_domain_dns_records(**data):
|
||||||
|
"""获取域名解析记录(支持分页)"""
|
||||||
|
client = get_west_client()
|
||||||
|
if not client:
|
||||||
|
return {"status": "error", "message": "API客户端初始化失败"}
|
||||||
|
|
||||||
|
domain = data.get('domain')
|
||||||
|
limit = data.get('limit', 20)
|
||||||
|
pageno = data.get('pageno', 1)
|
||||||
|
|
||||||
|
if not domain:
|
||||||
|
return {"status": "error", "message": "缺少域名参数"}
|
||||||
|
|
||||||
|
response = client.get_dns_records_paginated(domain, limit, pageno)
|
||||||
|
|
||||||
|
if response.get("status") == "error":
|
||||||
|
return response
|
||||||
|
|
||||||
|
try:
|
||||||
|
# 检查响应格式
|
||||||
|
if response.get("result") != 200:
|
||||||
|
return {"status": "error", "message": "API查询失败"}
|
||||||
|
|
||||||
|
data = response.get("data", {})
|
||||||
|
|
||||||
|
# 返回格式化的解析记录信息
|
||||||
|
return {
|
||||||
|
"status": "success",
|
||||||
|
"data": {
|
||||||
|
"pageno": data.get("pageno", 1),
|
||||||
|
"limit": data.get("limit", 20),
|
||||||
|
"total": data.get("total", 0),
|
||||||
|
"pagecount": data.get("pagecount", 0),
|
||||||
|
"items": data.get("items", [])
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
except Exception as e:
|
||||||
|
jingrow.log_error("域名解析记录查询响应解析失败", error=str(e))
|
||||||
|
return {"status": "error", "message": "域名解析记录查询响应解析失败"}
|
||||||
|
|
||||||
|
|
||||||
@jingrow.whitelist()
|
@jingrow.whitelist()
|
||||||
def west_domain_modify_dns(**data):
|
def west_domain_modify_dns(**data):
|
||||||
"""修改域名DNS记录"""
|
"""修改域名DNS记录"""
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user