关注主播
This commit is contained in:
300
common/src/main/java/com/yunbao/common/bean/LiveInfoModel.java
Normal file
300
common/src/main/java/com/yunbao/common/bean/LiveInfoModel.java
Normal file
@@ -0,0 +1,300 @@
|
||||
package com.yunbao.common.bean;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
/**
|
||||
* 直播间信息数据类
|
||||
*/
|
||||
public class LiveInfoModel extends BaseModel {
|
||||
/**
|
||||
* uid : 97721
|
||||
* title :
|
||||
* city : 好像在火星
|
||||
* stream : 97721_1653119771
|
||||
* pull : http://pullry.yaoulive.com/uwd1c0sxu1p71/97721_1653119771.flv
|
||||
* thumb : https://ceshi.yaoulive.com/default.jpg
|
||||
* isvideo : 0
|
||||
* type : 0
|
||||
* type_val : 0
|
||||
* game_action : 0
|
||||
* goodnum : 0
|
||||
* anyway : 1
|
||||
* push : rtmp://pushry.yaoulive.com/uwd1c0sxu1p71/97721_1653119771
|
||||
* islive : 1
|
||||
* landscape : 2
|
||||
* is_rong : 1
|
||||
* nums : 4
|
||||
* avatar : https://ceshi.yaoulive.com/default.jpg
|
||||
* avatar_thumb : https://ceshi.yaoulive.com/default_thumb.jpg
|
||||
* user_nicename : 卢本伟
|
||||
* sex : 1
|
||||
* level : 8
|
||||
* level_anchor : 20
|
||||
* game :
|
||||
*/
|
||||
|
||||
@SerializedName("uid")
|
||||
private long uid = 0;
|
||||
@SerializedName("title")
|
||||
private String title = "";
|
||||
@SerializedName("city")
|
||||
private String city = "";
|
||||
@SerializedName("stream")
|
||||
private String stream = "";
|
||||
@SerializedName("pull")
|
||||
private String pull = "";
|
||||
@SerializedName("thumb")
|
||||
private String thumb = "";
|
||||
@SerializedName("isvideo")
|
||||
private long isvideo = 0;
|
||||
@SerializedName("type")
|
||||
private long type = 0;
|
||||
@SerializedName("type_val")
|
||||
private String typeVal = "";
|
||||
@SerializedName("game_action")
|
||||
private long gameAction = 0;
|
||||
@SerializedName("goodnum")
|
||||
private String goodnum = "";
|
||||
@SerializedName("anyway")
|
||||
private long anyway = 0;
|
||||
@SerializedName("push")
|
||||
private String push = "";
|
||||
@SerializedName("islive")
|
||||
private long islive;
|
||||
@SerializedName("landscape")
|
||||
private long landscape = 0;
|
||||
@SerializedName("is_rong")
|
||||
private long isRong = 0;
|
||||
@SerializedName("nums")
|
||||
private String nums = "";
|
||||
@SerializedName("avatar")
|
||||
private String avatar = "";
|
||||
@SerializedName("avatar_thumb")
|
||||
private String avatarThumb = "";
|
||||
@SerializedName("user_nicename")
|
||||
private String userNicename = "";
|
||||
@SerializedName("sex")
|
||||
private long sex = 0;
|
||||
@SerializedName("level")
|
||||
private String level = "";
|
||||
@SerializedName("level_anchor")
|
||||
private String levelAnchor = "";
|
||||
@SerializedName("game")
|
||||
private String game = "";
|
||||
|
||||
public long getUid() {
|
||||
return uid;
|
||||
}
|
||||
|
||||
public LiveInfoModel setUid(long uid) {
|
||||
this.uid = uid;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getTitle() {
|
||||
return title;
|
||||
}
|
||||
|
||||
public LiveInfoModel setTitle(String title) {
|
||||
this.title = title;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getCity() {
|
||||
return city;
|
||||
}
|
||||
|
||||
public LiveInfoModel setCity(String city) {
|
||||
this.city = city;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getStream() {
|
||||
return stream;
|
||||
}
|
||||
|
||||
public LiveInfoModel setStream(String stream) {
|
||||
this.stream = stream;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getPull() {
|
||||
return pull;
|
||||
}
|
||||
|
||||
public LiveInfoModel setPull(String pull) {
|
||||
this.pull = pull;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getThumb() {
|
||||
return thumb;
|
||||
}
|
||||
|
||||
public LiveInfoModel setThumb(String thumb) {
|
||||
this.thumb = thumb;
|
||||
return this;
|
||||
}
|
||||
|
||||
public long getIsvideo() {
|
||||
return isvideo;
|
||||
}
|
||||
|
||||
public LiveInfoModel setIsvideo(long isvideo) {
|
||||
this.isvideo = isvideo;
|
||||
return this;
|
||||
}
|
||||
|
||||
public long getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public LiveInfoModel setType(long type) {
|
||||
this.type = type;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getTypeVal() {
|
||||
return typeVal;
|
||||
}
|
||||
|
||||
public LiveInfoModel setTypeVal(String typeVal) {
|
||||
this.typeVal = typeVal;
|
||||
return this;
|
||||
}
|
||||
|
||||
public long getGameAction() {
|
||||
return gameAction;
|
||||
}
|
||||
|
||||
public LiveInfoModel setGameAction(long gameAction) {
|
||||
this.gameAction = gameAction;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getGoodnum() {
|
||||
return goodnum;
|
||||
}
|
||||
|
||||
public LiveInfoModel setGoodnum(String goodnum) {
|
||||
this.goodnum = goodnum;
|
||||
return this;
|
||||
}
|
||||
|
||||
public long getAnyway() {
|
||||
return anyway;
|
||||
}
|
||||
|
||||
public LiveInfoModel setAnyway(long anyway) {
|
||||
this.anyway = anyway;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getPush() {
|
||||
return push;
|
||||
}
|
||||
|
||||
public LiveInfoModel setPush(String push) {
|
||||
this.push = push;
|
||||
return this;
|
||||
}
|
||||
|
||||
public long getIslive() {
|
||||
return islive;
|
||||
}
|
||||
|
||||
public LiveInfoModel setIslive(long islive) {
|
||||
this.islive = islive;
|
||||
return this;
|
||||
}
|
||||
|
||||
public long getLandscape() {
|
||||
return landscape;
|
||||
}
|
||||
|
||||
public LiveInfoModel setLandscape(long landscape) {
|
||||
this.landscape = landscape;
|
||||
return this;
|
||||
}
|
||||
|
||||
public long getIsRong() {
|
||||
return isRong;
|
||||
}
|
||||
|
||||
public LiveInfoModel setIsRong(long isRong) {
|
||||
this.isRong = isRong;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getNums() {
|
||||
return nums;
|
||||
}
|
||||
|
||||
public LiveInfoModel setNums(String nums) {
|
||||
this.nums = nums;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getAvatar() {
|
||||
return avatar;
|
||||
}
|
||||
|
||||
public LiveInfoModel setAvatar(String avatar) {
|
||||
this.avatar = avatar;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getAvatarThumb() {
|
||||
return avatarThumb;
|
||||
}
|
||||
|
||||
public LiveInfoModel setAvatarThumb(String avatarThumb) {
|
||||
this.avatarThumb = avatarThumb;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getUserNicename() {
|
||||
return userNicename;
|
||||
}
|
||||
|
||||
public LiveInfoModel setUserNicename(String userNicename) {
|
||||
this.userNicename = userNicename;
|
||||
return this;
|
||||
}
|
||||
|
||||
public long getSex() {
|
||||
return sex;
|
||||
}
|
||||
|
||||
public LiveInfoModel setSex(long sex) {
|
||||
this.sex = sex;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getLevel() {
|
||||
return level;
|
||||
}
|
||||
|
||||
public LiveInfoModel setLevel(String level) {
|
||||
this.level = level;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getLevelAnchor() {
|
||||
return levelAnchor;
|
||||
}
|
||||
|
||||
public LiveInfoModel setLevelAnchor(String levelAnchor) {
|
||||
this.levelAnchor = levelAnchor;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getGame() {
|
||||
return game;
|
||||
}
|
||||
|
||||
public LiveInfoModel setGame(String game) {
|
||||
this.game = game;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
package com.yunbao.common.bean;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
/**
|
||||
* 关注直播
|
||||
*/
|
||||
public class SetAttentsModel extends BaseModel {
|
||||
|
||||
|
||||
/**
|
||||
* isattent : 1
|
||||
*/
|
||||
|
||||
@SerializedName("isattent")
|
||||
private String isattent = "";
|
||||
|
||||
public String getIsattent() {
|
||||
return isattent;
|
||||
}
|
||||
|
||||
public SetAttentsModel setIsattent(String isattent) {
|
||||
this.isattent = isattent;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@@ -3,8 +3,10 @@ package com.yunbao.common.http;
|
||||
import com.yunbao.common.bean.AnchorRecommendModel;
|
||||
import com.yunbao.common.bean.BaseModel;
|
||||
import com.yunbao.common.bean.IMLoginModel;
|
||||
import com.yunbao.common.bean.LiveInfoModel;
|
||||
import com.yunbao.common.bean.NobleTrumpetModel;
|
||||
import com.yunbao.common.bean.SearchModel;
|
||||
import com.yunbao.common.bean.SetAttentsModel;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -101,4 +103,26 @@ public interface PDLiveApi {
|
||||
Observable<ResponseModel<AnchorRecommendModel>> anchorRecommend(
|
||||
@Query("num") String num
|
||||
);
|
||||
|
||||
/**
|
||||
* 获取直播间信息
|
||||
*
|
||||
* @param liveuid 主播id
|
||||
* @return
|
||||
*/
|
||||
@GET("/api/public/?service=Live.getLiveInfo")
|
||||
Observable<ResponseModel<List<LiveInfoModel>>> getLiveInfo(
|
||||
@Query("liveuid") String liveuid
|
||||
);
|
||||
|
||||
/**
|
||||
* 关注主播
|
||||
*
|
||||
* @param liveuid
|
||||
* @return
|
||||
*/
|
||||
@GET("/api/public/?service=User.setAttents")
|
||||
Observable<ResponseModel<List<SetAttentsModel>>> setAttents(
|
||||
@Query("liveuid") String liveuid
|
||||
);
|
||||
}
|
||||
|
||||
@@ -3,13 +3,16 @@ package com.yunbao.common.http.live;
|
||||
import android.content.Context;
|
||||
|
||||
import com.yunbao.common.bean.BaseModel;
|
||||
import com.yunbao.common.bean.LiveInfoModel;
|
||||
import com.yunbao.common.bean.NobleTrumpetModel;
|
||||
import com.yunbao.common.http.API;
|
||||
import com.yunbao.common.http.ResponseModel;
|
||||
import com.yunbao.common.http.base.HttpCallback;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||
import io.reactivex.functions.Consumer;
|
||||
import io.reactivex.schedulers.Schedulers;
|
||||
|
||||
/**
|
||||
@@ -77,4 +80,34 @@ public class LiveNetManager {
|
||||
//java.lang.IllegalStateException: Fragment LiveInputDialogFragment{229db51} (f38ce923-7a48-4c64-925a-bed0edfb7fa7)} not attached to a context.
|
||||
}).isDisposed();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取直播间信息
|
||||
*
|
||||
* @param liveuid 主播id
|
||||
* @return
|
||||
*/
|
||||
public void getLiveInfo(String liveuid, HttpCallback<LiveInfoModel> callback) {
|
||||
API.get().pdLiveApi(mContext).getLiveInfo(liveuid)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new Consumer<ResponseModel<List<LiveInfoModel>>>() {
|
||||
@Override
|
||||
public void accept(ResponseModel<List<LiveInfoModel>> listResponseModel) throws Exception {
|
||||
List<LiveInfoModel> liveInfoModels = listResponseModel.getData().getInfo();
|
||||
if (liveInfoModels.size() > 0) {
|
||||
LiveInfoModel liveInfoModel = liveInfoModels.get(0);
|
||||
if (callback != null)
|
||||
callback.onSuccess(liveInfoModel);
|
||||
} else {
|
||||
if (callback != null)
|
||||
callback.onError("直播已结束");
|
||||
}
|
||||
|
||||
}
|
||||
}, throwable -> {
|
||||
if (callback != null)
|
||||
callback.onError(throwable.getMessage());
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user