创建签名验证自定义中间件 ,优化代码结构
This commit is contained in:
@@ -9,6 +9,7 @@ using System.IO;
|
||||
using QRCodeService.Application.Queries;
|
||||
using QRCodeService.Models;
|
||||
using QRCodeService.Options;
|
||||
using QRCodeService.Infrastructure.Middlewares;
|
||||
|
||||
namespace QRCodeService.Controllers
|
||||
{
|
||||
@@ -25,20 +26,11 @@ namespace QRCodeService.Controllers
|
||||
this.appQueries = appQueries;
|
||||
this.option = option;
|
||||
}
|
||||
|
||||
[CheckSign(typeof(GetQRCodeModel))]
|
||||
[Route("qrcode")]
|
||||
[HttpPost]
|
||||
public async Task<IActionResult> GetImage(GetQRCodeModel input)
|
||||
{
|
||||
var app = await appQueries.GetAppAsync(input.AppId);
|
||||
if (app == null)
|
||||
{
|
||||
return BadRequest();
|
||||
}
|
||||
if (!await input.CheckValidAsync(app.Appkey))
|
||||
{
|
||||
return BadRequest();
|
||||
}
|
||||
var link = await linkQueries.GetLinkAsync(input.ShortCode);
|
||||
if (link.AppId != input.AppId)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user