中转界面跳转到实际页面

This commit is contained in:
2021-02-24 16:45:07 +08:00
parent 41794aa1bc
commit f31385d58d
3 changed files with 16 additions and 5 deletions

View File

@@ -25,7 +25,7 @@ namespace QRCodeService.Application.Queries
{ {
connection.Open(); connection.Open();
var link = await connection.QueryAsync<Link>( var link = await connection.QueryAsync<Link>(
@"SELECT A FROM B WHERE ShortCode = @shortCode",new {shortCode }); @"SELECT ShortCode,FullUrl FROM Link WHERE ShortCode = @shortCode",new {shortCode });
return link.Single(); return link.Single();
} }
} }

View File

@@ -21,7 +21,7 @@ namespace QRCodeService.Controllers
public async Task<IActionResult> Index(string shortCode) public async Task<IActionResult> Index(string shortCode)
{ {
var link = await queries.GetLinkAsync(shortCode); var link = await queries.GetLinkAsync(shortCode);
return View(link); return View(new {link.FullUrl });
} }
} }
} }

View File

@@ -2,7 +2,18 @@
For more information on enabling MVC for empty projects, visit https://go.microsoft.com/fwlink/?LinkID=397860 For more information on enabling MVC for empty projects, visit https://go.microsoft.com/fwlink/?LinkID=397860
*@ *@
@{ @{
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<div> <div>
loading loading...
</div> </div>
<script>
location.href="@ViewData["FullUrl"]"
</script>
</body>
</html>
} }