优化实名资料上传窗口及删除相关前后端的调试日志
This commit is contained in:
parent
3a998b2d08
commit
b7ad258efd
@ -1,5 +1,5 @@
|
|||||||
<template>
|
<template>
|
||||||
<Dialog v-bind="$attrs" :options="{ title: '实名材料', size: 'lg' }" v-model="show">
|
<Dialog v-bind="$attrs" :options="{ title: '实名资料上传', size: 'lg' }" v-model="show">
|
||||||
<template #body-content>
|
<template #body-content>
|
||||||
<div class="p-4 sm:p-6">
|
<div class="p-4 sm:p-6">
|
||||||
<div class="space-y-4">
|
<div class="space-y-4">
|
||||||
@ -37,9 +37,15 @@
|
|||||||
v-model="formData.idType"
|
v-model="formData.idType"
|
||||||
class="px-3 py-1.5 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent bg-white text-sm"
|
class="px-3 py-1.5 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent bg-white text-sm"
|
||||||
>
|
>
|
||||||
<option value="idcard">身份证</option>
|
<option value="SFZ">身份证</option>
|
||||||
<option value="passport">护照</option>
|
<option value="HZ">护照</option>
|
||||||
<option value="other">其他证件</option>
|
<option value="GAJMTX">港澳居民来往内地通行证</option>
|
||||||
|
<option value="TWJMTX">台湾居民来往大陆通行证</option>
|
||||||
|
<option value="WJLSFZ">外国人永久居留身份证</option>
|
||||||
|
<option value="GAJZZ">港澳台居民居住证</option>
|
||||||
|
<option value="ORG">组织机构代码证</option>
|
||||||
|
<option value="YYZZ">工商营业执照</option>
|
||||||
|
<option value="TYDM">统一社会信用代码证书</option>
|
||||||
</select>
|
</select>
|
||||||
<input
|
<input
|
||||||
type="text"
|
type="text"
|
||||||
@ -135,7 +141,7 @@
|
|||||||
@click="submitUpload"
|
@click="submitUpload"
|
||||||
:disabled="loading || !isValid"
|
:disabled="loading || !isValid"
|
||||||
>
|
>
|
||||||
{{ loading ? '提交中...' : '立即提交' }}
|
{{ loading ? '提交中...' : '提交' }}
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
@ -161,7 +167,7 @@ export default {
|
|||||||
show: true,
|
show: true,
|
||||||
loading: false,
|
loading: false,
|
||||||
formData: {
|
formData: {
|
||||||
idType: 'idcard',
|
idType: 'SFZ',
|
||||||
idNumber: ''
|
idNumber: ''
|
||||||
},
|
},
|
||||||
uploadedFiles: []
|
uploadedFiles: []
|
||||||
@ -177,7 +183,7 @@ export default {
|
|||||||
return {
|
return {
|
||||||
url: 'jcloud.api.domain_west.get_domain_owner',
|
url: 'jcloud.api.domain_west.get_domain_owner',
|
||||||
params: {
|
params: {
|
||||||
name: this.domainDoc?.owner
|
name: this.domainDoc?.domain_owner
|
||||||
},
|
},
|
||||||
onSuccess: (response) => {
|
onSuccess: (response) => {
|
||||||
return response;
|
return response;
|
||||||
@ -236,15 +242,8 @@ export default {
|
|||||||
// 创建FormData对象
|
// 创建FormData对象
|
||||||
const formData = new FormData();
|
const formData = new FormData();
|
||||||
|
|
||||||
// 添加基本信息
|
// 获取域名
|
||||||
console.log('domainDoc 完整对象:', JSON.stringify(this.domainDoc, null, 2));
|
|
||||||
console.log('domainDoc.domain:', this.domainDoc?.domain);
|
|
||||||
console.log('domainDoc.name:', this.domainDoc?.name);
|
|
||||||
console.log('this.domain:', this.domain);
|
|
||||||
|
|
||||||
// 优先使用 domainDoc.domain,如果没有则使用 this.domain
|
|
||||||
const domain = this.domainDoc?.domain || this.domain;
|
const domain = this.domainDoc?.domain || this.domain;
|
||||||
console.log('提交的域名:', domain);
|
|
||||||
|
|
||||||
// 验证域名是否有效
|
// 验证域名是否有效
|
||||||
if (!domain || domain === '36h8on65rd') {
|
if (!domain || domain === '36h8on65rd') {
|
||||||
@ -278,21 +277,10 @@ export default {
|
|||||||
|
|
||||||
if (xhr.status === 200) {
|
if (xhr.status === 200) {
|
||||||
try {
|
try {
|
||||||
console.log('原始响应文本:', xhr.responseText);
|
|
||||||
const response = JSON.parse(xhr.responseText);
|
const response = JSON.parse(xhr.responseText);
|
||||||
console.log('解析后的响应:', response);
|
|
||||||
|
|
||||||
console.log('响应状态检查:', {
|
|
||||||
response: response,
|
|
||||||
responseKeys: Object.keys(response || {}),
|
|
||||||
message: response?.message,
|
|
||||||
status: response?.status,
|
|
||||||
statusType: typeof response?.status
|
|
||||||
});
|
|
||||||
|
|
||||||
// Jingrow 响应格式:{message: {...}}
|
// Jingrow 响应格式:{message: {...}}
|
||||||
if (response && response.message && response.message.status === "success") {
|
if (response && response.message && response.message.status === "success") {
|
||||||
console.log('实名资料上传成功:', response.message.message || '请等待审核');
|
|
||||||
// 直接关闭弹窗,不显示 toast
|
// 直接关闭弹窗,不显示 toast
|
||||||
this.$emit('success');
|
this.$emit('success');
|
||||||
this.$emit('close');
|
this.$emit('close');
|
||||||
@ -344,26 +332,20 @@ export default {
|
|||||||
},
|
},
|
||||||
async loadOwnerInfo() {
|
async loadOwnerInfo() {
|
||||||
try {
|
try {
|
||||||
if (this.domainDoc && this.domainDoc.owner) {
|
if (this.domainDoc && this.domainDoc.domain_owner) {
|
||||||
// 获取域名所有者信息
|
// 获取域名所有者信息
|
||||||
const response = await this.$resources.getOwnerInfo.submit();
|
const response = await this.$resources.getOwnerInfo.submit();
|
||||||
|
|
||||||
if (response && response.status === 'Success' && response.data) {
|
if (response && response.status === 'Success' && response.data) {
|
||||||
const owner = response.data;
|
const owner = response.data;
|
||||||
|
|
||||||
// 填充身份证号码
|
// 填充身份证号码
|
||||||
if (owner.c_idnum_gswl) {
|
if (owner.c_idnum_gswl) {
|
||||||
this.formData.idNumber = owner.c_idnum_gswl;
|
this.formData.idNumber = owner.c_idnum_gswl;
|
||||||
}
|
}
|
||||||
// 填充证件类型
|
// 填充证件类型
|
||||||
if (owner.c_idtype_gswl) {
|
if (owner.c_idtype_gswl) {
|
||||||
// 映射证件类型
|
this.formData.idType = owner.c_idtype_gswl;
|
||||||
if (owner.c_idtype_gswl === 'SFZ') {
|
|
||||||
this.formData.idType = 'idcard';
|
|
||||||
} else if (owner.c_idtype_gswl === 'HZ') {
|
|
||||||
this.formData.idType = 'passport';
|
|
||||||
} else {
|
|
||||||
this.formData.idType = 'other';
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2861,9 +2861,6 @@ def upload_domain_real_name_files(**data):
|
|||||||
"""上传域名实名资料文件"""
|
"""上传域名实名资料文件"""
|
||||||
import base64
|
import base64
|
||||||
|
|
||||||
# 调试:打印接收到的参数
|
|
||||||
jingrow.log_error("上传实名资料参数", str(data))
|
|
||||||
|
|
||||||
# 尝试从jingrow.request中获取参数
|
# 尝试从jingrow.request中获取参数
|
||||||
try:
|
try:
|
||||||
# 检查是否是FormData格式
|
# 检查是否是FormData格式
|
||||||
@ -2872,13 +2869,10 @@ def upload_domain_real_name_files(**data):
|
|||||||
request_data = {}
|
request_data = {}
|
||||||
for key in jingrow.request.form:
|
for key in jingrow.request.form:
|
||||||
request_data[key] = jingrow.request.form[key]
|
request_data[key] = jingrow.request.form[key]
|
||||||
jingrow.log_error("FormData参数", str(request_data))
|
|
||||||
else:
|
else:
|
||||||
# 处理JSON格式
|
# 处理JSON格式
|
||||||
request_data = jingrow.request.get_json() if jingrow.request.is_json else {}
|
request_data = jingrow.request.get_json() if jingrow.request.is_json else {}
|
||||||
jingrow.log_error("request.get_json()", str(request_data))
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
jingrow.log_error("获取请求参数失败", str(e))
|
|
||||||
request_data = {}
|
request_data = {}
|
||||||
|
|
||||||
client = get_west_client()
|
client = get_west_client()
|
||||||
@ -2897,24 +2891,17 @@ def upload_domain_real_name_files(**data):
|
|||||||
id_number = (data.get('idNumber') or
|
id_number = (data.get('idNumber') or
|
||||||
request_data.get('idNumber'))
|
request_data.get('idNumber'))
|
||||||
|
|
||||||
# 调试:打印提取的参数
|
|
||||||
jingrow.log_error("提取的参数", f"domain: {domain}, id_type: {id_type}, id_number: {id_number}")
|
|
||||||
|
|
||||||
if not all([domain, id_number]):
|
if not all([domain, id_number]):
|
||||||
return {"status": "error", "message": f"缺少必要参数:domain={domain}, idNumber={id_number}"}
|
return {"status": "error", "message": f"缺少必要参数:domain={domain}, idNumber={id_number}"}
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# 获取域名信息
|
# 获取域名信息
|
||||||
jingrow.log_error("开始查询域名", f"查询域名: {domain}")
|
|
||||||
domain_list = jingrow.get_list("Jsite Domain", filters={"domain": domain})
|
domain_list = jingrow.get_list("Jsite Domain", filters={"domain": domain})
|
||||||
jingrow.log_error("查询结果", f"找到 {len(domain_list)} 条记录")
|
|
||||||
|
|
||||||
if domain_list:
|
if domain_list:
|
||||||
domain_name = domain_list[0].get('name')
|
domain_name = domain_list[0].get('name')
|
||||||
jingrow.log_error("域名name", f"域名name: {domain_name}")
|
|
||||||
# 通过name获取完整的域名信息
|
# 通过name获取完整的域名信息
|
||||||
domain_info = jingrow.get_pg("Jsite Domain", domain_name)
|
domain_info = jingrow.get_pg("Jsite Domain", domain_name)
|
||||||
jingrow.log_error("完整域名信息", f"域名记录: {domain_info}")
|
|
||||||
else:
|
else:
|
||||||
return {"status": "error", "message": f"未找到主域名{domain}"}
|
return {"status": "error", "message": f"未找到主域名{domain}"}
|
||||||
|
|
||||||
@ -2932,8 +2919,19 @@ def upload_domain_real_name_files(**data):
|
|||||||
if not c_sysid:
|
if not c_sysid:
|
||||||
return {"status": "error", "message": "域名所有者未关联西部数码ID"}
|
return {"status": "error", "message": "域名所有者未关联西部数码ID"}
|
||||||
|
|
||||||
# 证件类型映射
|
# 证件类型映射到西部数码参数
|
||||||
f_type_org = "1" if id_type == "idcard" else "2" # 1=身份证, 2=护照
|
id_type_map = {
|
||||||
|
"SFZ": "1", # 身份证
|
||||||
|
"HZ": "5", # 护照
|
||||||
|
"GAJMTX": "6", # 港澳居民来往内地通行证
|
||||||
|
"TWJMTX": "11", # 台湾居民来往大陆通行证
|
||||||
|
"WJLSFZ": "12", # 外国人永久居留身份证
|
||||||
|
"GAJZZ": "30", # 港澳台居民居住证
|
||||||
|
"ORG": "2", # 组织机构代码证
|
||||||
|
"YYZZ": "3", # 工商营业执照
|
||||||
|
"TYDM": "4" # 统一社会信用代码证书
|
||||||
|
}
|
||||||
|
f_type_org = id_type_map.get(id_type, "1") # 默认使用身份证
|
||||||
f_code_org = id_number
|
f_code_org = id_number
|
||||||
|
|
||||||
# 获取上传token
|
# 获取上传token
|
||||||
@ -2951,14 +2949,8 @@ def upload_domain_real_name_files(**data):
|
|||||||
# 处理文件上传 - 从FormData中提取文件并转换为base64
|
# 处理文件上传 - 从FormData中提取文件并转换为base64
|
||||||
files = []
|
files = []
|
||||||
|
|
||||||
# 调试:打印所有可用的数据源
|
|
||||||
jingrow.log_error("调试文件上传", f"data keys: {list(data.keys()) if data else 'None'}")
|
|
||||||
jingrow.log_error("调试文件上传", f"request.files: {list(jingrow.request.files.keys()) if hasattr(jingrow.request, 'files') and jingrow.request.files else 'None'}")
|
|
||||||
jingrow.log_error("调试文件上传", f"form_dict keys: {list(jingrow.form_dict.keys()) if hasattr(jingrow, 'form_dict') else 'None'}")
|
|
||||||
|
|
||||||
# 从jingrow.request.files中获取文件
|
# 从jingrow.request.files中获取文件
|
||||||
if hasattr(jingrow.request, 'files') and jingrow.request.files:
|
if hasattr(jingrow.request, 'files') and jingrow.request.files:
|
||||||
jingrow.log_error("request.files keys", str(list(jingrow.request.files.keys())))
|
|
||||||
for key in jingrow.request.files:
|
for key in jingrow.request.files:
|
||||||
file_obj = jingrow.request.files[key]
|
file_obj = jingrow.request.files[key]
|
||||||
if hasattr(file_obj, 'read'):
|
if hasattr(file_obj, 'read'):
|
||||||
@ -2966,40 +2958,33 @@ def upload_domain_real_name_files(**data):
|
|||||||
file_content = file_obj.read()
|
file_content = file_obj.read()
|
||||||
file_base64 = base64.b64encode(file_content).decode('utf-8')
|
file_base64 = base64.b64encode(file_content).decode('utf-8')
|
||||||
files.append(file_base64)
|
files.append(file_base64)
|
||||||
jingrow.log_error(f"处理文件: {key}, 大小: {len(file_content)} bytes")
|
|
||||||
|
|
||||||
# 如果从request.files中没有找到文件,尝试从data中获取
|
# 如果从request.files中没有找到文件,尝试从data中获取
|
||||||
if not files:
|
if not files:
|
||||||
jingrow.log_error("从data中查找文件", str(list(data.keys())))
|
|
||||||
for key, value in data.items():
|
for key, value in data.items():
|
||||||
if key.startswith('files_') and hasattr(value, 'read'):
|
if key.startswith('files_') and hasattr(value, 'read'):
|
||||||
# 读取文件内容并转换为base64
|
# 读取文件内容并转换为base64
|
||||||
file_content = value.read()
|
file_content = value.read()
|
||||||
file_base64 = base64.b64encode(file_content).decode('utf-8')
|
file_base64 = base64.b64encode(file_content).decode('utf-8')
|
||||||
files.append(file_base64)
|
files.append(file_base64)
|
||||||
jingrow.log_error(f"从data处理文件: {key}, 大小: {len(file_content)} bytes")
|
|
||||||
|
|
||||||
# 如果还是没有文件,尝试从data.files中获取(前端传递的文件数组)
|
# 如果还是没有文件,尝试从data.files中获取(前端传递的文件数组)
|
||||||
if not files and 'files' in data:
|
if not files and 'files' in data:
|
||||||
jingrow.log_error("从data.files中获取文件", str(len(data['files'])))
|
|
||||||
for file_obj in data['files']:
|
for file_obj in data['files']:
|
||||||
if hasattr(file_obj, 'read'):
|
if hasattr(file_obj, 'read'):
|
||||||
# 读取文件内容并转换为base64
|
# 读取文件内容并转换为base64
|
||||||
file_content = file_obj.read()
|
file_content = file_obj.read()
|
||||||
file_base64 = base64.b64encode(file_content).decode('utf-8')
|
file_base64 = base64.b64encode(file_content).decode('utf-8')
|
||||||
files.append(file_base64)
|
files.append(file_base64)
|
||||||
jingrow.log_error(f"从data.files处理文件, 大小: {len(file_content)} bytes")
|
|
||||||
|
|
||||||
# 如果还是没有文件,尝试从jingrow.form_dict中获取
|
# 如果还是没有文件,尝试从jingrow.form_dict中获取
|
||||||
if not files and hasattr(jingrow, 'form_dict'):
|
if not files and hasattr(jingrow, 'form_dict'):
|
||||||
jingrow.log_error("从form_dict中查找文件", str(list(jingrow.form_dict.keys())))
|
|
||||||
for key, value in jingrow.form_dict.items():
|
for key, value in jingrow.form_dict.items():
|
||||||
if key.startswith('files_') and hasattr(value, 'read'):
|
if key.startswith('files_') and hasattr(value, 'read'):
|
||||||
# 读取文件内容并转换为base64
|
# 读取文件内容并转换为base64
|
||||||
file_content = value.read()
|
file_content = value.read()
|
||||||
file_base64 = base64.b64encode(file_content).decode('utf-8')
|
file_base64 = base64.b64encode(file_content).decode('utf-8')
|
||||||
files.append(file_base64)
|
files.append(file_base64)
|
||||||
jingrow.log_error(f"从form_dict处理文件: {key}, 大小: {len(file_content)} bytes")
|
|
||||||
|
|
||||||
if not files:
|
if not files:
|
||||||
return {"status": "error", "message": "请上传证件材料"}
|
return {"status": "error", "message": "请上传证件材料"}
|
||||||
@ -3010,11 +2995,7 @@ def upload_domain_real_name_files(**data):
|
|||||||
|
|
||||||
upload_response = client.upload_real_name_files(token, file_org, file_lxr)
|
upload_response = client.upload_real_name_files(token, file_org, file_lxr)
|
||||||
|
|
||||||
# 打印西部数码API响应
|
|
||||||
jingrow.log_error("西部数码API响应", str(upload_response))
|
|
||||||
|
|
||||||
if upload_response.get("status") == "error":
|
if upload_response.get("status") == "error":
|
||||||
jingrow.log_error("西部数码API错误", str(upload_response))
|
|
||||||
return upload_response
|
return upload_response
|
||||||
|
|
||||||
# 解析响应
|
# 解析响应
|
||||||
@ -3022,8 +3003,6 @@ def upload_domain_real_name_files(**data):
|
|||||||
result = d.get("Result")
|
result = d.get("Result")
|
||||||
msg = d.get("Msg", "")
|
msg = d.get("Msg", "")
|
||||||
|
|
||||||
jingrow.log_error("解析结果", f"result: {result}, msg: {msg}")
|
|
||||||
|
|
||||||
if result == 200:
|
if result == 200:
|
||||||
response_data = {
|
response_data = {
|
||||||
"status": "success",
|
"status": "success",
|
||||||
@ -3033,18 +3012,15 @@ def upload_domain_real_name_files(**data):
|
|||||||
"msg": msg
|
"msg": msg
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
jingrow.log_error("返回成功响应", str(response_data))
|
|
||||||
return response_data
|
return response_data
|
||||||
else:
|
else:
|
||||||
response_data = {
|
response_data = {
|
||||||
"status": "error",
|
"status": "error",
|
||||||
"message": f"实名资料上传失败: {msg}"
|
"message": f"实名资料上传失败: {msg}"
|
||||||
}
|
}
|
||||||
jingrow.log_error("返回错误响应", str(response_data))
|
|
||||||
return response_data
|
return response_data
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
jingrow.log_error("上传实名资料失败", str(e))
|
|
||||||
return {"status": "error", "message": "上传实名资料失败,请重试"}
|
return {"status": "error", "message": "上传实名资料失败,请重试"}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user