fix: 优化服务号与支付逻辑,增加AccessToken为空校验及优惠描述完善

This commit is contained in:
ccnetcore
2025-10-14 23:02:44 +08:00
parent 7a53e0c90c
commit 959eb3f782
3 changed files with 29 additions and 14 deletions

View File

@@ -224,18 +224,25 @@ public class PayService : ApplicationService, IPayService
// 如果是尊享包商品,计算折扣
if (goodsType.IsPremiumPackage())
{
discountDescription = "累计充值每10元可减2.5元最多减50元";
if ( CurrentUser.IsAuthenticated)
if (CurrentUser.IsAuthenticated)
{
discountAmount = goodsType.CalculateDiscount(totalRechargeAmount);
actualPrice = goodsType.GetDiscountedPrice(totalRechargeAmount);
if (discountAmount > 0)
{
discountDescription = $"根据累积充值已优惠 ¥{discountAmount:F2}";
}
else
{
discountDescription = $"累积充值过低,暂无优惠";
}
}
else
{
discountDescription = $"登录后查看优惠";
}
}
var goodsItem = new GoodsListOutput
@@ -255,7 +262,7 @@ public class PayService : ApplicationService, IPayService
return goodsList;
}
/// <summary>
/// 获取交易状态描述
@@ -280,6 +287,7 @@ public class PayService : ApplicationService, IPayService
{
return result;
}
return TradeStatusEnum.WAIT_TRADE;
}
}
}