diff --git a/dashboard/src2/components/DomainOwner.vue b/dashboard/src2/components/DomainOwner.vue new file mode 100644 index 0000000..960bdf0 --- /dev/null +++ b/dashboard/src2/components/DomainOwner.vue @@ -0,0 +1,547 @@ + + + \ No newline at end of file diff --git a/dashboard/src2/objects/domain.js b/dashboard/src2/objects/domain.js index 3cf31ce..0f669fa 100644 --- a/dashboard/src2/objects/domain.js +++ b/dashboard/src2/objects/domain.js @@ -180,6 +180,15 @@ export default { props: domain => { return { domain: domain.pg?.name }; } + }, + { + label: '所有者模板', + route: 'owners', + type: 'Component', + component: defineAsyncComponent(() => import('../components/DomainOwner.vue')), + props: domain => { + return { domain: domain.pg?.name }; + } } ], fields: [ diff --git a/jcloud/api/domain_west.py b/jcloud/api/domain_west.py index d28fd08..5111ea9 100644 --- a/jcloud/api/domain_west.py +++ b/jcloud/api/domain_west.py @@ -484,6 +484,23 @@ class WestDomain: return self._make_request('/audit/', 'POST', body_params=encoded_data) + def modify_contact_template(self, template_data: Dict[str, Any]) -> Dict[str, Any]: + """ + 修改实名模板资料 + + Args: + template_data: 模板数据,必须包含c_sysid字段 + """ + if not template_data.get('c_sysid'): + return {"status": "error", "message": "缺少必要参数:c_sysid"} + + body_params = { + 'act': 'auditmod', + **template_data + } + + return self._make_request('/audit/', 'POST', body_params=body_params) + def get_domain_real_info(self, domain: str) -> Dict[str, Any]: """ 获取域名实名信息 @@ -3024,3 +3041,167 @@ def upload_domain_real_name_files(**data): return {"status": "error", "message": "上传实名资料失败,请重试"} +@jingrow.whitelist() +def modify_west_contact_template(**data): + """ + 修改西部数码实名模板资料 + + 必填参数: + - c_sysid: 模板标识 + + 可选参数: + - c_ln_m: (中文)联系人姓 + - c_fn_m: (中文)联系人名 + - c_co: 所属国家简称(CN: 中国, US: 美国) + - cocode: 国家电话代码(+86: 中国, +1: 美国) + - c_st_m: (中文)所属省 + - c_ct_m: (中文)所属市 + - c_dt_m: (中文)所属县 + - c_adr_m: (中文)通讯地址 + - c_pc: 邮编 + - c_ph_type: 联系电话类型(0:手机, 1:座机) + - c_ph: 手机号码(当c_ph_type为0时必填) + - c_ph_code: 座机号码区号(当c_ph_type为1时必填) + - c_ph_num: 座机号码(当c_ph_type为1时必填) + - c_ph_fj: 座机号码分机号(可选) + - c_em: 所有者电子邮箱 + - c_ln: (英文)联系人姓 + - c_fn: (英文)联系人名 + - c_st: (英文)省份 + - c_ct: (英文)城市 + - c_adr: (英文)通讯地址 + - reg_contact_type: 适用范围(hk,gswl等) + - c_idtype_hk: hk域名证件类型 + - c_idnum_hk: hk域名证件号码 + - c_idtype_gswl: 特殊中文域名证件类型 + - c_idnum_gswl: 特殊中文域名证件号码 + """ + client = get_west_client() + if not client: + return {"status": "error", "message": "API客户端初始化失败"} + + # 验证必填字段 + c_sysid = data.get('c_sysid') + if not c_sysid: + return {"status": "error", "message": "缺少必要参数:c_sysid"} + + # 验证电话号码字段(根据c_ph_type判断) + c_ph_type = data.get('c_ph_type', '0') # 默认为手机 + if c_ph_type == '0' and data.get('c_ph'): # 手机 + # 如果提供了手机号码,验证格式 + pass + elif c_ph_type == '1' and (data.get('c_ph_code') or data.get('c_ph_num')): # 座机 + # 如果提供了座机信息,验证完整性 + if data.get('c_ph_code') and not data.get('c_ph_num'): + return {"status": "error", "message": "座机号码 c_ph_num 是必填项"} + if data.get('c_ph_num') and not data.get('c_ph_code'): + return {"status": "error", "message": "座机区号 c_ph_code 是必填项"} + + # 验证字段长度 + if data.get('c_ln_m'): + if len(data['c_ln_m']) < 1 or len(data['c_ln_m']) > 16: + return {"status": "error", "message": "姓(中文)长度必须为1~16位"} + + if data.get('c_fn_m'): + if len(data['c_fn_m']) < 1 or len(data['c_fn_m']) > 64: + return {"status": "error", "message": "名(中文)长度必须为1~64位"} + + if data.get('c_st_m'): + if len(data['c_st_m']) < 2 or len(data['c_st_m']) > 10: + return {"status": "error", "message": "省份(中文)长度必须为2~10位"} + + # 验证完整姓名长度 + if data.get('c_ln_m') and data.get('c_fn_m'): + fullname = data['c_ln_m'] + data['c_fn_m'] + if len(fullname) < 2 or len(fullname) > 64: + return {"status": "error", "message": "完整姓名(中文)长度必须为2~64位"} + + # 生成英文姓名(如果提供了中文姓名) + if data.get('c_ln_m') and data.get('c_fn_m'): + try: + from pypinyin import lazy_pinyin + last_name_pinyin = ' '.join(lazy_pinyin(data['c_ln_m'])) + first_name_pinyin = ' '.join(lazy_pinyin(data['c_fn_m'])) + data['c_ln'] = last_name_pinyin.title() + data['c_fn'] = first_name_pinyin.title() + except ImportError: + # 如果没有pypinyin库,使用默认值 + data['c_ln'] = data.get('c_ln', '') + data['c_fn'] = data.get('c_fn', '') + + # 生成英文地址(如果提供了中文地址) + if data.get('c_adr_m'): + try: + from pypinyin import lazy_pinyin + address_pinyin = ' '.join(lazy_pinyin(data['c_adr_m'])) + data['c_adr'] = address_pinyin.title() + except ImportError: + data['c_adr'] = data.get('c_adr', '') + + # 生成英文省份和城市(如果提供了中文省份和城市) + if data.get('c_st_m'): + try: + from pypinyin import lazy_pinyin + state_pinyin = ' '.join(lazy_pinyin(data['c_st_m'])) + data['c_st'] = state_pinyin.title() + except ImportError: + data['c_st'] = data.get('c_st', '') + + if data.get('c_ct_m'): + try: + from pypinyin import lazy_pinyin + city_pinyin = ' '.join(lazy_pinyin(data['c_ct_m'])) + data['c_ct'] = city_pinyin.title() + except ImportError: + data['c_ct'] = data.get('c_ct', '') + + # 设置默认值 + template_data = { + 'c_sysid': c_sysid, + 'c_co': data.get('c_co', 'CN'), + 'cocode': data.get('cocode', '+86'), + 'c_ph_type': data.get('c_ph_type', '0'), + } + + # 添加可选字段(只添加有值的字段) + optional_fields = [ + 'c_ln_m', 'c_fn_m', 'c_st_m', 'c_ct_m', 'c_dt_m', 'c_adr_m', 'c_pc', + 'c_em', 'c_ln', 'c_fn', 'c_st', 'c_ct', 'c_adr', 'reg_contact_type', + 'c_idtype_hk', 'c_idnum_hk', 'c_idtype_gswl', 'c_idnum_gswl' + ] + + for field in optional_fields: + if data.get(field): + template_data[field] = data[field] + + # 根据c_ph_type添加电话相关字段 + if data.get('c_ph_type') == '1': # 座机 + if data.get('c_ph_code'): + template_data['c_ph_code'] = data['c_ph_code'] + if data.get('c_ph_num'): + template_data['c_ph_num'] = data['c_ph_num'] + if data.get('c_ph_fj'): + template_data['c_ph_fj'] = data['c_ph_fj'] + else: # 手机 + if data.get('c_ph'): + template_data['c_ph'] = data['c_ph'] + + try: + result = client.modify_contact_template(template_data) + + if result.get('result') == 200: + return { + "status": "success", + "message": "实名模板资料修改成功", + "data": { + "c_sysid": result.get('data', {}).get('c_sysid', c_sysid) + } + } + else: + error_msg = result.get('msg', result.get('message', '未知错误')) + return {"status": "error", "message": f"修改实名模板资料失败: {error_msg}"} + + except Exception as e: + return {"status": "error", "message": f"修改实名模板资料失败: {str(e)}"} + +