|
@@ -4,6 +4,7 @@ import cn.efunbox.audio.clients.AudioHttp;
|
|
|
import cn.efunbox.audio.consts.MediaType;
|
|
|
import cn.efunbox.audio.consts.Status;
|
|
|
import cn.efunbox.audio.entity.*;
|
|
|
+import cn.efunbox.audio.plugin.AliStsOssAuth;
|
|
|
import cn.efunbox.audio.service.*;
|
|
|
import cn.efunbox.audio.utils.ApiCode;
|
|
|
import cn.efunbox.audio.utils.HttpUtil;
|
|
@@ -50,6 +51,9 @@ public class AudioController {
|
|
|
AdminService adminService;
|
|
|
@Autowired
|
|
|
TrailService trailService;
|
|
|
+ @Autowired
|
|
|
+ private AliStsOssAuth aliStsOssAuth;
|
|
|
+
|
|
|
|
|
|
/**
|
|
|
* 管理员搜索接口
|
|
@@ -222,13 +226,13 @@ public class AudioController {
|
|
|
try{
|
|
|
if(map.get("code").toString().equalsIgnoreCase("200")){
|
|
|
map = JSONObject.parseObject(map.get("data").toString());
|
|
|
- if(map.get("type").toString().equalsIgnoreCase("1")){
|
|
|
+ if(map.get("type").toString().equalsIgnoreCase("1")){ //音频
|
|
|
JSONArray array = JSONArray.parseArray(map.get("audios").toString());
|
|
|
map = JSONObject.parseObject(array.get(0).toString());
|
|
|
String path = map.get("fullPath").toString();
|
|
|
path = path.replaceAll("\n","");
|
|
|
audio.setUrl(path);
|
|
|
- }else if(map.get("type").toString().equalsIgnoreCase("0")){
|
|
|
+ }else if(map.get("type").toString().equalsIgnoreCase("0")){ //视频
|
|
|
JSONArray array = JSONArray.parseArray(map.get("videos").toString());
|
|
|
map = JSONObject.parseObject(array.get(0).toString());
|
|
|
String path = map.get("fullPath").toString();
|
|
@@ -261,6 +265,9 @@ public class AudioController {
|
|
|
record.setCreated(new Timestamp(new Date().getTime()));
|
|
|
recordService.Insert(record);
|
|
|
|
|
|
+ //阿里oss临时授权
|
|
|
+ audio.setUrl(aliStsOssAuth.AuthUrl(audio.getUrl()));
|
|
|
+
|
|
|
HttpUtil.responseOkData(request, response, audio);
|
|
|
return;
|
|
|
}
|