20200611-zlp-1

培训视频(七牛设置私有空间)管理
This commit is contained in:
paidaxing444
2020-06-11 17:29:16 +08:00
parent 72ea08f6ca
commit cfe917c8ae
11 changed files with 199 additions and 63 deletions

View File

@ -349,14 +349,14 @@ export default {
file.type === "video/avi" || file.type === "video/avi" ||
file.type === "video/wmv" || file.type === "video/wmv" ||
file.type === "video/rmvb"; file.type === "video/rmvb";
const isLt500M = file.size / 1024 / 1024 < 500; const isLt1000M = file.size / 1024 / 1024 < 1000;
if (!isVideo) { if (!isVideo) {
this.msgError("请上传正确格式的视频!"); this.msgError("请上传正确格式的视频!");
return false; return false;
} else { } else {
this.form.filetype = file.type; this.form.filetype = file.type;
if (!isLt500M) { if (!isLt1000M) {
this.msgError("上传视频文件大小不能超过 500MB!"); this.msgError("上传视频文件大小不能超过 1000MB!");
return false; return false;
} }
} }

View File

@ -127,7 +127,7 @@ export default {
sources: [ sources: [
{ {
type: response.data.filetype, type: response.data.filetype,
src: "https://files.benyiedu.com/" + response.data.videourl src: response.data.videourl
} }
], ],
notSupportedMessage: "此视频暂无法播放,请稍后再试", notSupportedMessage: "此视频暂无法播放,请稍后再试",

View File

@ -74,7 +74,7 @@
</template> </template>
<script> <script>
import { listVideo, getVideo } from "@/api/benyi_train/video"; import { listVideo, getVideo, privateDownloadUrl } from "@/api/benyi_train/video";
import { listAllLecturer } from "@/api/benyi_train/lecturer"; import { listAllLecturer } from "@/api/benyi_train/lecturer";
import { listMoedata } from "@/api/system/moedata"; import { listMoedata } from "@/api/system/moedata";
@ -149,7 +149,7 @@ export default {
{ {
type: ele.filetype, type: ele.filetype,
// mp4 // mp4
src: "https://files.benyiedu.com/" + ele.videourl src: ele.videourl
} }
], ],
notSupportedMessage: "此视频暂无法播放,请稍后再试", notSupportedMessage: "此视频暂无法播放,请稍后再试",

View File

@ -4,7 +4,7 @@ import io.jsonwebtoken.Claims;
/** /**
* 通用常量信息 * 通用常量信息
* *
* @author ruoyi * @author ruoyi
*/ */
public class Constants public class Constants
@ -13,7 +13,22 @@ public class Constants
* UTF-8 字符集 * UTF-8 字符集
*/ */
public static final String UTF8 = "UTF-8"; public static final String UTF8 = "UTF-8";
/**
* GBK 字符集
*/
public static final String GBK = "GBK";
/**
* http请求
*/
public static final String HTTP = "http://";
/**
* https请求
*/
public static final String HTTPS = "https://";
/** /**
* 通用成功标识 * 通用成功标识
*/ */
@ -94,6 +109,16 @@ public class Constants
*/ */
public static final String JWT_AUTHORITIES = "authorities"; public static final String JWT_AUTHORITIES = "authorities";
/**
* 参数管理 cache key
*/
public static final String SYS_CONFIG_KEY = "sys_config:";
/**
* 字典管理 cache key
*/
public static final String SYS_DICT_KEY = "sys_dict:";
/** /**
* 资源映射路径 前缀 * 资源映射路径 前缀
*/ */

View File

@ -0,0 +1,64 @@
package com.ruoyi.common.utils;
import java.util.Collection;
import java.util.List;
import com.ruoyi.common.constant.Constants;
import com.ruoyi.common.utils.spring.SpringUtils;
import com.ruoyi.framework.redis.RedisCache;
import com.ruoyi.project.system.domain.SysDictData;
/**
* 字典工具类
*
* @author ruoyi
*/
public class DictUtils
{
/**
* 设置字典缓存
*
* @param key 参数键
* @param dictDatas 字典数据列表
*/
public static void setDictCache(String key, List<SysDictData> dictDatas)
{
SpringUtils.getBean(RedisCache.class).setCacheObject(getCacheKey(key), dictDatas);
}
/**
* 获取字典缓存
*
* @param key 参数键
* @return dictDatas 字典数据列表
*/
public static List<SysDictData> getDictCache(String key)
{
Object cacheObj = SpringUtils.getBean(RedisCache.class).getCacheObject(getCacheKey(key));
if (StringUtils.isNotNull(cacheObj))
{
List<SysDictData> DictDatas = StringUtils.cast(cacheObj);
return DictDatas;
}
return null;
}
/**
* 清空字典缓存
*/
public static void clearDictCache()
{
Collection<String> keys = SpringUtils.getBean(RedisCache.class).keys(Constants.SYS_DICT_KEY + "*");
SpringUtils.getBean(RedisCache.class).deleteObject(keys);
}
/**
* 设置cache key
*
* @param configKey 参数键
* @return 缓存键key
*/
public static String getCacheKey(String configKey)
{
return Constants.SYS_DICT_KEY + configKey;
}
}

View File

@ -10,7 +10,7 @@ import com.ruoyi.common.core.text.StrFormatter;
/** /**
* 字符串工具类 * 字符串工具类
* *
* @author ruoyi * @author ruoyi
*/ */
public class StringUtils extends org.apache.commons.lang3.StringUtils public class StringUtils extends org.apache.commons.lang3.StringUtils
@ -23,7 +23,7 @@ public class StringUtils extends org.apache.commons.lang3.StringUtils
/** /**
* 获取参数不为空值 * 获取参数不为空值
* *
* @param value defaultValue 要判断的value * @param value defaultValue 要判断的value
* @return value 返回值 * @return value 返回值
*/ */
@ -34,7 +34,7 @@ public class StringUtils extends org.apache.commons.lang3.StringUtils
/** /**
* * 判断一个Collection是否为空 包含ListSetQueue * * 判断一个Collection是否为空 包含ListSetQueue
* *
* @param coll 要判断的Collection * @param coll 要判断的Collection
* @return true为空 false非空 * @return true为空 false非空
*/ */
@ -45,7 +45,7 @@ public class StringUtils extends org.apache.commons.lang3.StringUtils
/** /**
* * 判断一个Collection是否非空包含ListSetQueue * * 判断一个Collection是否非空包含ListSetQueue
* *
* @param coll 要判断的Collection * @param coll 要判断的Collection
* @return true非空 false * @return true非空 false
*/ */
@ -56,7 +56,7 @@ public class StringUtils extends org.apache.commons.lang3.StringUtils
/** /**
* * 判断一个对象数组是否为空 * * 判断一个对象数组是否为空
* *
* @param objects 要判断的对象数组 * @param objects 要判断的对象数组
** @return true为空 false非空 ** @return true为空 false非空
*/ */
@ -67,7 +67,7 @@ public class StringUtils extends org.apache.commons.lang3.StringUtils
/** /**
* * 判断一个对象数组是否非空 * * 判断一个对象数组是否非空
* *
* @param objects 要判断的对象数组 * @param objects 要判断的对象数组
* @return true非空 false * @return true非空 false
*/ */
@ -78,7 +78,7 @@ public class StringUtils extends org.apache.commons.lang3.StringUtils
/** /**
* * 判断一个Map是否为空 * * 判断一个Map是否为空
* *
* @param map 要判断的Map * @param map 要判断的Map
* @return true为空 false非空 * @return true为空 false非空
*/ */
@ -89,7 +89,7 @@ public class StringUtils extends org.apache.commons.lang3.StringUtils
/** /**
* * 判断一个Map是否为空 * * 判断一个Map是否为空
* *
* @param map 要判断的Map * @param map 要判断的Map
* @return true非空 false * @return true非空 false
*/ */
@ -100,7 +100,7 @@ public class StringUtils extends org.apache.commons.lang3.StringUtils
/** /**
* * 判断一个字符串是否为空串 * * 判断一个字符串是否为空串
* *
* @param str String * @param str String
* @return true为空 false非空 * @return true为空 false非空
*/ */
@ -111,7 +111,7 @@ public class StringUtils extends org.apache.commons.lang3.StringUtils
/** /**
* * 判断一个字符串是否为非空串 * * 判断一个字符串是否为非空串
* *
* @param str String * @param str String
* @return true非空串 false空串 * @return true非空串 false空串
*/ */
@ -122,7 +122,7 @@ public class StringUtils extends org.apache.commons.lang3.StringUtils
/** /**
* * 判断一个对象是否为空 * * 判断一个对象是否为空
* *
* @param object Object * @param object Object
* @return true为空 false非空 * @return true为空 false非空
*/ */
@ -133,7 +133,7 @@ public class StringUtils extends org.apache.commons.lang3.StringUtils
/** /**
* * 判断一个对象是否非空 * * 判断一个对象是否非空
* *
* @param object Object * @param object Object
* @return true非空 false * @return true非空 false
*/ */
@ -144,7 +144,7 @@ public class StringUtils extends org.apache.commons.lang3.StringUtils
/** /**
* * 判断一个对象是否是数组类型Java基本型别的数组 * * 判断一个对象是否是数组类型Java基本型别的数组
* *
* @param object 对象 * @param object 对象
* @return true是数组 false不是数组 * @return true是数组 false不是数组
*/ */
@ -163,7 +163,7 @@ public class StringUtils extends org.apache.commons.lang3.StringUtils
/** /**
* 截取字符串 * 截取字符串
* *
* @param str 字符串 * @param str 字符串
* @param start 开始 * @param start 开始
* @return 结果 * @return 结果
@ -194,7 +194,7 @@ public class StringUtils extends org.apache.commons.lang3.StringUtils
/** /**
* 截取字符串 * 截取字符串
* *
* @param str 字符串 * @param str 字符串
* @param start 开始 * @param start 开始
* @param end 结束 * @param end 结束
@ -246,7 +246,7 @@ public class StringUtils extends org.apache.commons.lang3.StringUtils
* 通常使用format("this is {} for {}", "a", "b") -> this is a for b<br> * 通常使用format("this is {} for {}", "a", "b") -> this is a for b<br>
* 转义{} format("this is \\{} for {}", "a", "b") -> this is \{} for a<br> * 转义{} format("this is \\{} for {}", "a", "b") -> this is \{} for a<br>
* 转义\ format("this is \\\\{} for {}", "a", "b") -> this is \a for b<br> * 转义\ format("this is \\\\{} for {}", "a", "b") -> this is \a for b<br>
* *
* @param template 文本模板,被替换的部分用 {} 表示 * @param template 文本模板,被替换的部分用 {} 表示
* @param params 参数值 * @param params 参数值
* @return 格式化后的文本 * @return 格式化后的文本
@ -262,7 +262,7 @@ public class StringUtils extends org.apache.commons.lang3.StringUtils
/** /**
* 字符串转set * 字符串转set
* *
* @param str 字符串 * @param str 字符串
* @param sep 分隔符 * @param sep 分隔符
* @return set集合 * @return set集合
@ -274,7 +274,7 @@ public class StringUtils extends org.apache.commons.lang3.StringUtils
/** /**
* 字符串转list * 字符串转list
* *
* @param str 字符串 * @param str 字符串
* @param sep 分隔符 * @param sep 分隔符
* @param filterBlank 过滤纯空白 * @param filterBlank 过滤纯空白
@ -362,7 +362,7 @@ public class StringUtils extends org.apache.commons.lang3.StringUtils
/** /**
* 是否包含字符串 * 是否包含字符串
* *
* @param str 验证字符串 * @param str 验证字符串
* @param strs 字符串组 * @param strs 字符串组
* @return 包含返回true * @return 包含返回true
@ -384,7 +384,7 @@ public class StringUtils extends org.apache.commons.lang3.StringUtils
/** /**
* 将下划线大写方式命名的字符串转换为驼峰式。如果转换前的下划线大写方式命名的字符串为空,则返回空字符串。 例如HELLO_WORLD->HelloWorld * 将下划线大写方式命名的字符串转换为驼峰式。如果转换前的下划线大写方式命名的字符串为空,则返回空字符串。 例如HELLO_WORLD->HelloWorld
* *
* @param name 转换前的下划线大写方式命名的字符串 * @param name 转换前的下划线大写方式命名的字符串
* @return 转换后的驼峰式命名的字符串 * @return 转换后的驼峰式命名的字符串
*/ */
@ -450,4 +450,10 @@ public class StringUtils extends org.apache.commons.lang3.StringUtils
} }
return sb.toString(); return sb.toString();
} }
@SuppressWarnings("unchecked")
public static <T> T cast(Object obj)
{
return (T) obj;
}
} }

View File

@ -18,10 +18,11 @@ import javax.net.ssl.TrustManager;
import javax.net.ssl.X509TrustManager; import javax.net.ssl.X509TrustManager;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import com.ruoyi.common.constant.Constants;
/** /**
* 通用http发送方法 * 通用http发送方法
* *
* @author ruoyi * @author ruoyi
*/ */
public class HttpUtils public class HttpUtils
@ -36,6 +37,19 @@ public class HttpUtils
* @return 所代表远程资源的响应结果 * @return 所代表远程资源的响应结果
*/ */
public static String sendGet(String url, String param) public static String sendGet(String url, String param)
{
return sendGet(url, param, Constants.UTF8);
}
/**
* 向指定 URL 发送GET方法的请求
*
* @param url 发送请求的 URL
* @param param 请求参数,请求参数应该是 name1=value1&name2=value2 的形式。
* @param contentType 编码类型
* @return 所代表远程资源的响应结果
*/
public static String sendGet(String url, String param, String contentType)
{ {
StringBuilder result = new StringBuilder(); StringBuilder result = new StringBuilder();
BufferedReader in = null; BufferedReader in = null;
@ -49,7 +63,7 @@ public class HttpUtils
connection.setRequestProperty("connection", "Keep-Alive"); connection.setRequestProperty("connection", "Keep-Alive");
connection.setRequestProperty("user-agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1;SV1)"); connection.setRequestProperty("user-agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1;SV1)");
connection.connect(); connection.connect();
in = new BufferedReader(new InputStreamReader(connection.getInputStream())); in = new BufferedReader(new InputStreamReader(connection.getInputStream(), contentType));
String line; String line;
while ((line = in.readLine()) != null) while ((line = in.readLine()) != null)
{ {
@ -104,7 +118,7 @@ public class HttpUtils
StringBuilder result = new StringBuilder(); StringBuilder result = new StringBuilder();
try try
{ {
String urlNameString = url + "?" + param; String urlNameString = url;
log.info("sendPost - {}", urlNameString); log.info("sendPost - {}", urlNameString);
URL realUrl = new URL(urlNameString); URL realUrl = new URL(urlNameString);
URLConnection conn = realUrl.openConnection(); URLConnection conn = realUrl.openConnection();

View File

@ -3,24 +3,29 @@ package com.ruoyi.common.utils.ip;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.ruoyi.common.constant.Constants;
import com.ruoyi.common.utils.StringUtils; import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.http.HttpUtils; import com.ruoyi.common.utils.http.HttpUtils;
import com.ruoyi.framework.config.RuoYiConfig; import com.ruoyi.framework.config.RuoYiConfig;
/** /**
* 获取地址类 * 获取地址类
* *
* @author ruoyi * @author ruoyi
*/ */
public class AddressUtils public class AddressUtils
{ {
private static final Logger log = LoggerFactory.getLogger(AddressUtils.class); private static final Logger log = LoggerFactory.getLogger(AddressUtils.class);
public static final String IP_URL = "http://ip.taobao.com/service/getIpInfo.php"; // IP地址查询
public static final String IP_URL = "http://whois.pconline.com.cn/ipJson.jsp";
// 未知地址
public static final String UNKNOWN = "XX XX";
public static String getRealAddressByIP(String ip) public static String getRealAddressByIP(String ip)
{ {
String address = "XX XX"; String address = UNKNOWN;
// 内网不查询 // 内网不查询
if (IpUtils.internalIp(ip)) if (IpUtils.internalIp(ip))
{ {
@ -28,17 +33,23 @@ public class AddressUtils
} }
if (RuoYiConfig.isAddressEnabled()) if (RuoYiConfig.isAddressEnabled())
{ {
String rspStr = HttpUtils.sendPost(IP_URL, "ip=" + ip); try
if (StringUtils.isEmpty(rspStr)) {
String rspStr = HttpUtils.sendGet(IP_URL, "ip=" + ip + "&json=true", Constants.GBK);
if (StringUtils.isEmpty(rspStr))
{
log.error("获取地理位置异常 {}", ip);
return UNKNOWN;
}
JSONObject obj = JSONObject.parseObject(rspStr);
String region = obj.getString("pro");
String city = obj.getString("city");
return String.format("%s %s", region, city);
}
catch (Exception e)
{ {
log.error("获取地理位置异常 {}", ip); log.error("获取地理位置异常 {}", ip);
return address;
} }
JSONObject obj = JSONObject.parseObject(rspStr);
JSONObject data = obj.getObject("data", JSONObject.class);
String region = data.getString("region");
String city = data.getString("city");
address = region + " " + city;
} }
return address; return address;
} }

View File

@ -4,10 +4,11 @@ import java.net.InetAddress;
import java.net.UnknownHostException; import java.net.UnknownHostException;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import com.ruoyi.common.utils.StringUtils; import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.html.EscapeUtil;
/** /**
* 获取IP方法 * 获取IP方法
* *
* @author ruoyi * @author ruoyi
*/ */
public class IpUtils public class IpUtils
@ -40,7 +41,7 @@ public class IpUtils
{ {
ip = request.getRemoteAddr(); ip = request.getRemoteAddr();
} }
ip = EscapeUtil.clean(ip);// 清除Xss特殊字符
return "0:0:0:0:0:0:0:1".equals(ip) ? "127.0.0.1" : ip; return "0:0:0:0:0:0:0:1".equals(ip) ? "127.0.0.1" : ip;
} }
@ -89,7 +90,7 @@ public class IpUtils
/** /**
* 将IPv4地址转换成字节 * 将IPv4地址转换成字节
* *
* @param text IPv4地址 * @param text IPv4地址
* @return byte 字节 * @return byte 字节
*/ */

View File

@ -4,6 +4,7 @@ import java.util.Date;
import java.util.List; import java.util.List;
import com.ruoyi.common.utils.SecurityUtils; import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.project.common.CommonController;
import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
@ -25,16 +26,17 @@ import com.ruoyi.framework.web.page.TableDataInfo;
/** /**
* 培训Controller * 培训Controller
* *
* @author tsbz * @author tsbz
* @date 2020-05-25 * @date 2020-05-25
*/ */
@RestController @RestController
@RequestMapping("/benyi/video") @RequestMapping("/benyi/video")
public class ByTrainVideoController extends BaseController public class ByTrainVideoController extends BaseController {
{
@Autowired @Autowired
private IByTrainVideoService byTrainVideoService; private IByTrainVideoService byTrainVideoService;
@Autowired
private CommonController commonController;
/** /**
@ -42,10 +44,16 @@ public class ByTrainVideoController extends BaseController
*/ */
@PreAuthorize("@ss.hasPermi('benyi:video:list')") @PreAuthorize("@ss.hasPermi('benyi:video:list')")
@GetMapping("/list") @GetMapping("/list")
public TableDataInfo list(ByTrainVideo byTrainVideo) public TableDataInfo list(ByTrainVideo byTrainVideo) {
{
startPage(); startPage();
List<ByTrainVideo> list = byTrainVideoService.selectByTrainVideoList(byTrainVideo); List<ByTrainVideo> list = byTrainVideoService.selectByTrainVideoList(byTrainVideo);
if (list != null && list.size() > 0) {
for (int i = 0; i < list.size(); i++) {
list.get(i).setVideourl(commonController.privateDownloadUrl(list.get(i).getVideourl()));
}
}
return getDataTable(list); return getDataTable(list);
} }
@ -55,8 +63,7 @@ public class ByTrainVideoController extends BaseController
@PreAuthorize("@ss.hasPermi('benyi:video:export')") @PreAuthorize("@ss.hasPermi('benyi:video:export')")
@Log(title = "培训", businessType = BusinessType.EXPORT) @Log(title = "培训", businessType = BusinessType.EXPORT)
@GetMapping("/export") @GetMapping("/export")
public AjaxResult export(ByTrainVideo byTrainVideo) public AjaxResult export(ByTrainVideo byTrainVideo) {
{
List<ByTrainVideo> list = byTrainVideoService.selectByTrainVideoList(byTrainVideo); List<ByTrainVideo> list = byTrainVideoService.selectByTrainVideoList(byTrainVideo);
ExcelUtil<ByTrainVideo> util = new ExcelUtil<ByTrainVideo>(ByTrainVideo.class); ExcelUtil<ByTrainVideo> util = new ExcelUtil<ByTrainVideo>(ByTrainVideo.class);
return util.exportExcel(list, "video"); return util.exportExcel(list, "video");
@ -67,9 +74,10 @@ public class ByTrainVideoController extends BaseController
*/ */
@PreAuthorize("@ss.hasPermi('benyi:video:query')") @PreAuthorize("@ss.hasPermi('benyi:video:query')")
@GetMapping(value = "/{id}") @GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id) public AjaxResult getInfo(@PathVariable("id") Long id) {
{ ByTrainVideo byTrainVideo = byTrainVideoService.selectByTrainVideoById(id);
return AjaxResult.success(byTrainVideoService.selectByTrainVideoById(id)); byTrainVideo.setVideourl(commonController.privateDownloadUrl(byTrainVideo.getVideourl()));
return AjaxResult.success(byTrainVideo);
} }
/** /**
@ -78,8 +86,7 @@ public class ByTrainVideoController extends BaseController
@PreAuthorize("@ss.hasPermi('benyi:video:add')") @PreAuthorize("@ss.hasPermi('benyi:video:add')")
@Log(title = "培训", businessType = BusinessType.INSERT) @Log(title = "培训", businessType = BusinessType.INSERT)
@PostMapping @PostMapping
public AjaxResult add(@RequestBody ByTrainVideo byTrainVideo) public AjaxResult add(@RequestBody ByTrainVideo byTrainVideo) {
{
byTrainVideo.setCreatetime(new Date()); byTrainVideo.setCreatetime(new Date());
byTrainVideo.setCreateuserid(SecurityUtils.getLoginUser().getUser().getUserId()); byTrainVideo.setCreateuserid(SecurityUtils.getLoginUser().getUser().getUserId());
return toAjax(byTrainVideoService.insertByTrainVideo(byTrainVideo)); return toAjax(byTrainVideoService.insertByTrainVideo(byTrainVideo));
@ -91,8 +98,7 @@ public class ByTrainVideoController extends BaseController
@PreAuthorize("@ss.hasPermi('benyi:video:edit')") @PreAuthorize("@ss.hasPermi('benyi:video:edit')")
@Log(title = "培训", businessType = BusinessType.UPDATE) @Log(title = "培训", businessType = BusinessType.UPDATE)
@PutMapping @PutMapping
public AjaxResult edit(@RequestBody ByTrainVideo byTrainVideo) public AjaxResult edit(@RequestBody ByTrainVideo byTrainVideo) {
{
return toAjax(byTrainVideoService.updateByTrainVideo(byTrainVideo)); return toAjax(byTrainVideoService.updateByTrainVideo(byTrainVideo));
} }
@ -101,9 +107,8 @@ public class ByTrainVideoController extends BaseController
*/ */
@PreAuthorize("@ss.hasPermi('benyi:video:remove')") @PreAuthorize("@ss.hasPermi('benyi:video:remove')")
@Log(title = "培训", businessType = BusinessType.DELETE) @Log(title = "培训", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}") @DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids) public AjaxResult remove(@PathVariable Long[] ids) {
{
return toAjax(byTrainVideoService.deleteByTrainVideoByIds(ids)); return toAjax(byTrainVideoService.deleteByTrainVideoByIds(ids));
} }
} }

View File

@ -44,7 +44,7 @@ public class CommonController {
@Resource @Resource
private FileConfig fileConfig; private FileConfig fileConfig;
@Autowired @Autowired
private FileConfig constantQiniu; private FileConfig constantQiniu;
/** /**
* 通用下载请求 * 通用下载请求
@ -133,9 +133,19 @@ public class CommonController {
System.out.println("auth:" + auth); System.out.println("auth:" + auth);
String upToken = auth.uploadToken(constantQiniu.getBucket()); String upToken = auth.uploadToken(constantQiniu.getBucket());
ajax.put("token", upToken); ajax.put("token", upToken);
return ajax; return ajax;
} }
public String privateDownloadUrl(String URL) {
Auth auth = Auth.create(constantQiniu.getAccessKey(), constantQiniu.getSecretKey());
String downloadURL = auth.privateDownloadUrl(constantQiniu.getDomain() + URL, 60);
//System.out.println("test=" + downloadURL);
return downloadURL;
}
/** /**
* 本地资源通用下载 * 本地资源通用下载
*/ */