From b8ae5c7b3dd34cedd82e11e66fe9996ea82b3651 Mon Sep 17 00:00:00 2001 From: jingrow Date: Sun, 3 Aug 2025 15:29:33 +0800 Subject: [PATCH] =?UTF-8?q?=E5=9F=9F=E5=90=8D=E8=AF=A6=E6=83=85=E9=A1=B5?= =?UTF-8?q?=E5=AE=9E=E5=90=8D=E8=AE=A4=E8=AF=81=E6=A3=80=E6=B5=8B=E9=80=9A?= =?UTF-8?q?=E8=BF=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src2/components/JsiteDomainOverview.vue | 120 ++++- .../JsiteDomainRealNameInfoDialog.vue | 318 ++++++++++++ .../JsiteDomainUploadRealNameDialog.vue | 468 ++++++++++++++++++ jcloud/api/domain_west.py | 164 ++++++ 4 files changed, 1069 insertions(+), 1 deletion(-) create mode 100644 dashboard/src2/components/JsiteDomainRealNameInfoDialog.vue create mode 100644 dashboard/src2/components/JsiteDomainUploadRealNameDialog.vue diff --git a/dashboard/src2/components/JsiteDomainOverview.vue b/dashboard/src2/components/JsiteDomainOverview.vue index 705a81f..1abd346 100644 --- a/dashboard/src2/components/JsiteDomainOverview.vue +++ b/dashboard/src2/components/JsiteDomainOverview.vue @@ -9,7 +9,49 @@
-
+
+ +
+
+
+
+
+ + + + 实名认证 +
+ +
+
+
+ + + + 待实名认证 +
+ +
+
+
+
+
到期时间:{{ $format.date($domain.pg.end_date) }} @@ -158,6 +200,8 @@ export default { autoRenewLoading: false, whoisProtectionLoading: false, domainOwner: null, + realNameStatus: 'unverified', // 实名认证状态:verified, unverified + realNameInfo: null, // 实名认证信息 }; }, methods: { @@ -196,6 +240,7 @@ export default { async getDomainOwner() { if (!this.$domain.pg?.domain_owner) { this.domainOwner = null; + this.realNameStatus = 'unverified'; return; } @@ -208,17 +253,33 @@ export default { onSuccess: (response) => { if (response && response.status === "Success" && response.data) { this.domainOwner = response.data; + // 根据域名所有者记录的r_status字段设置实名认证状态 + // r_status是check字段类型,1表示已认证,0表示未认证 + const rStatus = response.data.r_status; + + // 对于check字段,将值转换为布尔值进行判断 + const isVerified = Boolean(rStatus && (rStatus === 1 || rStatus === '1' || rStatus === true)); + + if (isVerified) { + this.realNameStatus = 'verified'; + } else { + this.realNameStatus = 'unverified'; + } + } else { + this.realNameStatus = 'unverified'; } }, onError: (error) => { console.error('获取域名所有者信息失败:', error); this.domainOwner = null; + this.realNameStatus = 'unverified'; } }); getOwnerRequest.submit(); } catch (error) { console.error('获取域名所有者信息失败:', error); this.domainOwner = null; + this.realNameStatus = 'unverified'; } }, renewDomain() { @@ -323,6 +384,58 @@ export default { toast.success('域名续费成功!'); this.$domain.reload(); }, + // 显示实名认证信息 + showRealNameInfo() { + const JsiteDomainRealNameInfoDialog = defineAsyncComponent(() => import('./JsiteDomainRealNameInfoDialog.vue')); + + renderDialog(h(JsiteDomainRealNameInfoDialog, { + domain: this.domain, + domainDoc: this.$domain.pg, + realNameInfo: this.realNameInfo + })); + }, + // 显示上传实名资料 + showUploadRealName() { + const JsiteDomainUploadRealNameDialog = defineAsyncComponent(() => import('./JsiteDomainUploadRealNameDialog.vue')); + + renderDialog(h(JsiteDomainUploadRealNameDialog, { + domain: this.domain, + domainDoc: this.$domain.pg, + onSuccess: this.onUploadSuccess + })); + }, + // 上传成功回调 + onUploadSuccess() { + toast.success('实名资料上传成功!'); + this.getDomainOwner(); // 重新获取域名所有者信息(包含实名认证状态) + this.getRealNameInfo(); // 重新获取实名详细信息 + }, + // 获取域名实名认证信息 + async getRealNameInfo() { + if (!this.$domain.pg?.domain) { + return; + } + + try { + const getRealNameRequest = createResource({ + url: 'jcloud.api.domain_west.get_west_domain_real_info', + params: { + domain: this.$domain.pg.domain + }, + onSuccess: (response) => { + if (response && response.status === "success" && response.data) { + this.realNameInfo = response.data; + } + }, + onError: (error) => { + console.error('获取域名实名信息失败:', error); + } + }); + getRealNameRequest.submit(); + } catch (error) { + console.error('获取域名实名信息失败:', error); + } + }, }, watch: { // 监听域名数据变化,重新获取所有者信息 @@ -332,6 +445,7 @@ export default { this.getDomainOwner(); } else { this.domainOwner = null; + this.realNameStatus = 'unverified'; } }, immediate: true @@ -366,7 +480,11 @@ export default { // 初始化时获取域名所有者信息 if (this.$domain.pg?.domain_owner) { this.getDomainOwner(); + } else { + this.realNameStatus = 'unverified'; } + // 获取域名实名认证信息 + this.getRealNameInfo(); }, }; \ No newline at end of file diff --git a/dashboard/src2/components/JsiteDomainRealNameInfoDialog.vue b/dashboard/src2/components/JsiteDomainRealNameInfoDialog.vue new file mode 100644 index 0000000..4a27bb3 --- /dev/null +++ b/dashboard/src2/components/JsiteDomainRealNameInfoDialog.vue @@ -0,0 +1,318 @@ + + + \ No newline at end of file diff --git a/dashboard/src2/components/JsiteDomainUploadRealNameDialog.vue b/dashboard/src2/components/JsiteDomainUploadRealNameDialog.vue new file mode 100644 index 0000000..5727f30 --- /dev/null +++ b/dashboard/src2/components/JsiteDomainUploadRealNameDialog.vue @@ -0,0 +1,468 @@ + + + \ No newline at end of file diff --git a/jcloud/api/domain_west.py b/jcloud/api/domain_west.py index 7b35951..2666005 100644 --- a/jcloud/api/domain_west.py +++ b/jcloud/api/domain_west.py @@ -417,6 +417,83 @@ class WestDomain: } return self._make_request('/audit/', 'POST', body_params=body_params) + def get_upload_token(self, c_sysid: str, f_type_org: str, f_code_org: str, + f_type_lxr: Optional[str] = None, f_code_lxr: Optional[str] = None) -> Dict[str, Any]: + """ + 获取实名上传token + + Args: + c_sysid: 模板标识 + f_type_org: 证件类型,详情见附录 + f_code_org: 证件号码 + f_type_lxr: 联系人证件类型(企业时填写) + f_code_lxr: 联系人证件号码(企业时填写) + + Returns: + API响应结果,包含上传token + """ + body_params = { + 'act': 'uploadwcftoken', + 'c_sysid': c_sysid, + 'f_type_org': f_type_org, + 'f_code_org': f_code_org, + } + + # 添加可选参数 + if f_type_lxr: + body_params['f_type_lxr'] = f_type_lxr + if f_code_lxr: + body_params['f_code_lxr'] = f_code_lxr + + return self._make_request('/audit/', 'POST', body_params=body_params) + + def upload_real_name_files(self, token: str, file_org: str, file_lxr: Optional[str] = None) -> Dict[str, Any]: + """ + 模板实名资料上传 + + Args: + token: 实名上传Token + file_org: 图片完整的base64 + file_lxr: 企业联系人图片完整的base64(只有token中设置了联系人的才上传) + + Returns: + API响应结果 + """ + upload_url = "https://netservice.vhostgo.com/wcfservice/Service1.svc/Wcf_AuditUploadFile" + + # 构建请求数据 + data = { + 'token': token, + 'file_org': file_org, + } + + # 添加可选参数 + if file_lxr: + data['file_lxr'] = file_lxr + + headers = { + 'Content-Type': 'application/json' + } + + try: + # 发送JSON格式的POST请求 + jingrow.log_error("西部数码实名上传调试", f"发送POST请求,URL: {upload_url}, 数据: {data}") + response = requests.post(upload_url, json=data, headers=headers, timeout=30) + + response.raise_for_status() + + try: + result = response.json() + except json.JSONDecodeError: + jingrow.log_error("西部数码实名上传响应解析失败", response_text=response.text) + result = {"status": "error", "message": "无法解析API响应"} + + return result + + except requests.exceptions.RequestException as e: + jingrow.log_error("西部数码实名上传请求失败", error=str(e), url=upload_url) + return {"status": "error", "message": f"API请求失败: {str(e)}"} + def format_date(date): """格式化域名到期时间""" @@ -1221,6 +1298,7 @@ def get_domain_owner(name): # 返回所有者信息 owner_data = { "name": domain_owner.name, + "r_status": domain_owner.r_status, "title": domain_owner.title, "fullname": domain_owner.fullname, "c_regtype": domain_owner.c_regtype, @@ -1708,3 +1786,89 @@ def get_west_domain_real_info(**data): except Exception as e: jingrow.log_error("域名实名信息查询响应解析失败", error=str(e)) return {"status": "error", "message": "域名实名信息查询响应解析失败"} + + +@jingrow.whitelist() +def get_west_upload_token(**data): + """获取西部数码实名上传token""" + client = get_west_client() + if not client: + return {"status": "error", "message": "API客户端初始化失败"} + + c_sysid = data.get('c_sysid') + f_type_org = data.get('f_type_org') + f_code_org = data.get('f_code_org') + f_type_lxr = data.get('f_type_lxr') + f_code_lxr = data.get('f_code_lxr') + + if not all([c_sysid, f_type_org, f_code_org]): + return {"status": "error", "message": "缺少必要参数:c_sysid, f_type_org, f_code_org"} + + response = client.get_upload_token(c_sysid, f_type_org, f_code_org, f_type_lxr, f_code_lxr) + + if response.get("status") == "error": + return response + + try: + # 检查响应格式 + if response.get("result") != 200: + return {"status": "error", "message": "API查询失败"} + + return { + "status": "success", + "data": { + "token": response.get("data"), + "clientid": response.get("clientid") + } + } + + except Exception as e: + jingrow.log_error("获取实名上传token响应解析失败", error=str(e)) + return {"status": "error", "message": "获取实名上传token响应解析失败"} + + +@jingrow.whitelist() +def west_upload_real_name_files(**data): + """西部数码模板实名资料上传""" + client = get_west_client() + if not client: + return {"status": "error", "message": "API客户端初始化失败"} + + token = data.get('token') + file_org = data.get('file_org') + file_lxr = data.get('file_lxr') + + if not all([token, file_org]): + return {"status": "error", "message": "缺少必要参数:token, file_org"} + + response = client.upload_real_name_files(token, file_org, file_lxr) + + if response.get("status") == "error": + return response + + try: + # 解析响应格式 + d = response.get("d", {}) + result = d.get("Result") + msg = d.get("Msg", "") + + if result == 200: + return { + "status": "success", + "message": "实名资料上传成功", + "data": { + "result": result, + "msg": msg + } + } + else: + return { + "status": "error", + "message": f"实名资料上传失败: {msg}" + } + + except Exception as e: + jingrow.log_error("实名资料上传响应解析失败", error=str(e)) + return {"status": "error", "message": "实名资料上传响应解析失败"} + +