添加接口

This commit is contained in:
zpc 2024-11-19 15:55:44 +08:00
parent 3ca183a5a7
commit bc86767caa
3 changed files with 60 additions and 1 deletions

View File

@ -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;
/// <summary>
/// 兑换码
/// </summary>
public class RedemptionController : CloudGamingControllerBase
{
public RedemptionController(IServiceProvider _serviceProvider) : base(_serviceProvider)
{
}
/// <summary>
/// 使用兑换码
/// </summary>
/// <param name="redemptionCode"></param>
/// <returns></returns>
[HttpPost]
[Authorize]
public async Task<BaseResponse<bool>> UseRedemptionCode([FromBody] RedemptionCodeRequest redemptionCode)
{
RedemptionBLL redemptionBLL = new RedemptionBLL(ServiceProvider);
return await redemptionBLL.UseRedemptionCodeAsync(redemptionCode.Code);
}
}

View File

@ -23,7 +23,13 @@ namespace CloudGaming.Code.Other
{
}
public async Task<BaseResponse<bool>> UseRedemptionCode(string code)
/// <summary>
/// 使用兑换码
/// </summary>
/// <param name="code"></param>
/// <returns></returns>
/// <exception cref="ArgumentNullException"></exception>
public async Task<BaseResponse<bool>> UseRedemptionCodeAsync(string code)
{
if (string.IsNullOrEmpty(code))
{

View File

@ -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
{
/// <summary>
/// 兑换码
/// </summary>
public string Code { get; set; }
}
}