域名注册之后自动同步域名信息
This commit is contained in:
parent
89da3443a7
commit
6d981a7dc2
@ -215,22 +215,22 @@ export default {
|
||||
getStatusText(status) {
|
||||
const statusMap = {
|
||||
'ok': '正常',
|
||||
'clientHold': '锁定',
|
||||
'clientUpdateProhibited': '更新锁定',
|
||||
'clientTransferProhibited': '转移锁定',
|
||||
'clientDeleteProhibited': '删除锁定',
|
||||
'clientRenewProhibited': '续费锁定'
|
||||
'clienthold': '锁定',
|
||||
'clientupdateprohibited': '更新锁定',
|
||||
'clienttransferprohibited': '转移锁定',
|
||||
'clientdeleteprohibited': '删除锁定',
|
||||
'clientrenewprohibited': '续费锁定'
|
||||
};
|
||||
return statusMap[status] || status;
|
||||
},
|
||||
getStatusVariant(status) {
|
||||
const variantMap = {
|
||||
'ok': 'success',
|
||||
'clientHold': 'danger',
|
||||
'clientUpdateProhibited': 'danger',
|
||||
'clientTransferProhibited': 'danger',
|
||||
'clientDeleteProhibited': 'danger',
|
||||
'clientRenewProhibited': 'danger'
|
||||
'clienthold': 'danger',
|
||||
'clientupdateprohibited': 'danger',
|
||||
'clienttransferprohibited': 'danger',
|
||||
'clientdeleteprohibited': 'danger',
|
||||
'clientrenewprohibited': 'danger'
|
||||
};
|
||||
return variantMap[status] || 'default';
|
||||
},
|
||||
|
||||
@ -1458,7 +1458,6 @@ def create_domain_order(domain, period=1, payment_method='balance', domain_owner
|
||||
"domain_owner": domain_owner,
|
||||
"yearly_price": yearly_price,
|
||||
"auto_renew": False,
|
||||
"whois_protection": True,
|
||||
# 注册域名所需参数
|
||||
"regyear": period,
|
||||
"dns_host1": "ns1.myhostadmin.net",
|
||||
@ -1582,9 +1581,6 @@ def register_domain_from_order(order_name):
|
||||
domain_name = biz_params.get("domain")
|
||||
period = biz_params.get("period", 1)
|
||||
domain_owner = biz_params.get("domain_owner")
|
||||
yearly_price = biz_params.get("yearly_price", 0)
|
||||
auto_renew = biz_params.get("auto_renew", False)
|
||||
whois_protection = biz_params.get("whois_protection", True)
|
||||
|
||||
if not domain_name:
|
||||
raise Exception("订单中缺少域名信息")
|
||||
@ -1613,12 +1609,8 @@ def register_domain_from_order(order_name):
|
||||
"domain": domain_name,
|
||||
"team": order.team,
|
||||
"order_id": order.order_id,
|
||||
"status": "Active",
|
||||
"price": yearly_price,
|
||||
"period": period,
|
||||
"domain_owner": domain_owner,
|
||||
"auto_renew": auto_renew,
|
||||
"whois_protection": whois_protection,
|
||||
"registration_date": jingrow.utils.nowdate(),
|
||||
"end_date": jingrow.utils.add_months(jingrow.utils.nowdate(), period * 12)
|
||||
})
|
||||
@ -1630,6 +1622,17 @@ def register_domain_from_order(order_name):
|
||||
|
||||
jingrow.db.commit()
|
||||
|
||||
# 异步执行域名信息同步
|
||||
try:
|
||||
jingrow.enqueue(
|
||||
"jcloud.api.domain_west.sync_domain_info_from_west",
|
||||
domain=domain_name,
|
||||
queue="default",
|
||||
timeout=300
|
||||
)
|
||||
except Exception as e:
|
||||
jingrow.log_error(f"域名 {domain_name} 异步同步任务创建失败", f"错误: {str(e)}")
|
||||
|
||||
return True
|
||||
|
||||
except Exception as e:
|
||||
@ -2660,12 +2663,14 @@ def sync_domain_info_from_west(**data):
|
||||
# 更新所有者信息
|
||||
owner_name = owner_info.get("dom_org_m") or owner_info.get("dom_ln_m", "") + owner_info.get("dom_fn_m", "")
|
||||
domain_owner_pg.fullname = owner_name
|
||||
domain_owner_pg.r_status = 1 # 已实名认证
|
||||
domain_owner_pg.c_status = real_data.get("c_status")
|
||||
domain_owner_pg.r_status = real_data.get("r_status")
|
||||
|
||||
# 更新国家代码和电话代码
|
||||
domain_owner_pg.c_co = owner_info.get("dom_co", "CN")
|
||||
domain_owner_pg.cocode = owner_info.get("dom_ph", "").split('.')[0] if '.' in owner_info.get("dom_ph", "") else "+86" # 从手机号提取电话代码
|
||||
|
||||
|
||||
# 根据类型更新不同字段
|
||||
c_regtype = "E" if owner_info.get("dom_org_m") else "I"
|
||||
domain_owner_pg.c_regtype = c_regtype
|
||||
@ -2726,7 +2731,8 @@ def sync_domain_info_from_west(**data):
|
||||
"c_co": owner_info.get("dom_co", "CN"), # 从数据中获取国家代码
|
||||
"cocode": owner_info.get("dom_ph", "").split('.')[0] if '.' in owner_info.get("dom_ph", "") else "+86", # 从手机号提取电话代码
|
||||
"reg_contact_type": "cg",
|
||||
"r_status": 1, # 已实名认证
|
||||
"c_status": real_data.get("c_status"),
|
||||
"r_status": real_data.get("r_status"),
|
||||
"title": owner_name
|
||||
}
|
||||
|
||||
@ -2788,7 +2794,7 @@ def sync_domain_info_from_west(**data):
|
||||
if real_data:
|
||||
domain_pg.registration_date = real_data.get("regdate")
|
||||
domain_pg.end_date = real_data.get("rexpiredate")
|
||||
domain_pg.status = "Active" if real_data.get("status") == "ok" else "Expired"
|
||||
domain_pg.status = real_data.get("status")
|
||||
|
||||
# 更新DNS服务器信息
|
||||
domain_pg.dns_host1 = real_data.get("dns_host1", "")
|
||||
|
||||
@ -45,7 +45,7 @@
|
||||
"in_list_view": 1,
|
||||
"in_standard_filter": 1,
|
||||
"label": "状态",
|
||||
"options": "ok\nclientHold\nclientUpdateProhibited"
|
||||
"options": "ok\nclienthold\nclientHold\nclientupdateprohibited\nclientUpdateProhibited\nclienttransferprohibited\nclientTransferProhibited\nclientdeleteprohibited\nclientDeleteProhibited\nclientrenewprohibited\nclientRenewProhibited"
|
||||
},
|
||||
{
|
||||
"fieldname": "order_id",
|
||||
@ -195,7 +195,7 @@
|
||||
"grid_page_length": 50,
|
||||
"index_web_pages_for_search": 1,
|
||||
"links": [],
|
||||
"modified": "2025-08-05 16:59:44.708289",
|
||||
"modified": "2025-08-05 17:46:02.311435",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Jcloud",
|
||||
"name": "Jsite Domain",
|
||||
|
||||
@ -34,7 +34,7 @@ class JsiteDomain(Document):
|
||||
period: DF.Int
|
||||
price: DF.Int
|
||||
registration_date: DF.Datetime | None
|
||||
status: DF.Literal["ok", "clientHold", "clientUpdateProhibited"]
|
||||
status: DF.Literal["ok", "clienthold", "clientHold", "clientupdateprohibited", "clientUpdateProhibited", "clienttransferprohibited", "clientTransferProhibited", "clientdeleteprohibited", "clientDeleteProhibited", "clientrenewprohibited", "clientRenewProhibited"]
|
||||
team: DF.Link | None
|
||||
whois_protection: DF.Check
|
||||
# end: auto-generated types
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user