102 lines
3.0 KiB
C#
102 lines
3.0 KiB
C#
using Dlhis.Canteen.Order.Request;
|
|
using Dlhis.Canteen.Order.Response;
|
|
using Dlhis.Canteen.Voucher.Requests;
|
|
using Dlhis.Canteen.Voucher.Response;
|
|
using Dlhis.Canteen.Voucher.Services;
|
|
using Kurisu.AspNetCore.DataAccess.Dto;
|
|
using Kurisu.AspNetCore.DataAccess.SqlSugar.Aop;
|
|
using Microsoft.AspNetCore.Authorization;
|
|
using Microsoft.AspNetCore.Mvc;
|
|
|
|
namespace Dlhis.Canteen.Voucher.Controllers;
|
|
|
|
[Authorize]
|
|
[Route("api/[controller]")]
|
|
[ApiController]
|
|
public class EMealVoucherController : ControllerBase
|
|
{
|
|
private readonly IEMealVoucherService _eMealVoucherService;
|
|
|
|
public EMealVoucherController(IEMealVoucherService eMealVoucherService)
|
|
{
|
|
_eMealVoucherService = eMealVoucherService;
|
|
}
|
|
|
|
/// <summary>
|
|
/// 分页数据
|
|
/// </summary>
|
|
/// <param name="request"></param>
|
|
/// <returns></returns>
|
|
[HttpGet("page")]
|
|
public async Task<Pagination<EMealVoucherPageResponse>> GetPageAsync([FromQuery] EMealVoucherPageRequest request)
|
|
{
|
|
return await _eMealVoucherService.GetPageAsync(request);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 获取我的电子餐券申请
|
|
/// </summary>
|
|
/// <param name="request"></param>
|
|
/// <returns></returns>
|
|
[HttpGet("my")]
|
|
public async Task<Pagination<EMealVoucherMyPageResponse>> GetMyEMealVoucherPageAsync([FromQuery] EMealVoucherPageRequest request)
|
|
{
|
|
return await _eMealVoucherService.GetMyEMealVoucherPageAsync(request);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 查看电子餐券
|
|
/// </summary>
|
|
/// <param name="no"></param>
|
|
/// <returns></returns>
|
|
[HttpGet("details")]
|
|
public async Task<List<EMealVoucherDetailResponse>> GetDetailsByNoAsync(string no)
|
|
{
|
|
return await _eMealVoucherService.GetDetailsByNoAsync(no);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 获取url签名
|
|
/// </summary>
|
|
/// <param name="detailId"></param>
|
|
/// <returns></returns>
|
|
[HttpGet("signature")]
|
|
public async Task<string> GetQrCodeSignatureAsync(long detailId)
|
|
{
|
|
return await _eMealVoucherService.GetQrCodeSignatureAsync(detailId);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 刷新url签名
|
|
/// </summary>
|
|
/// <param name="detailId"></param>
|
|
[HttpPost("signature/refresh")]
|
|
public async Task RefreshSignatureAsync(long detailId)
|
|
{
|
|
await _eMealVoucherService.RefreshSignatureAsync(detailId);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 获取二维码
|
|
/// </summary>
|
|
/// <param name="signature"></param>
|
|
/// <returns></returns>
|
|
[AllowAnonymous]
|
|
[HttpGet("qrcode")]
|
|
public async Task<string> GetQrCodeAsync(string signature)
|
|
{
|
|
return await _eMealVoucherService.GetQrCodeAsync(signature);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 餐券消费分页
|
|
/// </summary>
|
|
/// <param name="request"></param>
|
|
/// <returns></returns>
|
|
[HttpGet("balance/page")]
|
|
[IgnoreTenant]
|
|
public async Task<Pagination<BalanceRecordEMealVoucherResponse>> GetEMealVoucherPageAsync([FromQuery] BalanceRecordEMealVoucherPageRequest request)
|
|
{
|
|
return await _eMealVoucherService.GetEMealVoucherPageAsync(request);
|
|
}
|
|
} |