diff --git a/dashboard/src2/components/JsiteDomainDNSRecords.vue b/dashboard/src2/components/JsiteDomainDNSRecords.vue
index bbfa697..2f707be 100644
--- a/dashboard/src2/components/JsiteDomainDNSRecords.vue
+++ b/dashboard/src2/components/JsiteDomainDNSRecords.vue
@@ -142,6 +142,7 @@
+
@@ -153,6 +154,7 @@
'bg-blue-100 text-blue-800': record.type === 'AAAA',
'bg-yellow-100 text-yellow-800': record.type === 'CNAME',
'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-orange-100 text-orange-800': record.type === 'SRV',
'bg-gray-100 text-gray-800': !record.type
@@ -439,8 +441,9 @@ export default {
'AAAA': 'info',
'CNAME': 'warning',
'MX': 'primary',
+ 'NS': 'info',
'TXT': 'secondary',
- 'NS': 'default'
+ 'SRV': 'warning'
};
return variantMap[type] || 'default';
},
@@ -519,13 +522,11 @@ export default {
line: record.line
};
} else {
- // 修改记录
+ // 修改记录 - 只传递可修改的字段
url = 'jcloud.api.domain_west.west_domain_modify_dns_record';
params = {
domain: this.$domain.pg.domain,
record_id: record.id,
- record_type: record.type,
- host: record.item,
value: record.value,
ttl: record.ttl,
level: record.level,
diff --git a/jcloud/api/domain_west.py b/jcloud/api/domain_west.py
index 7a98389..e492af6 100644
--- a/jcloud/api/domain_west.py
+++ b/jcloud/api/domain_west.py
@@ -315,7 +315,7 @@ class WestDomain:
Args:
domain: 域名
- record_type: 记录类型 (A, CNAME, MX, TXT, AAAA, SRV)
+ record_type: 记录类型 (A, AAAA, CNAME, MX, NS, TXT, SRV)
host: 主机记录
value: 记录值
ttl: TTL值 (60~86400秒,默认900)
@@ -966,7 +966,7 @@ def west_domain_modify_dns(**data):
# 验证记录类型
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:
results.append({"status": "error", "message": f"不支持的记录类型: {record_type}"})
continue
@@ -1027,7 +1027,7 @@ def west_domain_add_dns_record(**data):
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:
return {"status": "error", "message": f"不支持的记录类型: {record_type},支持的类型: {', '.join(valid_types)}"}
@@ -1093,7 +1093,7 @@ def west_domain_delete_dns_record(**data):
# 验证记录类型
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:
return {"status": "error", "message": f"不支持的记录类型: {record_type},支持的类型: {', '.join(valid_types)}"}
@@ -2225,7 +2225,7 @@ def west_upload_real_name_files(**data):
@jingrow.whitelist()
def west_domain_modify_dns_record(**data):
- """修改DNS记录"""
+ """修改DNS记录 - 只修改可修改的字段(值、TTL、优先级、线路)"""
client = get_west_client()
if not client:
return {"status": "error", "message": "API客户端初始化失败"}
@@ -2235,15 +2235,7 @@ def west_domain_modify_dns_record(**data):
ttl = data.get('ttl', 600)
level = data.get('level', 10)
record_id = data.get('record_id')
- host = data.get('host')
- record_type = data.get('record_type')
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值
if ttl < 60 or ttl > 86400:
@@ -2253,18 +2245,9 @@ def west_domain_modify_dns_record(**data):
if level < 1 or level > 100:
return {"status": "error", "message": "优先级必须在1~100之间"}
- # 如果没有提供record_id,则必须提供host和record_type
- 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)}"}
-
+ # 只传递可修改的字段给底层API
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":
@@ -2286,8 +2269,6 @@ def west_domain_modify_dns_record(**data):
"ttl": ttl,
"level": level,
"record_id": record_id,
- "host": host,
- "record_type": record_type,
"line": line
}
}