diff --git a/src/components/ServerCard.tsx b/src/components/ServerCard.tsx index 2c3c46e..b0ad92b 100644 --- a/src/components/ServerCard.tsx +++ b/src/components/ServerCard.tsx @@ -66,16 +66,56 @@ export default function ServerCard({ now, serverInfo }: { now: number; serverInf > {name}

- {parsedData && + {parsedData?.billingDataMod && (daysLeft >= 0 ? ( -

- 剩余时间: {isNeverExpire ? "永久" : daysLeft + "天"} -

+ <> +

+ 剩余时间: {isNeverExpire ? "永久" : daysLeft + "天"} +

+ {parsedData.billingDataMod.amount !== "0" ? ( +

+ 价格: {parsedData.billingDataMod.amount}/{parsedData.billingDataMod.cycle} +

+ ) : ( +

免费

+ )} + ) : ( -

- 已过期: {daysLeft * -1} 天 -

+ <> +

+ 已过期: {daysLeft * -1} 天 +

+ {parsedData.billingDataMod.amount !== "0" ? ( +

+ 价格: {parsedData.billingDataMod.amount}/{parsedData.billingDataMod.cycle} +

+ ) : ( +

免费

+ )} + ))} + {parsedData?.planDataMod && ( +
+ {parsedData.planDataMod.bandwidth !== "" && ( +

+ {parsedData.planDataMod.bandwidth} +

+ )} + {parsedData.planDataMod.trafficVol !== "" && ( +

+ {parsedData.planDataMod.trafficVol} +

+ )} +
+ )}
@@ -152,10 +192,60 @@ export default function ServerCard({ now, serverInfo }: { now: number; serverInf > {showFlag ? : null}
-
+

{name}

+ {parsedData?.billingDataMod && + (daysLeft >= 0 ? ( + <> +

+ 剩余时间: {isNeverExpire ? "永久" : daysLeft + "天"} +

+ {parsedData.billingDataMod.amount !== "0" ? ( +

+ 价格: {parsedData.billingDataMod.amount}/{parsedData.billingDataMod.cycle} +

+ ) : ( +

免费

+ )} + + ) : ( + <> +

+ 已过期: {daysLeft * -1} 天 +

+ {parsedData.billingDataMod.amount !== "0" ? ( +

+ 价格: {parsedData.billingDataMod.amount}/{parsedData.billingDataMod.cycle} +

+ ) : ( +

免费

+ )} + + ))} + {parsedData?.planDataMod && ( +
+ {parsedData.planDataMod.bandwidth !== "" && ( +

+ {parsedData.planDataMod.bandwidth} +

+ )} + {parsedData.planDataMod.trafficVol !== "" && ( +

+ {parsedData.planDataMod.trafficVol} +

+ )} +
+ )}
diff --git a/src/components/ServerCardInline.tsx b/src/components/ServerCardInline.tsx index 3ea4f1f..624cc35 100644 --- a/src/components/ServerCardInline.tsx +++ b/src/components/ServerCardInline.tsx @@ -80,20 +80,56 @@ export default function ServerCardInline({ > {name}

- {parsedData && + {parsedData?.billingDataMod && (daysLeft >= 0 ? ( -

- 剩余时间: {isNeverExpire ? "永久" : daysLeft + "天"} -

+ <> +

+ 剩余时间: {isNeverExpire ? "永久" : daysLeft + "天"} +

+ {parsedData.billingDataMod.amount !== "0" ? ( +

+ 价格: {parsedData.billingDataMod.amount}/{parsedData.billingDataMod.cycle} +

+ ) : ( +

免费

+ )} + ) : ( -

- 已过期: {daysLeft * -1} 天 -

+ <> +

+ 已过期: {daysLeft * -1} 天 +

+ {parsedData.billingDataMod.amount !== "0" ? ( +

+ 价格: {parsedData.billingDataMod.amount}/{parsedData.billingDataMod.cycle} +

+ ) : ( +

免费

+ )} + ))} + {parsedData?.planDataMod && ( +
+ {parsedData.planDataMod.bandwidth !== "" && ( +

+ {parsedData.planDataMod.bandwidth} +

+ )} + {parsedData.planDataMod.trafficVol !== "" && ( +

+ {parsedData.planDataMod.trafficVol} +

+ )} +
+ )}
@@ -190,7 +226,7 @@ export default function ServerCardInline({ > {showFlag ? : null} -
+

{name}

+ {parsedData?.billingDataMod && + (daysLeft >= 0 ? ( + <> +

+ 剩余时间: {isNeverExpire ? "永久" : daysLeft + "天"} +

+ {parsedData.billingDataMod.amount !== "0" ? ( +

+ 价格: {parsedData.billingDataMod.amount}/{parsedData.billingDataMod.cycle} +

+ ) : ( +

免费

+ )} + + ) : ( + <> +

+ 已过期: {daysLeft * -1} 天 +

+ {parsedData.billingDataMod.amount !== "0" ? ( +

+ 价格: {parsedData.billingDataMod.amount}/{parsedData.billingDataMod.cycle} +

+ ) : ( +

免费

+ )} + + ))} + {parsedData?.planDataMod && ( +
+ {parsedData.planDataMod.bandwidth !== "" && ( +

+ {parsedData.planDataMod.bandwidth} +

+ )} + {parsedData.planDataMod.trafficVol !== "" && ( +

+ {parsedData.planDataMod.trafficVol} +

+ )} +
+ )}
diff --git a/src/lib/utils.ts b/src/lib/utils.ts index ca3b643..2510011 100644 --- a/src/lib/utils.ts +++ b/src/lib/utils.ts @@ -127,19 +127,19 @@ interface BillingData { amount: string } -// interface PlanData { -// bandwidth: string; -// trafficVol: string; -// trafficType: string; -// IPv4: string; -// IPv6: string; -// networkRoute: string; -// extra: string; -// } +interface PlanData { + bandwidth: string + trafficVol: string + trafficType: string + IPv4: string + IPv6: string + networkRoute: string + extra: string +} interface PublicNoteData { billingDataMod: BillingData - // planDataMod: PlanData; + planDataMod: PlanData } export function parsePublicNote(publicNote: string): PublicNoteData | null { @@ -156,15 +156,15 @@ export function parsePublicNote(publicNote: string): PublicNoteData | null { cycle: data.billingDataMod.cycle || "", amount: data.billingDataMod.amount || "", }, - // planDataMod: { - // bandwidth: data.planDataMod.bandwidth || "", - // trafficVol: data.planDataMod.trafficVol || "", - // trafficType: data.planDataMod.trafficType || "", - // IPv4: data.planDataMod.IPv4 || "", - // IPv6: data.planDataMod.IPv6 || "", - // networkRoute: data.planDataMod.networkRoute || "", - // extra: data.planDataMod.extra || "", - // }, + planDataMod: { + bandwidth: data.planDataMod.bandwidth || "", + trafficVol: data.planDataMod.trafficVol || "", + trafficType: data.planDataMod.trafficType || "", + IPv4: data.planDataMod.IPv4 || "", + IPv6: data.planDataMod.IPv6 || "", + networkRoute: data.planDataMod.networkRoute || "", + extra: data.planDataMod.extra || "", + }, } } catch (error) { console.error("Error parsing public note:", error)