添加域名解析记录的类型增加NS选项
This commit is contained in:
parent
69739f7d2b
commit
6d05fa9fdf
@ -142,6 +142,7 @@
|
|||||||
<option value="AAAA">AAAA</option>
|
<option value="AAAA">AAAA</option>
|
||||||
<option value="CNAME">CNAME</option>
|
<option value="CNAME">CNAME</option>
|
||||||
<option value="MX">MX</option>
|
<option value="MX">MX</option>
|
||||||
|
<option value="NS">NS</option>
|
||||||
<option value="TXT">TXT</option>
|
<option value="TXT">TXT</option>
|
||||||
<option value="SRV">SRV</option>
|
<option value="SRV">SRV</option>
|
||||||
</select>
|
</select>
|
||||||
@ -153,6 +154,7 @@
|
|||||||
'bg-blue-100 text-blue-800': record.type === 'AAAA',
|
'bg-blue-100 text-blue-800': record.type === 'AAAA',
|
||||||
'bg-yellow-100 text-yellow-800': record.type === 'CNAME',
|
'bg-yellow-100 text-yellow-800': record.type === 'CNAME',
|
||||||
'bg-purple-100 text-purple-800': record.type === 'MX',
|
'bg-purple-100 text-purple-800': record.type === 'MX',
|
||||||
|
'bg-indigo-100 text-indigo-800': record.type === 'NS',
|
||||||
'bg-gray-100 text-gray-800': record.type === 'TXT',
|
'bg-gray-100 text-gray-800': record.type === 'TXT',
|
||||||
'bg-orange-100 text-orange-800': record.type === 'SRV',
|
'bg-orange-100 text-orange-800': record.type === 'SRV',
|
||||||
'bg-gray-100 text-gray-800': !record.type
|
'bg-gray-100 text-gray-800': !record.type
|
||||||
@ -439,8 +441,9 @@ export default {
|
|||||||
'AAAA': 'info',
|
'AAAA': 'info',
|
||||||
'CNAME': 'warning',
|
'CNAME': 'warning',
|
||||||
'MX': 'primary',
|
'MX': 'primary',
|
||||||
|
'NS': 'info',
|
||||||
'TXT': 'secondary',
|
'TXT': 'secondary',
|
||||||
'NS': 'default'
|
'SRV': 'warning'
|
||||||
};
|
};
|
||||||
return variantMap[type] || 'default';
|
return variantMap[type] || 'default';
|
||||||
},
|
},
|
||||||
@ -519,13 +522,11 @@ export default {
|
|||||||
line: record.line
|
line: record.line
|
||||||
};
|
};
|
||||||
} else {
|
} else {
|
||||||
// 修改记录
|
// 修改记录 - 只传递可修改的字段
|
||||||
url = 'jcloud.api.domain_west.west_domain_modify_dns_record';
|
url = 'jcloud.api.domain_west.west_domain_modify_dns_record';
|
||||||
params = {
|
params = {
|
||||||
domain: this.$domain.pg.domain,
|
domain: this.$domain.pg.domain,
|
||||||
record_id: record.id,
|
record_id: record.id,
|
||||||
record_type: record.type,
|
|
||||||
host: record.item,
|
|
||||||
value: record.value,
|
value: record.value,
|
||||||
ttl: record.ttl,
|
ttl: record.ttl,
|
||||||
level: record.level,
|
level: record.level,
|
||||||
|
|||||||
@ -315,7 +315,7 @@ class WestDomain:
|
|||||||
|
|
||||||
Args:
|
Args:
|
||||||
domain: 域名
|
domain: 域名
|
||||||
record_type: 记录类型 (A, CNAME, MX, TXT, AAAA, SRV)
|
record_type: 记录类型 (A, AAAA, CNAME, MX, NS, TXT, SRV)
|
||||||
host: 主机记录
|
host: 主机记录
|
||||||
value: 记录值
|
value: 记录值
|
||||||
ttl: TTL值 (60~86400秒,默认900)
|
ttl: TTL值 (60~86400秒,默认900)
|
||||||
@ -966,7 +966,7 @@ def west_domain_modify_dns(**data):
|
|||||||
|
|
||||||
# 验证记录类型
|
# 验证记录类型
|
||||||
if record_type:
|
if record_type:
|
||||||
valid_types = ['A', 'CNAME', 'MX', 'TXT', 'AAAA', 'SRV']
|
valid_types = ['A', 'AAAA', 'CNAME', 'MX', 'NS', 'TXT', 'SRV']
|
||||||
if record_type not in valid_types:
|
if record_type not in valid_types:
|
||||||
results.append({"status": "error", "message": f"不支持的记录类型: {record_type}"})
|
results.append({"status": "error", "message": f"不支持的记录类型: {record_type}"})
|
||||||
continue
|
continue
|
||||||
@ -1027,7 +1027,7 @@ def west_domain_add_dns_record(**data):
|
|||||||
return {"status": "error", "message": "缺少必要参数"}
|
return {"status": "error", "message": "缺少必要参数"}
|
||||||
|
|
||||||
# 验证记录类型
|
# 验证记录类型
|
||||||
valid_types = ['A', 'CNAME', 'MX', 'TXT', 'AAAA', 'SRV']
|
valid_types = ['A', 'AAAA', 'CNAME', 'MX', 'NS', 'TXT', 'SRV']
|
||||||
if record_type not in valid_types:
|
if record_type not in valid_types:
|
||||||
return {"status": "error", "message": f"不支持的记录类型: {record_type},支持的类型: {', '.join(valid_types)}"}
|
return {"status": "error", "message": f"不支持的记录类型: {record_type},支持的类型: {', '.join(valid_types)}"}
|
||||||
|
|
||||||
@ -1093,7 +1093,7 @@ def west_domain_delete_dns_record(**data):
|
|||||||
|
|
||||||
# 验证记录类型
|
# 验证记录类型
|
||||||
if record_type:
|
if record_type:
|
||||||
valid_types = ['A', 'CNAME', 'MX', 'TXT', 'AAAA', 'SRV']
|
valid_types = ['A', 'AAAA', 'CNAME', 'MX', 'NS', 'TXT', 'SRV']
|
||||||
if record_type not in valid_types:
|
if record_type not in valid_types:
|
||||||
return {"status": "error", "message": f"不支持的记录类型: {record_type},支持的类型: {', '.join(valid_types)}"}
|
return {"status": "error", "message": f"不支持的记录类型: {record_type},支持的类型: {', '.join(valid_types)}"}
|
||||||
|
|
||||||
@ -2225,7 +2225,7 @@ def west_upload_real_name_files(**data):
|
|||||||
|
|
||||||
@jingrow.whitelist()
|
@jingrow.whitelist()
|
||||||
def west_domain_modify_dns_record(**data):
|
def west_domain_modify_dns_record(**data):
|
||||||
"""修改DNS记录"""
|
"""修改DNS记录 - 只修改可修改的字段(值、TTL、优先级、线路)"""
|
||||||
client = get_west_client()
|
client = get_west_client()
|
||||||
if not client:
|
if not client:
|
||||||
return {"status": "error", "message": "API客户端初始化失败"}
|
return {"status": "error", "message": "API客户端初始化失败"}
|
||||||
@ -2235,15 +2235,7 @@ def west_domain_modify_dns_record(**data):
|
|||||||
ttl = data.get('ttl', 600)
|
ttl = data.get('ttl', 600)
|
||||||
level = data.get('level', 10)
|
level = data.get('level', 10)
|
||||||
record_id = data.get('record_id')
|
record_id = data.get('record_id')
|
||||||
host = data.get('host')
|
|
||||||
record_type = data.get('record_type')
|
|
||||||
line = data.get('line', '')
|
line = data.get('line', '')
|
||||||
old_value = data.get('old_value')
|
|
||||||
|
|
||||||
if not domain:
|
|
||||||
return {"status": "error", "message": "缺少域名参数"}
|
|
||||||
if not value:
|
|
||||||
return {"status": "error", "message": "缺少新的解析值"}
|
|
||||||
|
|
||||||
# 验证TTL值
|
# 验证TTL值
|
||||||
if ttl < 60 or ttl > 86400:
|
if ttl < 60 or ttl > 86400:
|
||||||
@ -2253,18 +2245,9 @@ def west_domain_modify_dns_record(**data):
|
|||||||
if level < 1 or level > 100:
|
if level < 1 or level > 100:
|
||||||
return {"status": "error", "message": "优先级必须在1~100之间"}
|
return {"status": "error", "message": "优先级必须在1~100之间"}
|
||||||
|
|
||||||
# 如果没有提供record_id,则必须提供host和record_type
|
# 只传递可修改的字段给底层API
|
||||||
if not record_id and (not host or not record_type):
|
|
||||||
return {"status": "error", "message": "当未提供记录ID时,主机头和解析类型为必填项"}
|
|
||||||
|
|
||||||
# 验证记录类型
|
|
||||||
if record_type:
|
|
||||||
valid_types = ['A', 'CNAME', 'MX', 'TXT', 'AAAA', 'SRV']
|
|
||||||
if record_type not in valid_types:
|
|
||||||
return {"status": "error", "message": f"不支持的记录类型: {record_type},支持的类型: {', '.join(valid_types)}"}
|
|
||||||
|
|
||||||
response = client.modify_dns_record(
|
response = client.modify_dns_record(
|
||||||
domain, value, ttl, level, record_id, host, record_type, line, old_value
|
domain, value, ttl, level, record_id, None, None, line, None
|
||||||
)
|
)
|
||||||
|
|
||||||
if response.get("status") == "error":
|
if response.get("status") == "error":
|
||||||
@ -2286,8 +2269,6 @@ def west_domain_modify_dns_record(**data):
|
|||||||
"ttl": ttl,
|
"ttl": ttl,
|
||||||
"level": level,
|
"level": level,
|
||||||
"record_id": record_id,
|
"record_id": record_id,
|
||||||
"host": host,
|
|
||||||
"record_type": record_type,
|
|
||||||
"line": line
|
"line": line
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user