nolan 3 years ago
parent
commit
05405eeac3
  1. 19
      ruoyi-admin/src/main/java/com/ruoyi/hl/controller/WxController.java
  2. 13
      ruoyi-admin/src/main/java/com/ruoyi/web/controller/upload/BVideoAllowController.java

19
ruoyi-admin/src/main/java/com/ruoyi/hl/controller/WxController.java

@ -1,6 +1,7 @@ @@ -1,6 +1,7 @@
package com.ruoyi.hl.controller;
import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSONObject;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.framework.web.service.AliOSSService;
import com.ruoyi.hl.config.WxConfig;
@ -93,14 +94,24 @@ public class WxController { @@ -93,14 +94,24 @@ public class WxController {
if (allowList!=null&&allowList.size()>0){
BVideoAllow allow=allowList.get(0);
BVideos bVideos=new BVideos();
bVideos.setParentId(allow.getVideoId());
List<BVideos> videosList=videosService.selectBVideosList(bVideos);
BVideos bVideos=videosService.selectBVideosById(allow.getVideoId());
BVideos bVideos2=new BVideos();
bVideos2.setParentId(allow.getVideoId());
List<BVideos> videosList=videosService.selectBVideosList(bVideos2);
videosList.forEach(v->{
BFile file=fileService.selectBFileById(v.getFileId());
v.setPath(ossService.getDomain() + "/" + file.getUuid());
});
return AjaxResult.success(videosList);
JSONObject jsonObject=new JSONObject();
jsonObject.put("name",bVideos.getName());
jsonObject.put("list",videosList);
return AjaxResult.success(jsonObject);
}else {
return AjaxResult.success(new ArrayList<>());
}

13
ruoyi-admin/src/main/java/com/ruoyi/web/controller/upload/BVideoAllowController.java

@ -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;
@ -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;
}
}
}

Loading…
Cancel
Save