新增视频播放地址api

This commit is contained in:
none
2023-03-20 15:33:20 +08:00
parent d19aa8d2ee
commit 71fcb008ed
7 changed files with 179 additions and 4 deletions

View File

@@ -33,4 +33,6 @@ public interface ResourceService extends IService<Resource> {
Map<Integer, Integer> getCategoryCount(String type);
Integer total(String type);
Integer duration(Integer id);
}

View File

@@ -5,6 +5,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import xyz.playedu.api.domain.Resource;
import xyz.playedu.api.domain.ResourceCategoryRelation;
import xyz.playedu.api.domain.ResourceVideo;
import xyz.playedu.api.exception.NotFoundException;
import xyz.playedu.api.service.ResourceService;
import xyz.playedu.api.mapper.ResourceMapper;
@@ -122,6 +123,15 @@ public class ResourceServiceImpl extends ServiceImpl<ResourceMapper, Resource> i
public Integer total(String type) {
return Math.toIntExact(count(query().getWrapper().eq("type", type).eq("is_hidden", 0)));
}
@Override
public Integer duration(Integer id) {
ResourceVideo resourceVideo = resourceVideoService.getOne(resourceVideoService.query().getWrapper().eq("rid", id));
if (resourceVideo == null) {
return null;
}
return resourceVideo.getDuration();
}
}