@ -2,6 +2,7 @@ package com.ruoyi.web.controller.upload;
@@ -2,6 +2,7 @@ package com.ruoyi.web.controller.upload;
import java.util.Date ;
import java.util.List ;
import java.util.concurrent.TimeUnit ;
import javax.servlet.http.HttpServletResponse ;
import cn.hutool.core.lang.UUID ;
@ -40,7 +41,7 @@ public class BVideoAllowController extends BaseController {
@@ -40,7 +41,7 @@ public class BVideoAllowController extends BaseController {
public static String short_link_key = "short_link_" ;
public static String short_link_code_key = "short_link_code_" ;
public static final String ranString = RandomUtil . BASE_CHAR . toUpperCase ( ) + RandomUtil . BASE_CHAR_NUMBER ;
public static final String ranString = RandomUtil . BASE_CHAR . toUpperCase ( ) + RandomUtil . BASE_CHAR_NUMBER ;
@Autowired
@ -67,9 +68,17 @@ public class BVideoAllowController extends BaseController {
@@ -67,9 +68,17 @@ public class BVideoAllowController extends BaseController {
String short_link = redisCache . getCacheObject ( short_link_key + v . getId ( ) ) ;
if ( short_link = = null ) {
String code = RandomUtil . randomString ( ranString , 7 ) ;
redisCache . setCacheObject ( short_link_key + v . getId ( ) , share_short_domain + code ) ;
int shareLength = 7 ;
for ( int i = 0 ; i < 1000 ; i + + ) {
String code = RandomUtil . randomString ( ranString , shareLength ) ;
if ( redisCache . getCacheObject ( short_link_code_key + code ) = = null ) {
short_link = share_short_domain + code ;
redisCache . setCacheObject ( short_link_key + v . getId ( ) , short_link ) ;
redisCache . setCacheObject ( short_link_code_key + code , share_domain + "?isFirst=true&allowId=" + v . getAllowId ( ) ) ;
break ;
}
}
}