This repository has been archived by the owner on Jun 21, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ad8f34e
commit cb01e4b
Showing
11 changed files
with
124 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
src/main/java/com/debugers/alltv/controller/TopController.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package com.debugers.alltv.controller; | ||
|
||
import com.debugers.alltv.model.LiveRoom; | ||
import com.debugers.alltv.result.Result; | ||
import com.debugers.alltv.service.DouYuService; | ||
import io.swagger.annotations.Api; | ||
import org.springframework.web.bind.annotation.*; | ||
|
||
import java.util.List; | ||
|
||
@Api(tags = "综合各个平台") | ||
@RestController | ||
@RequestMapping("api/top") | ||
public class TopController { | ||
private final DouYuService douYuService; | ||
|
||
public TopController(DouYuService douYuService) { | ||
this.douYuService = douYuService; | ||
} | ||
@GetMapping("live/{cid}") | ||
public Result<List<LiveRoom>> getTopRooms(@PathVariable("cid") String cid, @RequestParam(defaultValue = "0") Integer pageNum){ | ||
List<LiveRoom> rooms = douYuService.getTopRoomsByCid(cid, 10, pageNum); | ||
return Result.success(rooms); | ||
} | ||
} |
29 changes: 29 additions & 0 deletions
29
src/main/java/com/debugers/alltv/enumType/BilibiliOpenApi.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package com.debugers.alltv.enumType; | ||
|
||
/** | ||
* bilibili官方api | ||
* @author harryzhang | ||
* https://api.live.bilibili.com/room/v1/RoomRecommend/biliIndexRecList | ||
*/ | ||
public enum BilibiliOpenApi { | ||
//统一后面+roomId | ||
SERVER_CONFIG("https://api.live.bilibili.com/room/v1/Danmu/getConf?id="), | ||
ROOM_INIT("https://api.live.bilibili.com/room/v1/Room/room_init?id="), | ||
PLAY_URL("https://api.live.bilibili.com/room/v1/Room/playUrl?cid=") | ||
; | ||
|
||
private String url; | ||
|
||
BilibiliOpenApi(String url) { | ||
this.url = url; | ||
} | ||
|
||
public String getValue() { | ||
return url; | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return getValue(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package com.debugers.alltv.model; | ||
|
||
import lombok.Data; | ||
|
||
import java.util.Date; | ||
|
||
@Data | ||
public class LiveRoom { | ||
private String roomId; | ||
private String com;//哪个平台 | ||
private String cateId; | ||
private String roomThumb; | ||
private String cateName;//分类名 | ||
private String roomName; | ||
private Integer roomStatus; //1 开播 2 未开播 | ||
private Date startTime; | ||
private String ownerName; | ||
private String avatar; | ||
private Long online; //热度 | ||
private String realUrl; //真是直播地址 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,31 @@ | ||
package com.debugers.alltv.model.dto; | ||
|
||
import io.swagger.annotations.ApiModel; | ||
import io.swagger.annotations.ApiModelProperty; | ||
import com.alibaba.fastjson.annotation.JSONField; | ||
import lombok.Data; | ||
|
||
import java.util.Date; | ||
|
||
@Data | ||
@ApiModel(description = "斗鱼房间信息") | ||
public class DouYuDTO { | ||
@ApiModelProperty("房间id") | ||
@JSONField(name = "room_id") | ||
private String roomId; | ||
@ApiModelProperty(value = "直播分类id",example = "1") | ||
@JSONField(name = "cate_id") | ||
private String cateId; | ||
@ApiModelProperty("房间预览缩略图") | ||
@JSONField(name = "room_src") | ||
private String roomThumb; | ||
@ApiModelProperty("分类名") | ||
@JSONField(name = "game_name") | ||
private String cateName;//分类名 | ||
@ApiModelProperty("房间名") | ||
@JSONField(name = "room_name") | ||
private String roomName; | ||
@ApiModelProperty(value = "开播状态",notes = "1 开播 2 未开播") | ||
@JSONField(name = "show_status") | ||
private Integer roomStatus; //1 开播 2 未开播 | ||
@ApiModelProperty("本次开播时间,如果没开播则是上一次开播时间") | ||
@JSONField(name = "show_time") | ||
private Date startTime; | ||
@ApiModelProperty("主播名") | ||
@JSONField(name = "nickname") | ||
private String ownerName; | ||
@ApiModelProperty("主播头像") | ||
@JSONField(name = "avatar") | ||
private String avatar; | ||
@ApiModelProperty("斗鱼热度") | ||
private Long online; //斗鱼叫热度 | ||
@ApiModelProperty("真实直播源地址") | ||
@JSONField(name = "online") | ||
private Long online; //热度 | ||
private String realUrl; //真是直播地址 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters