From 17558faf4999a4f4f86f9498e62c479da3574076 Mon Sep 17 00:00:00 2001 From: wood Date: Mon, 28 Aug 2023 20:56:55 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E7=BB=91=E5=8D=A1=E4=BF=A1?= =?UTF-8?q?=E6=81=AF=E5=92=8C=E7=BB=84=E7=BB=87=E4=BF=A1=E6=81=AF=E5=B1=95?= =?UTF-8?q?=E7=A4=BA=EF=BC=8C=E6=B7=BB=E5=8A=A0=E7=BB=91=E5=8D=A1=E7=9A=84?= =?UTF-8?q?=E8=AF=A6=E7=BB=86=E4=BF=A1=E6=81=AF(=E5=8D=A1=E7=A7=8D?= =?UTF-8?q?=EF=BC=8C=E5=90=8E4=E4=BD=8D=EF=BC=8C=E5=8D=A1=E5=88=B0?= =?UTF-8?q?=E6=9C=9F=E6=97=B6=E9=97=B4=EF=BC=8C=E5=8D=A1=E5=9B=BD=E5=AE=B6?= =?UTF-8?q?)=20Fixes=20#8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- index.html | 58 ++++++++++++++++++++++++++++++++++++++++++------------ 1 file changed, 45 insertions(+), 13 deletions(-) diff --git a/index.html b/index.html index 46faf03..1a2dd56 100644 --- a/index.html +++ b/index.html @@ -409,14 +409,14 @@ 总额度 已使用 剩余量 - 已用比例 + 已用比例 到期时间 GPT-3.5 GPT-4 32K 绑卡 - 绑卡信息 - 组织信息 + 绑卡信息 + 组织信息 是否有效 @@ -456,6 +456,7 @@ const urlSubscription = `${apiUrl}/v1/dashboard/billing/subscription`; let urlUsage = `${apiUrl}/v1/dashboard/billing/usage?start_date=${formatDate(startDate)}&end_date=${formatDate(endDate)}`; const urlsetid = apiUrl + '/v1/organizations'; + const urlPaymentmethods = `${apiUrl}/v1/dashboard/billing/payment_methods`; @@ -524,19 +525,33 @@ let billingAddress = subscriptionData.billing_address; // 定义并赋值 billingAddress let businessAddress = subscriptionData.business_address; // 定义并赋值 businessAddress - SubInformation = "Account Name: " + SubscribleInformation.account_name + "---"; - SubInformation += "PO Number: " + SubscribleInformation.po_number + "---"; - SubInformation += "Billing Email: " + SubscribleInformation.billing_email + "---"; - SubInformation += "Tax IDs: " + SubscribleInformation.tax_ids + "---"; + SubInformation = "名称: " + SubscribleInformation.account_name + "\n"; + SubInformation += "PO号: " + SubscribleInformation.po_number + "\n"; + SubInformation += "帐单邮箱: " + SubscribleInformation.billing_email + "\n"; + SubInformation += "税号: " + SubscribleInformation.tax_ids + "\n"; //使用 JavaScript 的可选链式调用来确定是否为null,避免异常控制台报错 - SubInformation += "Billing Address: " + (billingAddress?.line1 ? billingAddress.line1 : '') + ", " + (billingAddress?.city ? billingAddress.city : '') + ", " + (billingAddress?.state ? billingAddress.state : '') + ", " + (billingAddress?.country ? billingAddress.country : '') + ", " + (billingAddress?.postal_code ? billingAddress.postal_code : '') + "---"; - SubInformation += "Business Address: " + (businessAddress?.line1 ? businessAddress.line1 : '') + ", " + (businessAddress?.city ? businessAddress.city : '') + ", " + (businessAddress?.state ? businessAddress.state : '') + ", " + (businessAddress?.country ? businessAddress.country : '') + ", " + (businessAddress?.postal_code ? businessAddress.postal_code : ''); + SubInformation += "账单地址: " + (billingAddress?.line1 ? billingAddress.line1 : '') + ", " + (billingAddress?.city ? billingAddress.city : '') + ", " + (billingAddress?.state ? billingAddress.state : '') + ", " + (billingAddress?.country ? billingAddress.country : '') + ", " + (billingAddress?.postal_code ? billingAddress.postal_code : '') + "\n"; + SubInformation += "商业地址: " + (businessAddress?.line1 ? businessAddress.line1 : '') + ", " + (businessAddress?.city ? businessAddress.city : '') + ", " + (businessAddress?.state ? businessAddress.state : '') + ", " + (businessAddress?.country ? businessAddress.country : '') + ", " + (businessAddress?.postal_code ? businessAddress.postal_code : '\n'); + // 获取付款方法信息 + response = await fetch(urlPaymentmethods, { headers }); + const paymentMethodsData = await response.json(); + if (paymentMethodsData.data && paymentMethodsData.data.length > 0) { + const paymentMethod = paymentMethodsData.data[0]; + if (paymentMethod.type === 'card' && paymentMethod.card) { + const cardInfo = paymentMethod.card; + SubInformation += `卡种: ${cardInfo.brand} \n`; // Card Brand + SubInformation += `后4位: ${cardInfo.last4} \n`; // Card Last4 + SubInformation += `卡日期: ${cardInfo.exp_month}/${cardInfo.exp_year} \n`; // Card Expiry + SubInformation += `卡国家: ${cardInfo.country}`; // Card Country + } + } } catch (error) { console.error(error); } + //组织信息 try { response = await fetch(urlsetid, { headers }); @@ -558,10 +573,17 @@ if (typeof setiddata.data[1] !== 'undefined') { const id2 = setiddata.data[1].id; - setid = `${title}----${email}----${id1}----${id2}----${name}----${description}----${formattedDate} ${timeAndZone}`; + setid = `${title}\n${email}\n${id1}\n${id2}\n${name}\n${description}\n${formattedDate} ${timeAndZone}`; } else { - setid = `${title}----${email}----${id1}----${name}----${description}----${formattedDate} ${timeAndZone}`; + setid = `${title}\n${email}\n${id1}\n${name}\n${description}\n${formattedDate} ${timeAndZone}`; } + if (typeof setiddata.data[1] !== 'undefined') { + const id2 = setiddata.data[1].id; + setid = `人名: ${title}\n邮箱: ${email}\n组织: ${id1} ${id2}\nUserID:${name}\n\n注册时间:${formattedDate} ${timeAndZone}`; + } else { + setid = `人名: ${title}\n邮箱: ${email}\n组织: ${id1} \nUserID:${name}\n注册时间:${formattedDate} ${timeAndZone}`; + } + } catch (error) { console.error(error); errors['setid'] = error.message; @@ -781,15 +803,25 @@ row.appendChild(GPT432kCheckResult); let isSubscribe = document.createElement("td"); + isSubscribe.style.whiteSpace = "pre"; // 添加这一行来保留换行 isSubscribe.textContent = data[7]; row.appendChild(isSubscribe); let SubInformation = document.createElement("td"); - SubInformation.textContent = data[8]; + let SubInformationContainer = document.createElement("div"); + SubInformationContainer.style.whiteSpace = "pre-wrap"; + SubInformationContainer.textContent = data[8]; + SubInformation.appendChild(SubInformationContainer); row.appendChild(SubInformation); + let setidCell = document.createElement("td"); - setidCell.textContent = data[9]; + let setidCellContainer = document.createElement("div"); + setidCellContainer.style.whiteSpace = "pre-wrap"; + setidCellContainer.textContent = data[9]; + setidCell.appendChild(setidCellContainer); + // setidCell.style.whiteSpace = "pre"; // 添加这一行来保留换行 + // setidCell.textContent = data[9]; row.appendChild(setidCell);