音乐播放界面新增分享按钮
修复音乐文件不存在时依旧分配token的问题
This commit is contained in:
parent
bbaecbf976
commit
1a0d4498dd
@ -189,9 +189,11 @@ public class NasManager {
|
|||||||
String data=HttpTools.http_post(NasUrl+":8001/nas/music/share.do",json.toJSONString().getBytes(StandardCharsets.UTF_8),1,header);
|
String data=HttpTools.http_post(NasUrl+":8001/nas/music/share.do",json.toJSONString().getBytes(StandardCharsets.UTF_8),1,header);
|
||||||
System.out.println("分享:"+data);
|
System.out.println("分享:"+data);
|
||||||
JSONObject _data=JSONObject.parseObject(data);
|
JSONObject _data=JSONObject.parseObject(data);
|
||||||
RedisTools.set(token,data,3600);
|
if(_data.getInteger("code")==1) {
|
||||||
System.out.println("设置分享token:"+token+" -> "+data);
|
RedisTools.set(token, data, 3600);
|
||||||
_data.put("token",token);
|
System.out.println("设置分享token:" + token + " -> " + data);
|
||||||
|
_data.put("token", token);
|
||||||
|
}
|
||||||
json.clear();
|
json.clear();
|
||||||
json.put("code",0);
|
json.put("code",0);
|
||||||
json.put("msg","ok");
|
json.put("msg","ok");
|
||||||
|
@ -27,6 +27,7 @@
|
|||||||
<div id="composer">作曲家</div>
|
<div id="composer">作曲家</div>
|
||||||
<a class="layui-btn layui-btn-normal" id="download">下载</a>
|
<a class="layui-btn layui-btn-normal" id="download">下载</a>
|
||||||
<a class="layui-btn layui-btn-normal" id="next">下一首</a>
|
<a class="layui-btn layui-btn-normal" id="next">下一首</a>
|
||||||
|
<a class="layui-btn layui-btn-normal" id="play_share">分享</a>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="audioWrap"></div>
|
<div id="audioWrap"></div>
|
||||||
@ -68,6 +69,7 @@
|
|||||||
$('#playlist').remove()
|
$('#playlist').remove()
|
||||||
$('#reload').remove()
|
$('#reload').remove()
|
||||||
$('#next').remove()
|
$('#next').remove()
|
||||||
|
$('#play_share').remove()
|
||||||
}
|
}
|
||||||
$.get("/nas/music/getlocalhost.do",{share:share}, function (obj) {
|
$.get("/nas/music/getlocalhost.do",{share:share}, function (obj) {
|
||||||
try {
|
try {
|
||||||
@ -215,6 +217,16 @@
|
|||||||
$('#next').click(function () {
|
$('#next').click(function () {
|
||||||
playNext()
|
playNext()
|
||||||
});
|
});
|
||||||
|
$('#play_share').click(function (){
|
||||||
|
$.post('/nas/music/share.do',{file:new Base64().decode(decodeURIComponent(playNow))},function (json){
|
||||||
|
if(json.code===0){
|
||||||
|
layer.prompt({
|
||||||
|
title:"分享链接",
|
||||||
|
value:"http://"+window.location.host+"/html/body/nas/music.html?share="+json.data.token
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
$('#reload').click(function () {
|
$('#reload').click(function () {
|
||||||
$.post(localhost + "/nas/music/reload.do", function (obj) {
|
$.post(localhost + "/nas/music/reload.do", function (obj) {
|
||||||
layer.msg("提交刷新请求成功,几分钟后生效")
|
layer.msg("提交刷新请求成功,几分钟后生效")
|
||||||
|
Loading…
Reference in New Issue
Block a user