Commit 181ad4ce by chizw

[+]增加批量生成短链接口

1 parent 699bfd2f
......@@ -177,7 +177,7 @@ public class ShortUrlService {
boolean flag;
int count = 0;
do {
if (count++ > 0) builder.append(UUID.randomUUID());
builder.append(UUID.randomUUID());
code = getCompressCode(builder.toString());
shortUrl = UrlUtil.splicingUrl(domain.getProtocol(), domain.getDomainValue(), code);
urlMapDto.setCompressCode(code);
......@@ -185,7 +185,7 @@ public class ShortUrlService {
urlMapDto.setShortUrlDigest(DigestUtils.sha1Hex(shortUrl));
flag = atomicSelectAndSaveUrlMap(urlMapDto, code);
} while (!flag);
if (count > 5) log.warn("{}该链接的短链压缩码生成已重复超过{}次", longUrl, count);
// if (count > 5) log.warn("{}该链接的短链压缩码生成已重复超过{}次", longUrl, count);
// 返回短链
log.info("短链服务生成短链返回 response:{}", shortUrl);
return shortUrl;
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!