Files
jinko.yikatong/Src/Dlhis.Canteen/Setting/Controllers/WalletsController.cs
2024-11-14 14:14:47 +08:00

46 lines
1.1 KiB
C#

using System.ComponentModel.DataAnnotations;
using Dlhis.Canteen.Setting.Response;
using Dlhis.Canteen.Setting.Services;
using Kurisu.AspNetCore.DataAccess.SqlSugar.Aop;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
namespace Dlhis.Canteen.Setting.Controllers;
/// <summary>
/// 钱包
/// </summary>
[Authorize]
[Route("api/[controller]")]
[ApiController]
public class WalletsController : ControllerBase
{
private readonly IWalletService _walletService;
public WalletsController(IWalletService walletService)
{
_walletService = walletService;
}
/// <summary>
/// 钱包列表
/// </summary>
/// <returns></returns>
[HttpGet("list")]
public async Task<List<WalletResponse>> GetListAsync()
{
return await _walletService.GetListAsync();
}
/// <summary>
/// 余额
/// </summary>
/// <param name="walletCode">钱包code</param>
/// <returns></returns>
[HttpGet("balance")]
[IgnoreTenant]
public async Task<decimal> GetBalanceAsync([Required] string walletCode)
{
return await _walletService.GetBalanceAsync(walletCode);
}
}