@ -38,6 +38,9 @@ public class IndexController {
@ResponseBody
public R generateShortURL(@RequestParam String longURL) {
if (UrlUtils.checkURL(longURL)) {
if (!longURL.startsWith("http")) {
longURL = "http://" + longURL;
}
String shortURL = urlService.saveUrlMap(HashUtils.hashToBase62(longURL), longURL, longURL);
return R.ok("请求成功", host + shortURL);
After
Width: | Height: | Size: 8.5 KiB
@ -3,6 +3,7 @@
<head>
<meta charset="UTF-8">
<title>短链接生成</title>
<link rel="icon" href="/img/favicon.ico">
<link rel="stylesheet" href="/css/base.css">
</head>
<body>