diff --git a/src/CloudGaming/Api/CloudGaming.Api/Controllers/RedemptionController.cs b/src/CloudGaming/Api/CloudGaming.Api/Controllers/RedemptionController.cs new file mode 100644 index 0000000..2bf72f7 --- /dev/null +++ b/src/CloudGaming/Api/CloudGaming.Api/Controllers/RedemptionController.cs @@ -0,0 +1,37 @@ +using CloudGaming.Api.Base; +using CloudGaming.Code.DataAccess; +using CloudGaming.Code.Other; +using CloudGaming.DtoModel.RedemptionCode; +using CloudGaming.DtoModel.SevenSign; + +using HuanMeng.DotNetCore.Base; + +using Microsoft.AspNetCore.Authorization; +using Microsoft.AspNetCore.Http; +using Microsoft.AspNetCore.Mvc; + +namespace CloudGaming.Api.Controllers; + + +/// +/// 兑换码 +/// +public class RedemptionController : CloudGamingControllerBase +{ + public RedemptionController(IServiceProvider _serviceProvider) : base(_serviceProvider) + { + } + /// + /// 使用兑换码 + /// + /// + /// + [HttpPost] + [Authorize] + public async Task> UseRedemptionCode([FromBody] RedemptionCodeRequest redemptionCode) + { + RedemptionBLL redemptionBLL = new RedemptionBLL(ServiceProvider); + return await redemptionBLL.UseRedemptionCodeAsync(redemptionCode.Code); + } + +} \ No newline at end of file diff --git a/src/CloudGaming/Code/CloudGaming.Code/Other/RedemptionBLL.cs b/src/CloudGaming/Code/CloudGaming.Code/Other/RedemptionBLL.cs index 9ab0ce0..2ffbce9 100644 --- a/src/CloudGaming/Code/CloudGaming.Code/Other/RedemptionBLL.cs +++ b/src/CloudGaming/Code/CloudGaming.Code/Other/RedemptionBLL.cs @@ -23,7 +23,13 @@ namespace CloudGaming.Code.Other { } - public async Task> UseRedemptionCode(string code) + /// + /// 使用兑换码 + /// + /// + /// + /// + public async Task> UseRedemptionCodeAsync(string code) { if (string.IsNullOrEmpty(code)) { diff --git a/src/CloudGaming/Model/CloudGaming.DtoModel/RedemptionCode/RedemptionCodeRequest.cs b/src/CloudGaming/Model/CloudGaming.DtoModel/RedemptionCode/RedemptionCodeRequest.cs new file mode 100644 index 0000000..2f661cc --- /dev/null +++ b/src/CloudGaming/Model/CloudGaming.DtoModel/RedemptionCode/RedemptionCodeRequest.cs @@ -0,0 +1,16 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace CloudGaming.DtoModel.RedemptionCode +{ + public class RedemptionCodeRequest + { + /// + /// 兑换码 + /// + public string Code { get; set; } + } +}