更新优化同步域名信息功能
This commit is contained in:
parent
22740d5bf0
commit
7e40d5c78e
@ -2128,38 +2128,6 @@ def create_domain_owner_with_template(**data):
|
|||||||
return {"status": "Error", "message": f"创建域名所有者失败: {str(e)}"}
|
return {"status": "Error", "message": f"创建域名所有者失败: {str(e)}"}
|
||||||
|
|
||||||
|
|
||||||
@jingrow.whitelist()
|
|
||||||
def test_create_domain_owner_with_template():
|
|
||||||
"""测试创建域名所有者(包含模板创建)的API端点"""
|
|
||||||
try:
|
|
||||||
# 硬编码的测试参数
|
|
||||||
test_data = {
|
|
||||||
'c_regtype': 'I',
|
|
||||||
'c_ln_m': '李',
|
|
||||||
'c_fn_m': '长生',
|
|
||||||
'c_co': 'CN',
|
|
||||||
'cocode': '+86',
|
|
||||||
'c_st_m': '广东省',
|
|
||||||
'c_ct_m': '广州市',
|
|
||||||
'c_dt_m': '花都区',
|
|
||||||
'c_adr_m': '狮岭镇龙头市场2栋',
|
|
||||||
'c_pc': '510000',
|
|
||||||
'c_ph_type': '0',
|
|
||||||
'c_ph': '13926598569',
|
|
||||||
'c_em': '13926598569@139.com',
|
|
||||||
'c_idtype_gswl': 'SFZ',
|
|
||||||
'c_idnum_gswl': '430524198506259568'
|
|
||||||
}
|
|
||||||
|
|
||||||
# 调用create_domain_owner_with_template函数
|
|
||||||
result = create_domain_template(**test_data)
|
|
||||||
|
|
||||||
return result
|
|
||||||
|
|
||||||
except Exception as e:
|
|
||||||
return {"status": "Error", "message": f"测试API调用失败: {str(e)}"}
|
|
||||||
|
|
||||||
|
|
||||||
@jingrow.whitelist()
|
@jingrow.whitelist()
|
||||||
def get_west_domain_real_info(**data):
|
def get_west_domain_real_info(**data):
|
||||||
"""获取域名实名信息"""
|
"""获取域名实名信息"""
|
||||||
@ -2710,6 +2678,10 @@ def sync_domain_info_from_west(**data):
|
|||||||
domain_owner_pg.fullname = owner_name
|
domain_owner_pg.fullname = owner_name
|
||||||
domain_owner_pg.r_status = 1 # 已实名认证
|
domain_owner_pg.r_status = 1 # 已实名认证
|
||||||
|
|
||||||
|
# 更新国家代码和电话代码
|
||||||
|
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"
|
c_regtype = "E" if owner_info.get("dom_org_m") else "I"
|
||||||
domain_owner_pg.c_regtype = c_regtype
|
domain_owner_pg.c_regtype = c_regtype
|
||||||
@ -2741,6 +2713,13 @@ def sync_domain_info_from_west(**data):
|
|||||||
domain_owner_pg.c_ph = owner_info.get("dom_ph", "")
|
domain_owner_pg.c_ph = owner_info.get("dom_ph", "")
|
||||||
domain_owner_pg.c_ph_type = "0" # 默认为手机
|
domain_owner_pg.c_ph_type = "0" # 默认为手机
|
||||||
|
|
||||||
|
# 更新证件信息(从orgfile中获取)
|
||||||
|
orgfile = real_data.get("orgfile", {})
|
||||||
|
if orgfile.get("f_code"):
|
||||||
|
domain_owner_pg.c_idnum_gswl = orgfile.get("f_code")
|
||||||
|
if orgfile.get("f_type"):
|
||||||
|
domain_owner_pg.c_idtype_gswl = str(orgfile.get("f_type"))
|
||||||
|
|
||||||
domain_owner_pg.save(ignore_permissions=True)
|
domain_owner_pg.save(ignore_permissions=True)
|
||||||
jingrow.log_error(f"Domain Owner更新成功", f"名称: {domain_owner_name}")
|
jingrow.log_error(f"Domain Owner更新成功", f"名称: {domain_owner_name}")
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
@ -2762,8 +2741,8 @@ def sync_domain_info_from_west(**data):
|
|||||||
"c_sysid": c_sysid,
|
"c_sysid": c_sysid,
|
||||||
"c_regtype": c_regtype,
|
"c_regtype": c_regtype,
|
||||||
"fullname": owner_name,
|
"fullname": owner_name,
|
||||||
"c_co": "CN",
|
"c_co": owner_info.get("dom_co", "CN"), # 从数据中获取国家代码
|
||||||
"cocode": "+86",
|
"cocode": owner_info.get("dom_ph", "").split('.')[0] if '.' in owner_info.get("dom_ph", "") else "+86", # 从手机号提取电话代码
|
||||||
"reg_contact_type": "cg",
|
"reg_contact_type": "cg",
|
||||||
"r_status": 1, # 已实名认证
|
"r_status": 1, # 已实名认证
|
||||||
"title": owner_name
|
"title": owner_name
|
||||||
@ -2803,11 +2782,12 @@ def sync_domain_info_from_west(**data):
|
|||||||
"c_ph_type": "0" # 默认为手机
|
"c_ph_type": "0" # 默认为手机
|
||||||
})
|
})
|
||||||
|
|
||||||
# 设置证件信息(如果有)
|
# 设置证件信息(从orgfile中获取)
|
||||||
if owner_info.get("dom_idtype"):
|
orgfile = real_data.get("orgfile", {})
|
||||||
owner_data["c_idtype_gswl"] = owner_info.get("dom_idtype")
|
if orgfile.get("f_code"):
|
||||||
if owner_info.get("dom_idnum"):
|
owner_data["c_idnum_gswl"] = orgfile.get("f_code")
|
||||||
owner_data["c_idnum_gswl"] = owner_info.get("dom_idnum")
|
if orgfile.get("f_type"):
|
||||||
|
owner_data["c_idtype_gswl"] = str(orgfile.get("f_type"))
|
||||||
|
|
||||||
# 创建Domain Owner记录
|
# 创建Domain Owner记录
|
||||||
domain_owner_pg = jingrow.get_pg(owner_data)
|
domain_owner_pg = jingrow.get_pg(owner_data)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user