- 修复支付接口参数顺序错误,调整商品名称和订单号参数位置 - 修复支付页面HTML返回格式,直接返回Body内容而非序列化字符串 - 添加支付相关接口的权限控制,支付回调接口允许匿名访问 - 优化支付宝回调验签逻辑,保持原始参数顺序避免验签失败 - 增加回调格式错误的异常处理 - 修复商品类型枚举显示名称为英文,新增测试商品类型 - 修正Token服务提示文案中的错别字 - 移除订单更新时不必要的时间字段设置
55 lines
1.6 KiB
C#
55 lines
1.6 KiB
C#
using Microsoft.AspNetCore.Authorization;
|
||
using Volo.Abp.Application.Services;
|
||
using Volo.Abp.Users;
|
||
using Yi.Framework.AiHub.Application.Contracts.Dtos.Token;
|
||
using Yi.Framework.AiHub.Domain.Entities.OpenApi;
|
||
using Yi.Framework.AiHub.Domain.Extensions;
|
||
using Yi.Framework.AiHub.Domain.Managers;
|
||
using Yi.Framework.SqlSugarCore.Abstractions;
|
||
|
||
namespace Yi.Framework.AiHub.Application.Services;
|
||
|
||
public class TokenService : ApplicationService
|
||
{
|
||
private readonly ISqlSugarRepository<TokenAggregateRoot> _tokenRepository;
|
||
private readonly TokenManager _tokenManager;
|
||
|
||
/// <summary>
|
||
/// 构造函数
|
||
/// </summary>
|
||
/// <param name="tokenRepository"></param>
|
||
/// <param name="tokenManager"></param>
|
||
public TokenService(ISqlSugarRepository<TokenAggregateRoot> tokenRepository, TokenManager tokenManager)
|
||
{
|
||
_tokenRepository = tokenRepository;
|
||
_tokenManager = tokenManager;
|
||
}
|
||
|
||
/// <summary>
|
||
/// 获取token
|
||
/// </summary>
|
||
/// <returns></returns>
|
||
[Authorize]
|
||
public async Task<TokenOutput> GetAsync()
|
||
{
|
||
return new TokenOutput
|
||
{
|
||
ApiKey = await _tokenManager.GetAsync(CurrentUser.GetId())
|
||
};
|
||
}
|
||
|
||
/// <summary>
|
||
/// 创建token
|
||
/// </summary>
|
||
/// <exception cref="UserFriendlyException"></exception>
|
||
[Authorize]
|
||
public async Task CreateAsync()
|
||
{
|
||
if (!CurrentUser.IsAiVip())
|
||
{
|
||
throw new UserFriendlyException("充值成为Vip,畅享第三方token服务");
|
||
}
|
||
|
||
await _tokenManager.CreateAsync(CurrentUser.GetId());
|
||
}
|
||
} |