update subscription

This commit is contained in:
Zhang Minghan 2023-10-08 22:29:15 +08:00
parent 73788c3b59
commit 322327f64b
3 changed files with 17 additions and 3 deletions

View File

@ -123,6 +123,7 @@ const resources = {
3: "3 Months",
6: "6 Months",
12: "1 Year",
36: "3 Years",
},
success: "Subscribe success",
"success-prompt":
@ -284,6 +285,7 @@ const resources = {
3: "3个月",
6: "半年",
12: "1年",
36: "3年",
},
success: "订阅成功",
"success-prompt": "您已成功订阅 {{month}} 月专业版。",
@ -449,6 +451,7 @@ const resources = {
3: "3 месяца",
6: "6 месяцев",
12: "1 год",
36: "3 года",
},
success: "Подписка успешна",
"success-prompt": "Вы успешно подписались на {{month}} месяцев Pro.",

View File

@ -115,6 +115,12 @@ function Upgrade({ children }: UpgradeProps) {
{t(`percent`, { cent: 8 })}
</Badge>
</SelectItem>
<SelectItem value={"36"}>
{t(`sub.time.36`)}
<Badge className={`ml-2 cent`}>
{t(`percent`, { cent: 7 })}
</Badge>
</SelectItem>
</SelectContent>
</Select>
<p className={`price`}>

View File

@ -9,10 +9,15 @@ import (
)
func CountSubscriptionPrize(month int) float32 {
if month >= 12 {
return 8 * float32(month) * 0.9
base := 8 * float32(month)
if month >= 36 {
return base * 0.7
} else if month >= 12 {
return base * 0.8
} else if month >= 6 {
return base * 0.9
}
return 8 * float32(month)
return base
}
func BuySubscription(db *sql.DB, user *User, month int) bool {