fix: 修复支付3位数问题
This commit is contained in:
@@ -10,11 +10,11 @@ namespace Yi.Framework.AiHub.Domain.Shared.Enums;
|
|||||||
public class PriceAttribute : Attribute
|
public class PriceAttribute : Attribute
|
||||||
{
|
{
|
||||||
public decimal Price { get; }
|
public decimal Price { get; }
|
||||||
|
|
||||||
public decimal ReferencePrice { get; }
|
public decimal ReferencePrice { get; }
|
||||||
|
|
||||||
public int ValidMonths { get; }
|
public int ValidMonths { get; }
|
||||||
|
|
||||||
public PriceAttribute(double price, int validMonths, double referencePrice)
|
public PriceAttribute(double price, int validMonths, double referencePrice)
|
||||||
{
|
{
|
||||||
Price = (decimal)price;
|
Price = (decimal)price;
|
||||||
@@ -93,39 +93,32 @@ public class TokenAmountAttribute : Attribute
|
|||||||
public enum GoodsTypeEnum
|
public enum GoodsTypeEnum
|
||||||
{
|
{
|
||||||
// VIP服务
|
// VIP服务
|
||||||
[Price(29.9, 1,29.9)]
|
[Price(29.9, 1, 29.9)] [DisplayName("YiXinVip 1 month", "1个月", "灵活选择")] [GoodsCategory(GoodsCategoryType.Vip)]
|
||||||
[DisplayName("YiXinVip 1 month", "1个月", "灵活选择")]
|
|
||||||
[GoodsCategory(GoodsCategoryType.Vip)]
|
|
||||||
YiXinVip1 = 1,
|
YiXinVip1 = 1,
|
||||||
|
|
||||||
[Price(83.7, 3,27.9)]
|
[Price(83.7, 3, 27.9)] [DisplayName("YiXinVip 3 month", "3个月", "短期体验")] [GoodsCategory(GoodsCategoryType.Vip)]
|
||||||
[DisplayName("YiXinVip 3 month", "3个月", "短期体验")]
|
|
||||||
[GoodsCategory(GoodsCategoryType.Vip)]
|
|
||||||
YiXinVip3 = 3,
|
YiXinVip3 = 3,
|
||||||
|
|
||||||
[Price(155.4, 6,25.9)]
|
[Price(155.4, 6, 25.9)] [DisplayName("YiXinVip 6 month", "6个月", "年度热销")] [GoodsCategory(GoodsCategoryType.Vip)]
|
||||||
[DisplayName("YiXinVip 6 month", "6个月", "年度热销")]
|
|
||||||
[GoodsCategory(GoodsCategoryType.Vip)]
|
|
||||||
YiXinVip6 = 6,
|
YiXinVip6 = 6,
|
||||||
|
|
||||||
[Price(183.2, 8,22.9)]
|
[Price(183.2, 8, 22.9)]
|
||||||
[DisplayName("YiXinVip 8 month", "8个月(推荐)", "限时活动,超高性价比")]
|
[DisplayName("YiXinVip 8 month", "8个月(推荐)", "限时活动,超高性价比")]
|
||||||
[GoodsCategory(GoodsCategoryType.Vip)]
|
[GoodsCategory(GoodsCategoryType.Vip)]
|
||||||
YiXinVip8 = 8,
|
YiXinVip8 = 8,
|
||||||
|
|
||||||
// 尊享包服务 - 需要VIP资格才能购买
|
// 尊享包服务 - 需要VIP资格才能购买
|
||||||
[Price(188.9, 0,1750)]
|
[Price(188.9, 0, 1750)]
|
||||||
[DisplayName("YiXinPremiumPackage 5000W Tokens", "5000万Tokens", "简单尝试")]
|
[DisplayName("YiXinPremiumPackage 5000W Tokens", "5000万Tokens", "简单尝试")]
|
||||||
[GoodsCategory(GoodsCategoryType.PremiumPackage)]
|
[GoodsCategory(GoodsCategoryType.PremiumPackage)]
|
||||||
[TokenAmount(5000)]
|
[TokenAmount(5000)]
|
||||||
PremiumPackage5000W = 101,
|
PremiumPackage5000W = 101,
|
||||||
|
|
||||||
[Price(248.9, 0,3500)]
|
[Price(248.9, 0, 3500)]
|
||||||
[DisplayName("YiXinPremiumPackage 10000W Tokens", "1亿Tokens(推荐)", "极致性价比")]
|
[DisplayName("YiXinPremiumPackage 10000W Tokens", "1亿Tokens(推荐)", "极致性价比")]
|
||||||
[GoodsCategory(GoodsCategoryType.PremiumPackage)]
|
[GoodsCategory(GoodsCategoryType.PremiumPackage)]
|
||||||
[TokenAmount(10000)]
|
[TokenAmount(10000)]
|
||||||
PremiumPackage10000W = 102,
|
PremiumPackage10000W = 102,
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class GoodsTypeEnumExtensions
|
public static class GoodsTypeEnumExtensions
|
||||||
@@ -304,6 +297,6 @@ public static class GoodsTypeEnumExtensions
|
|||||||
var discountedPrice = originalPrice - discount;
|
var discountedPrice = originalPrice - discount;
|
||||||
|
|
||||||
// 确保价格不为负数,至少为0.01元
|
// 确保价格不为负数,至少为0.01元
|
||||||
return Math.Max(discountedPrice, 0.01m);
|
return Math.Round(discountedPrice, 2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user