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

@@ -1,5 +1,4 @@
using System.Text;
using System.Text.Json;
using System.Xml.Serialization;
using Medallion.Threading;
using Microsoft.AspNetCore.Http;
@@ -18,7 +17,7 @@ using Yi.Framework.Rbac.Application.Contracts.Dtos.Account;
using Yi.Framework.Rbac.Application.Contracts.IServices;
using Yi.Framework.SqlSugarCore.Abstractions;
namespace Yi.Framework.AiHub.Application.Services;
namespace Yi.Framework.AiHub.Application.Services.Fuwuhao;
/// <summary>
/// 服务号服务

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;
}
}
}