mirror of
https://github.com/PlayEdu/PlayEdu
synced 2025-12-22 18:29:51 +08:00
新增视频播放地址api
This commit is contained in:
@@ -33,4 +33,6 @@ public interface ResourceService extends IService<Resource> {
|
||||
Map<Integer, Integer> getCategoryCount(String type);
|
||||
|
||||
Integer total(String type);
|
||||
|
||||
Integer duration(Integer id);
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user