update
This commit is contained in:
parent
f575d0f287
commit
ca012000a3
@ -46,6 +46,7 @@ public class MusicController {
|
||||
if(!StringUtils.isEmpty(path)&&!new File(path).exists()){
|
||||
path=Tools.base64ToString(path);
|
||||
}
|
||||
System.out.println("接收到地址:"+path);
|
||||
if(StringUtils.isEmpty(path)
|
||||
||path.equals("root")
|
||||
||!path.contains(defaultMusicPath)
|
||||
|
@ -123,20 +123,31 @@ public class MusicTools implements MusicToolsService {
|
||||
@Override
|
||||
public List<MusicData> getPath(String path, boolean isDir) {
|
||||
List<MusicData> list = new ArrayList<>();
|
||||
List<MusicData> main;
|
||||
List<MusicData> main=new ArrayList<>();
|
||||
MusicDataExample example = new MusicDataExample();
|
||||
String replacement = ConfigTools.load(ConfigTools.CONFIG, "os").equals("windows") ? "\\\\" : "/";
|
||||
String tmpPath=path;
|
||||
if (isDir) {
|
||||
example.createCriteria().andFileLike(path.replace(File.separator, replacement) + "%");
|
||||
example.createCriteria().andFileLike(tmpPath.replace(File.separator, replacement) + "%");
|
||||
main = musicDataDao.selectByExample(example);
|
||||
} else {
|
||||
main = musicDataDao.selectByRegexp(path.replace(File.separator, replacement) + replacement + "([^" + replacement + "]+)$");
|
||||
}
|
||||
tmpPath=tmpPath.replace(File.separator, replacement)
|
||||
.replace("[","\\[")
|
||||
.replace("(","\\(")
|
||||
.replace(")","\\)")
|
||||
.replace("]","\\]");
|
||||
main.addAll(musicDataDao.selectByRegexp(tmpPath + replacement + "([^" + replacement + "]+)$"));
|
||||
|
||||
if (!path.equals(MusicController.defaultMusicPath) && !path.equals("root")) {
|
||||
MusicData tmp = main.get(0);
|
||||
MusicData t2 = new MusicData();
|
||||
t2.setTitle("返回");
|
||||
if(main.isEmpty()){
|
||||
t2.setFile("root");
|
||||
}else {
|
||||
MusicData tmp = main.get(0);
|
||||
t2.setFile(new File(tmp.getLastdir()).getAbsolutePath());
|
||||
}
|
||||
System.out.println("查询地址:"+path+" 设置返回地址:"+t2.getFile());
|
||||
t2.setIsdir(1);
|
||||
list.add(t2);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user