feat: 激活码与VIP充值支持按天计费

- 新增 VIP 天数概念,支持月数与天数组合计算过期时间
- 激活码商品新增 VipDays 配置,并新增 1 天会员试用组合包
- VIP 充值统一按天数计算(1 个月 = 31 天),兼容原有逻辑
- 激活码兑换时支持仅天数或天月组合的 VIP 充值
This commit is contained in:
ccnetcore
2025-12-28 17:44:33 +08:00
parent bdaa53bac8
commit 4b9f845fae
4 changed files with 37 additions and 11 deletions

View File

@@ -12,6 +12,7 @@ public class ActivationCodeGoodsAttribute : Attribute
public decimal Price { get; }
public long TokenAmount { get; }
public int VipMonths { get; }
public int VipDays { get; }
public bool IsCombo { get; }
public bool IsReusable { get; }
public bool IsSameTypeOnce { get; }
@@ -26,11 +27,13 @@ public class ActivationCodeGoodsAttribute : Attribute
bool isReusable,
bool isSameTypeOnce,
string displayName,
string content)
string content,
int vipDays = 0)
{
Price = (decimal)price;
TokenAmount = tokenAmount;
VipMonths = vipMonths;
VipDays = vipDays;
IsCombo = isCombo;
IsReusable = isReusable;
IsSameTypeOnce = isSameTypeOnce;
@@ -85,9 +88,14 @@ public enum ActivationCodeGoodsTypeEnum
[ActivationCodeGoods(price: 198.90, tokenAmount: 100000000, vipMonths: 0, isCombo: false, isReusable: false,
isSameTypeOnce: false, displayName: "1亿 尊享Token", content: "特价包")]
Premium1Yi = 6,
/// <summary>
/// 1【意心Ai会员1天+50w 尊享Token】新人试用首单组合包
/// </summary>
[ActivationCodeGoods(price: 1, tokenAmount: 500000, vipMonths: 0, vipDays: 1, isCombo: true, isReusable: false,
isSameTypeOnce: true, displayName: "意心Ai会员1天+50w 尊享Token", content: "新人首单组合包")]
Vip1DayTest = 7,
/// <summary>
/// 0【10w 尊享Token】免费包
/// </summary>
@@ -103,4 +111,4 @@ public static class ActivationCodeGoodsTypeEnumExtensions
var fieldInfo = goodsType.GetType().GetField(goodsType.ToString());
return fieldInfo?.GetCustomAttribute<ActivationCodeGoodsAttribute>();
}
}
}