获取专辑图接口新增type参数,为album时表示fileName参数为专辑名而非文件名
This commit is contained in:
parent
e7c269e6ba
commit
cfb36dd830
@ -133,13 +133,20 @@ public class MusicController {
|
||||
json.put("code", 0);
|
||||
return json.toJSONString();
|
||||
}
|
||||
|
||||
@RequestMapping(value = "web/image.do", produces = MediaType.IMAGE_JPEG_VALUE)
|
||||
@ResponseBody
|
||||
public byte[] getImage(String fileName){
|
||||
public byte[] getImage(String fileName, String type) {
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("fileName", fileName);
|
||||
if (StringUtils.isEmpty(type)) {
|
||||
json.put("type", "file");
|
||||
} else {
|
||||
json.put("type", type);
|
||||
}
|
||||
return getImage(json);
|
||||
}
|
||||
|
||||
@RequestMapping(value = "image.do", produces = MediaType.IMAGE_JPEG_VALUE)
|
||||
@ResponseBody
|
||||
public byte[] getImage(@RequestBody JSONObject body) {
|
||||
@ -147,7 +154,15 @@ public class MusicController {
|
||||
if (!fileName.startsWith(defaultMusicPath)) {
|
||||
fileName = Tools.base64ToString(fileName);
|
||||
}
|
||||
File file=new File(fileName);
|
||||
List<MusicData> list = null;
|
||||
if (body.getString("type").equals("album")) {
|
||||
list = musicTools.selectAlbum(fileName);
|
||||
}
|
||||
File file;
|
||||
if (list != null && !list.isEmpty()) {
|
||||
fileName = list.get(0).getFile();
|
||||
}
|
||||
file = new File(fileName);
|
||||
if (file.exists()) {
|
||||
try {
|
||||
return musicTools.readImage(file.getAbsolutePath());
|
||||
|
Loading…
Reference in New Issue
Block a user