wangys před 5 roky
rodič
revize
ccc72bdbab

+ 10 - 0
src/main/java/cn/efunbox/audio/impl/DeviceServiceImpl.java

@@ -10,6 +10,7 @@ import cn.efunbox.audio.utils.ApiCode;
 import cn.efunbox.audio.utils.ApiResult;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
 import org.springframework.data.domain.Page;
 import org.springframework.data.domain.PageRequest;
 import org.springframework.data.domain.Pageable;
@@ -34,6 +35,9 @@ public class DeviceServiceImpl implements DeviceService {
     @Autowired
     AlbumRepo albumRepo;
 
+    @Value("${efunbox.oss.img.url}")
+    private String imgURL;
+
     @Override
     public boolean CheckRegister(Long idChannel, String idDevice){
         List<Device> list = deviceRepo.findByChannelDevice(idChannel, idDevice);
@@ -161,6 +165,12 @@ public class DeviceServiceImpl implements DeviceService {
         if(Objects.isNull(devices)){
             return null;
         }
+        List<Album> albums = albumRepo.findAlbum(idDevice);
+        albums.stream().forEach(album -> {
+            if(Objects.nonNull(album.getImage())){
+                album.setImage(imgURL + album.getImage());
+            }
+        });
         return albumRepo.findAlbum(idDevice);
     }
 }