增加Jsite Domain及子表Dns Resolution
This commit is contained in:
parent
7c95d02097
commit
a2941851bb
@ -133,25 +133,70 @@ class WestDomain:
|
||||
}
|
||||
return self._make_request('/domain/query/', 'POST', body_params=body_params)
|
||||
|
||||
def register_domain(self, domain: str, year: int = 1,
|
||||
contact_info: Optional[Dict] = None) -> Dict[str, Any]:
|
||||
|
||||
|
||||
def register_domain(self, domain: str, regyear: int = 1,
|
||||
domainpwd: Optional[str] = None,
|
||||
dns_host1: Optional[str] = None,
|
||||
dns_host2: Optional[str] = None,
|
||||
dns_host3: Optional[str] = None,
|
||||
dns_host4: Optional[str] = None,
|
||||
dns_host5: Optional[str] = None,
|
||||
dns_host6: Optional[str] = None,
|
||||
c_sysid: Optional[str] = None,
|
||||
client_price: Optional[str] = None,
|
||||
premium: Optional[str] = None,
|
||||
domchannel: Optional[str] = None,
|
||||
westusechn: Optional[str] = None) -> Dict[str, Any]:
|
||||
"""
|
||||
注册域名
|
||||
|
||||
Args:
|
||||
domain: 域名
|
||||
year: 注册年限
|
||||
contact_info: 联系人信息
|
||||
domain: 域名(多个域名用英文逗号分隔)
|
||||
regyear: 注册年限
|
||||
domainpwd: 域名密码,不填则系统随机生成
|
||||
dns_host1: 主DNS,必填
|
||||
dns_host2: 辅DNS,必填
|
||||
dns_host3-6: 可选DNS
|
||||
c_sysid: 模板ID,必填
|
||||
client_price: 价格保护,代理商用户购买价格,如果价格低于其成本价,激活失败防止亏损,不需要保护传99999
|
||||
premium: 普通域名不需要传,溢价域名必须传"yes"才能注册
|
||||
domchannel: 仅对.cn域名有效,传"hk"为特价渠道,空为默认,"cn"为普通渠道
|
||||
westusechn: 空为国内渠道,如需国际合作渠道传"hk",此功能支持:.com(需特殊权限)、.top、.cyou、.icu、.vip、.xyz、.site、.shop、.co
|
||||
"""
|
||||
body_params = {
|
||||
'act': 'regdomain',
|
||||
'domain': domain,
|
||||
'year': year,
|
||||
'regyear': regyear,
|
||||
}
|
||||
|
||||
if contact_info:
|
||||
body_params.update(contact_info)
|
||||
# 添加可选参数
|
||||
if domainpwd:
|
||||
body_params['domainpwd'] = domainpwd
|
||||
if dns_host1:
|
||||
body_params['dns_host1'] = dns_host1
|
||||
if dns_host2:
|
||||
body_params['dns_host2'] = dns_host2
|
||||
if dns_host3:
|
||||
body_params['dns_host3'] = dns_host3
|
||||
if dns_host4:
|
||||
body_params['dns_host4'] = dns_host4
|
||||
if dns_host5:
|
||||
body_params['dns_host5'] = dns_host5
|
||||
if dns_host6:
|
||||
body_params['dns_host6'] = dns_host6
|
||||
if c_sysid:
|
||||
body_params['c_sysid'] = c_sysid
|
||||
if client_price:
|
||||
body_params['client_price'] = client_price
|
||||
if premium:
|
||||
body_params['premium'] = premium
|
||||
if domchannel:
|
||||
body_params['domchannel'] = domchannel
|
||||
if westusechn:
|
||||
body_params['westusechn'] = westusechn
|
||||
|
||||
return self._make_request('/domain/?act=register', 'POST', body_params=body_params)
|
||||
return self._make_request('/audit/', 'POST', body_params=body_params)
|
||||
|
||||
def renew_domain(self, domain: str, year: int = 1,
|
||||
expire_date: Optional[str] = None,
|
||||
@ -290,6 +335,34 @@ class WestDomain:
|
||||
'domain': domain,
|
||||
}
|
||||
return self._make_request(action, 'POST', body_params=body_params)
|
||||
|
||||
def get_template_list(self, limit: int = 10, page: int = 1) -> Dict[str, Any]:
|
||||
"""
|
||||
获取域名模板列表
|
||||
|
||||
Args:
|
||||
limit: 每页数量
|
||||
page: 页码
|
||||
"""
|
||||
body_params = {
|
||||
'act': 'gettemplates',
|
||||
'limit': limit,
|
||||
'page': page,
|
||||
}
|
||||
return self._make_request('/audit/', 'POST', body_params=body_params)
|
||||
|
||||
def get_template_detail(self, template_id: str) -> Dict[str, Any]:
|
||||
"""
|
||||
获取指定模板详情
|
||||
|
||||
Args:
|
||||
template_id: 模板ID
|
||||
"""
|
||||
body_params = {
|
||||
'act': 'gettemplate',
|
||||
'c_sysid': template_id,
|
||||
}
|
||||
return self._make_request('/audit/', 'POST', body_params=body_params)
|
||||
|
||||
|
||||
def get_west_client() -> WestDomain:
|
||||
@ -352,20 +425,32 @@ def get_west_domain_price(domain: str, year: int = 1):
|
||||
|
||||
|
||||
@jingrow.whitelist()
|
||||
def west_domain_register(**data):
|
||||
def west_domain_register(domain: str, regyear: int = 1, dns_host1: str = "ns1.myhostadmin.net",
|
||||
dns_host2: str = "ns2.myhostadmin.net", c_sysid: str = "1681988",
|
||||
domainpwd: str = None, dns_host3: str = None, dns_host4: str = None,
|
||||
dns_host5: str = None, dns_host6: str = None, client_price: str = None,
|
||||
premium: str = None, domchannel: str = None, westusechn: str = None):
|
||||
"""注册域名"""
|
||||
client = get_west_client()
|
||||
if not client:
|
||||
return {"status": "error", "message": "API客户端初始化失败"}
|
||||
|
||||
domain = data.get('domain')
|
||||
year = data.get('year', 1)
|
||||
contact_info = data.get('contact_info')
|
||||
|
||||
if not domain:
|
||||
return {"status": "error", "message": "缺少域名参数"}
|
||||
|
||||
return client.register_domain(domain, year, contact_info)
|
||||
return client.register_domain(
|
||||
domain=domain,
|
||||
regyear=regyear,
|
||||
dns_host1=dns_host1,
|
||||
dns_host2=dns_host2,
|
||||
c_sysid=c_sysid,
|
||||
domainpwd=domainpwd,
|
||||
dns_host3=dns_host3,
|
||||
dns_host4=dns_host4,
|
||||
dns_host5=dns_host5,
|
||||
dns_host6=dns_host6,
|
||||
client_price=client_price,
|
||||
premium=premium,
|
||||
domchannel=domchannel,
|
||||
westusechn=westusechn
|
||||
)
|
||||
|
||||
|
||||
@jingrow.whitelist()
|
||||
@ -516,6 +601,33 @@ def west_domain_lock(**data):
|
||||
return client.lock_domain(domain, lock)
|
||||
|
||||
|
||||
@jingrow.whitelist()
|
||||
def west_domain_get_templates(**data):
|
||||
"""获取域名模板列表"""
|
||||
client = get_west_client()
|
||||
if not client:
|
||||
return {"status": "error", "message": "API客户端初始化失败"}
|
||||
|
||||
limit = data.get('limit', 10)
|
||||
page = data.get('page', 1)
|
||||
|
||||
return client.get_template_list(limit, page)
|
||||
|
||||
|
||||
@jingrow.whitelist()
|
||||
def west_domain_get_template_detail(**data):
|
||||
"""获取指定模板详情"""
|
||||
client = get_west_client()
|
||||
if not client:
|
||||
return {"status": "error", "message": "API客户端初始化失败"}
|
||||
|
||||
template_id = data.get('template_id')
|
||||
if not template_id:
|
||||
return {"status": "error", "message": "缺少模板ID参数"}
|
||||
|
||||
return client.get_template_detail(template_id)
|
||||
|
||||
|
||||
# 便捷函数
|
||||
def call_west_domain_api(api_name: str, **kwargs) -> Dict[str, Any]:
|
||||
"""
|
||||
@ -542,6 +654,8 @@ def call_west_domain_api(api_name: str, **kwargs) -> Dict[str, Any]:
|
||||
'delete_dns_record': west_domain_delete_dns_record,
|
||||
'transfer': west_domain_transfer,
|
||||
'lock': west_domain_lock,
|
||||
'get_templates': west_domain_get_templates,
|
||||
'get_template_detail': west_domain_get_template_detail,
|
||||
}
|
||||
|
||||
if api_name not in api_functions:
|
||||
|
||||
0
jcloud/jcloud/pagetype/dns_resolution/__init__.py
Normal file
0
jcloud/jcloud/pagetype/dns_resolution/__init__.py
Normal file
82
jcloud/jcloud/pagetype/dns_resolution/dns_resolution.json
Normal file
82
jcloud/jcloud/pagetype/dns_resolution/dns_resolution.json
Normal file
@ -0,0 +1,82 @@
|
||||
{
|
||||
"actions": [],
|
||||
"allow_rename": 1,
|
||||
"creation": "2025-07-31 19:34:32.233545",
|
||||
"editable_grid": 1,
|
||||
"engine": "InnoDB",
|
||||
"field_order": [
|
||||
"host",
|
||||
"type",
|
||||
"line",
|
||||
"value",
|
||||
"ttl",
|
||||
"level",
|
||||
"record_status"
|
||||
],
|
||||
"fields": [
|
||||
{
|
||||
"fieldname": "host",
|
||||
"fieldtype": "Data",
|
||||
"in_list_view": 1,
|
||||
"label": "主机名",
|
||||
"reqd": 1
|
||||
},
|
||||
{
|
||||
"fieldname": "type",
|
||||
"fieldtype": "Select",
|
||||
"in_list_view": 1,
|
||||
"label": "类型",
|
||||
"options": "\nA\nCNAME\nMX\nTXT\nAAAA\nSRV",
|
||||
"reqd": 1
|
||||
},
|
||||
{
|
||||
"fieldname": "value",
|
||||
"fieldtype": "Data",
|
||||
"in_list_view": 1,
|
||||
"label": "对应值",
|
||||
"reqd": 1
|
||||
},
|
||||
{
|
||||
"default": "600",
|
||||
"fieldname": "ttl",
|
||||
"fieldtype": "Data",
|
||||
"in_list_view": 1,
|
||||
"label": "TTL"
|
||||
},
|
||||
{
|
||||
"default": "10",
|
||||
"fieldname": "level",
|
||||
"fieldtype": "Data",
|
||||
"in_list_view": 1,
|
||||
"label": "优先级"
|
||||
},
|
||||
{
|
||||
"fieldname": "line",
|
||||
"fieldtype": "Select",
|
||||
"in_list_view": 1,
|
||||
"label": "线路",
|
||||
"options": "\nLTEL\nLCNC\nLMOB\nLEDU\nLSEO"
|
||||
},
|
||||
{
|
||||
"fieldname": "record_status",
|
||||
"fieldtype": "Data",
|
||||
"in_list_view": 1,
|
||||
"label": "状态"
|
||||
}
|
||||
],
|
||||
"grid_page_length": 50,
|
||||
"index_web_pages_for_search": 1,
|
||||
"istable": 1,
|
||||
"links": [],
|
||||
"modified": "2025-07-31 20:02:55.792679",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Jcloud",
|
||||
"name": "Dns Resolution",
|
||||
"owner": "Administrator",
|
||||
"pagetype": "PageType",
|
||||
"permissions": [],
|
||||
"row_format": "Dynamic",
|
||||
"sort_field": "modified",
|
||||
"sort_order": "DESC",
|
||||
"states": []
|
||||
}
|
||||
28
jcloud/jcloud/pagetype/dns_resolution/dns_resolution.py
Normal file
28
jcloud/jcloud/pagetype/dns_resolution/dns_resolution.py
Normal file
@ -0,0 +1,28 @@
|
||||
# Copyright (c) 2025, Jingrow and contributors
|
||||
# For license information, please see license.txt
|
||||
|
||||
# import jingrow
|
||||
from jingrow.model.document import Document
|
||||
|
||||
|
||||
class DnsResolution(Document):
|
||||
# begin: auto-generated types
|
||||
# This code is auto-generated. Do not modify anything in this block.
|
||||
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from jingrow.types import DF
|
||||
|
||||
host: DF.Data
|
||||
level: DF.Data | None
|
||||
line: DF.Literal["", "LTEL", "LCNC", "LMOB", "LEDU", "LSEO"]
|
||||
parent: DF.Data
|
||||
parentfield: DF.Data
|
||||
parenttype: DF.Data
|
||||
record_status: DF.Data | None
|
||||
ttl: DF.Data | None
|
||||
type: DF.Literal["", "A", "CNAME", "MX", "TXT", "AAAA", "SRV"]
|
||||
value: DF.Data
|
||||
# end: auto-generated types
|
||||
pass
|
||||
0
jcloud/jcloud/pagetype/jsite_domain/__init__.py
Normal file
0
jcloud/jcloud/pagetype/jsite_domain/__init__.py
Normal file
8
jcloud/jcloud/pagetype/jsite_domain/jsite_domain.js
Normal file
8
jcloud/jcloud/pagetype/jsite_domain/jsite_domain.js
Normal file
@ -0,0 +1,8 @@
|
||||
// Copyright (c) 2025, Jingrow and contributors
|
||||
// For license information, please see license.txt
|
||||
|
||||
// jingrow.ui.form.on("Jsite Domain", {
|
||||
// refresh(frm) {
|
||||
|
||||
// },
|
||||
// });
|
||||
238
jcloud/jcloud/pagetype/jsite_domain/jsite_domain.json
Normal file
238
jcloud/jcloud/pagetype/jsite_domain/jsite_domain.json
Normal file
@ -0,0 +1,238 @@
|
||||
{
|
||||
"actions": [],
|
||||
"allow_rename": 1,
|
||||
"creation": "2025-07-31 18:45:57.055094",
|
||||
"engine": "InnoDB",
|
||||
"field_order": [
|
||||
"domain",
|
||||
"domain_owner",
|
||||
"price",
|
||||
"registration_date",
|
||||
"team",
|
||||
"admin_password",
|
||||
"whois_protection",
|
||||
"column_break_vndy",
|
||||
"status",
|
||||
"domain_registrar",
|
||||
"order_id",
|
||||
"end_date",
|
||||
"period",
|
||||
"group",
|
||||
"auto_renew",
|
||||
"section_break_yomj",
|
||||
"description",
|
||||
"dns_tab",
|
||||
"dns_host1",
|
||||
"dns_host3",
|
||||
"dns_host5",
|
||||
"column_break_qlix",
|
||||
"dns_host2",
|
||||
"dns_host4",
|
||||
"dns_host6",
|
||||
"dns_resolution_tab",
|
||||
"dns_resolution"
|
||||
],
|
||||
"fields": [
|
||||
{
|
||||
"fieldname": "team",
|
||||
"fieldtype": "Link",
|
||||
"label": "团队",
|
||||
"options": "Team"
|
||||
},
|
||||
{
|
||||
"default": "Pending",
|
||||
"fieldname": "status",
|
||||
"fieldtype": "Select",
|
||||
"in_list_view": 1,
|
||||
"in_standard_filter": 1,
|
||||
"label": "状态",
|
||||
"options": "Pending\nActive\nExpired\nSuspended\nCancelled",
|
||||
"read_only": 1
|
||||
},
|
||||
{
|
||||
"fieldname": "order_id",
|
||||
"fieldtype": "Data",
|
||||
"label": "订单ID",
|
||||
"read_only": 1
|
||||
},
|
||||
{
|
||||
"fieldname": "price",
|
||||
"fieldtype": "Int",
|
||||
"label": "价格(元/年)"
|
||||
},
|
||||
{
|
||||
"default": "0",
|
||||
"fieldname": "auto_renew",
|
||||
"fieldtype": "Check",
|
||||
"label": "自动续费"
|
||||
},
|
||||
{
|
||||
"fieldname": "period",
|
||||
"fieldtype": "Int",
|
||||
"hidden": 1,
|
||||
"label": "购买时长(年)",
|
||||
"read_only": 1
|
||||
},
|
||||
{
|
||||
"fieldname": "end_date",
|
||||
"fieldtype": "Datetime",
|
||||
"in_list_view": 1,
|
||||
"label": "到期时间",
|
||||
"read_only": 1
|
||||
},
|
||||
{
|
||||
"fieldname": "column_break_vndy",
|
||||
"fieldtype": "Column Break"
|
||||
},
|
||||
{
|
||||
"fieldname": "domain",
|
||||
"fieldtype": "Data",
|
||||
"in_list_view": 1,
|
||||
"in_standard_filter": 1,
|
||||
"label": "域名",
|
||||
"reqd": 1,
|
||||
"unique": 1
|
||||
},
|
||||
{
|
||||
"fieldname": "domain_owner",
|
||||
"fieldtype": "Data",
|
||||
"in_list_view": 1,
|
||||
"label": "域名所有者",
|
||||
"unique": 1
|
||||
},
|
||||
{
|
||||
"fieldname": "registration_date",
|
||||
"fieldtype": "Datetime",
|
||||
"in_list_view": 1,
|
||||
"label": "注册日期",
|
||||
"read_only": 1
|
||||
},
|
||||
{
|
||||
"default": "0",
|
||||
"fieldname": "whois_protection",
|
||||
"fieldtype": "Check",
|
||||
"label": "Whois保护"
|
||||
},
|
||||
{
|
||||
"fieldname": "admin_password",
|
||||
"fieldtype": "Password",
|
||||
"label": "管理密码"
|
||||
},
|
||||
{
|
||||
"fieldname": "domain_registrar",
|
||||
"fieldtype": "Data",
|
||||
"in_list_view": 1,
|
||||
"label": "域名注册商",
|
||||
"unique": 1
|
||||
},
|
||||
{
|
||||
"fieldname": "section_break_yomj",
|
||||
"fieldtype": "Section Break"
|
||||
},
|
||||
{
|
||||
"fieldname": "description",
|
||||
"fieldtype": "Small Text",
|
||||
"label": "描述"
|
||||
},
|
||||
{
|
||||
"fieldname": "group",
|
||||
"fieldtype": "Data",
|
||||
"label": "分组"
|
||||
},
|
||||
{
|
||||
"fieldname": "dns_tab",
|
||||
"fieldtype": "Tab Break",
|
||||
"label": "DNS"
|
||||
},
|
||||
{
|
||||
"default": "ns1.myhostadmin.net",
|
||||
"fieldname": "dns_host1",
|
||||
"fieldtype": "Data",
|
||||
"label": "域名DNS1"
|
||||
},
|
||||
{
|
||||
"default": "ns3.myhostadmin.net",
|
||||
"fieldname": "dns_host3",
|
||||
"fieldtype": "Data",
|
||||
"label": "域名DNS3"
|
||||
},
|
||||
{
|
||||
"default": "ns5.myhostadmin.net",
|
||||
"fieldname": "dns_host5",
|
||||
"fieldtype": "Data",
|
||||
"label": "域名DNS5"
|
||||
},
|
||||
{
|
||||
"fieldname": "column_break_qlix",
|
||||
"fieldtype": "Column Break"
|
||||
},
|
||||
{
|
||||
"default": "ns2.myhostadmin.net",
|
||||
"fieldname": "dns_host2",
|
||||
"fieldtype": "Data",
|
||||
"label": "域名DNS2"
|
||||
},
|
||||
{
|
||||
"default": "ns4.myhostadmin.net",
|
||||
"fieldname": "dns_host4",
|
||||
"fieldtype": "Data",
|
||||
"label": "域名DNS4"
|
||||
},
|
||||
{
|
||||
"default": "ns6.myhostadmin.net",
|
||||
"fieldname": "dns_host6",
|
||||
"fieldtype": "Data",
|
||||
"label": "域名DNS6"
|
||||
},
|
||||
{
|
||||
"fieldname": "dns_resolution",
|
||||
"fieldtype": "Table",
|
||||
"label": "DNS解析记录",
|
||||
"options": "Dns Resolution"
|
||||
},
|
||||
{
|
||||
"fieldname": "dns_resolution_tab",
|
||||
"fieldtype": "Tab Break",
|
||||
"label": "Dns Resolution"
|
||||
}
|
||||
],
|
||||
"grid_page_length": 50,
|
||||
"index_web_pages_for_search": 1,
|
||||
"links": [],
|
||||
"modified": "2025-07-31 19:54:59.548188",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Jcloud",
|
||||
"name": "Jsite Domain",
|
||||
"owner": "Administrator",
|
||||
"pagetype": "PageType",
|
||||
"permissions": [
|
||||
{
|
||||
"create": 1,
|
||||
"delete": 1,
|
||||
"email": 1,
|
||||
"export": 1,
|
||||
"print": 1,
|
||||
"read": 1,
|
||||
"report": 1,
|
||||
"role": "System Manager",
|
||||
"share": 1,
|
||||
"write": 1
|
||||
},
|
||||
{
|
||||
"create": 1,
|
||||
"read": 1,
|
||||
"role": "Jcloud Admin",
|
||||
"write": 1
|
||||
},
|
||||
{
|
||||
"create": 1,
|
||||
"read": 1,
|
||||
"role": "Jcloud Member",
|
||||
"write": 1
|
||||
}
|
||||
],
|
||||
"row_format": "Dynamic",
|
||||
"sort_field": "modified",
|
||||
"sort_order": "DESC",
|
||||
"states": []
|
||||
}
|
||||
41
jcloud/jcloud/pagetype/jsite_domain/jsite_domain.py
Normal file
41
jcloud/jcloud/pagetype/jsite_domain/jsite_domain.py
Normal file
@ -0,0 +1,41 @@
|
||||
# Copyright (c) 2025, Jingrow and contributors
|
||||
# For license information, please see license.txt
|
||||
|
||||
# import jingrow
|
||||
from jingrow.model.document import Document
|
||||
|
||||
|
||||
class JsiteDomain(Document):
|
||||
# begin: auto-generated types
|
||||
# This code is auto-generated. Do not modify anything in this block.
|
||||
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from jcloud.jcloud.pagetype.dns_resolution.dns_resolution import DnsResolution
|
||||
from jingrow.types import DF
|
||||
|
||||
admin_password: DF.Password | None
|
||||
auto_renew: DF.Check
|
||||
description: DF.SmallText | None
|
||||
dns_host1: DF.Data | None
|
||||
dns_host2: DF.Data | None
|
||||
dns_host3: DF.Data | None
|
||||
dns_host4: DF.Data | None
|
||||
dns_host5: DF.Data | None
|
||||
dns_host6: DF.Data | None
|
||||
dns_resolution: DF.Table[DnsResolution]
|
||||
domain: DF.Data
|
||||
domain_owner: DF.Data | None
|
||||
domain_registrar: DF.Data | None
|
||||
end_date: DF.Datetime | None
|
||||
group: DF.Data | None
|
||||
order_id: DF.Data | None
|
||||
period: DF.Int
|
||||
price: DF.Int
|
||||
registration_date: DF.Datetime | None
|
||||
status: DF.Literal["Pending", "Active", "Expired", "Suspended", "Cancelled"]
|
||||
team: DF.Link | None
|
||||
whois_protection: DF.Check
|
||||
# end: auto-generated types
|
||||
pass
|
||||
9
jcloud/jcloud/pagetype/jsite_domain/test_jsite_domain.py
Normal file
9
jcloud/jcloud/pagetype/jsite_domain/test_jsite_domain.py
Normal file
@ -0,0 +1,9 @@
|
||||
# Copyright (c) 2025, Jingrow and Contributors
|
||||
# See license.txt
|
||||
|
||||
# import jingrow
|
||||
from jingrow.tests.utils import JingrowTestCase
|
||||
|
||||
|
||||
class TestJsiteDomain(JingrowTestCase):
|
||||
pass
|
||||
Loading…
x
Reference in New Issue
Block a user