直播数据对接接口

This commit is contained in:
2023-02-21 16:29:50 +08:00
parent 5d2a246916
commit bf4710470f
11 changed files with 251 additions and 29 deletions

View File

@@ -0,0 +1,106 @@
package com.yunbao.common.bean;
import com.google.gson.annotations.SerializedName;
/**
* 直播数据
*/
public class LiveDataInfoModel extends BaseModel{
@SerializedName("totalCoin")
private long totalCoin;//钻石数量
@SerializedName("totalGold")
private long totalGold;//金币数量
@SerializedName("acceptNum")
private long acceptNum;//送礼人数
@SerializedName("enterNum")
private long enterNum;//进场人数
@SerializedName("attentionNum")
private long attentionNum;//关注人数
@SerializedName("fanGroupNum")
private long fanGroupNum;//粉丝团人数
@SerializedName("attentionNumRate")
private double attentionNumRate;//关注转化率
@SerializedName("fanGroupNumRate")
private double fanGroupNumRate;//粉丝团转化率
public LiveDataInfoModel() {
}
public long getTotalCoin() {
return totalCoin;
}
public void setTotalCoin(long totalCoin) {
this.totalCoin = totalCoin;
}
public long getTotalGold() {
return totalGold;
}
public void setTotalGold(long totalGold) {
this.totalGold = totalGold;
}
public long getAcceptNum() {
return acceptNum;
}
public void setAcceptNum(long acceptNum) {
this.acceptNum = acceptNum;
}
public long getEnterNum() {
return enterNum;
}
public void setEnterNum(long enterNum) {
this.enterNum = enterNum;
}
public long getAttentionNum() {
return attentionNum;
}
public void setAttentionNum(long attentionNum) {
this.attentionNum = attentionNum;
}
public long getFanGroupNum() {
return fanGroupNum;
}
public void setFanGroupNum(long fanGroupNum) {
this.fanGroupNum = fanGroupNum;
}
public double getAttentionNumRate() {
return attentionNumRate;
}
public void setAttentionNumRate(double attentionNumRate) {
this.attentionNumRate = attentionNumRate;
}
public double getFanGroupNumRate() {
return fanGroupNumRate;
}
public void setFanGroupNumRate(double fanGroupNumRate) {
this.fanGroupNumRate = fanGroupNumRate;
}
@Override
public String toString() {
return "LiveDataInfoModel{" +
"totalCoin=" + totalCoin +
", totalGold=" + totalGold +
", acceptNum=" + acceptNum +
", enterNum=" + enterNum +
", attentionNum=" + attentionNum +
", fanGroupNum=" + fanGroupNum +
", attentionNumRate=" + attentionNumRate +
", fanGroupNumRate=" + fanGroupNumRate +
'}';
}
}

View File

@@ -2,10 +2,19 @@ package com.yunbao.common.bean;
import com.google.gson.annotations.SerializedName;
import com.yunbao.common.R;
import com.yunbao.common.utils.StringUtil;
import com.yunbao.common.utils.WordUtil;
import java.io.Serializable;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
import java.util.Locale;
/**
* 直播任务
*/
public class LiveTaskModel extends BaseModel {
public static final int TASK_TYPE_TIP = 0;
public static final int TASK_TYPE_ITEM = 1;
@@ -36,6 +45,13 @@ public class LiveTaskModel extends BaseModel {
}
public List<List<Task>> getList() {
if (user != null && user.isNew()) {
for (List<Task> tasks : list) {
for (Task task : tasks) {
task.isNewUser = true;
}
}
}
return list;
}
@@ -70,6 +86,9 @@ public class LiveTaskModel extends BaseModel {
}
public String getEndTime() {
if (!StringUtil.isEmpty(endTime)) {
endTime = WordUtil.getString(R.string.live_task_new_user_timer) + new SimpleDateFormat("yyyy/MM/dd HH:mm", Locale.getDefault()).format(new Date(Long.parseLong(endTime) * 1000));
}
return endTime;
}
@@ -113,6 +132,8 @@ public class LiveTaskModel extends BaseModel {
@SerializedName("now_num")
private int nowValue;
private boolean isNewUser = false;
public Task() {
}
@@ -157,6 +178,9 @@ public class LiveTaskModel extends BaseModel {
}
public long getHot() {
if (isNewUser) {
hot = newUserHot;
}
return hot;
}
@@ -165,6 +189,9 @@ public class LiveTaskModel extends BaseModel {
}
public long getExp() {
if (isNewUser) {
exp = newUserExp;
}
return exp;
}
@@ -197,7 +224,7 @@ public class LiveTaskModel extends BaseModel {
}
public boolean getStatus() {
return status==1;
return status == 1;
}
public void setStatus(int status) {

View File

@@ -14,6 +14,7 @@ import com.yunbao.common.bean.IMLoginModel;
import com.yunbao.common.bean.LinkMicUserBeanV2;
import com.yunbao.common.bean.ListInfoMessageModel;
import com.yunbao.common.bean.LiveAiRobotBean;
import com.yunbao.common.bean.LiveDataInfoModel;
import com.yunbao.common.bean.LiveInfoModel;
import com.yunbao.common.bean.LiveRoomActivityBanner;
import com.yunbao.common.bean.LiveStetUpStatusModel;
@@ -558,4 +559,11 @@ public interface PDLiveApi {
@Query("type") int type,
@Query("liveuid") String liveUid
);
/**
* 获取直播数据
*/
@GET("/api/public/?service=Live.getLiveStatisticalData")
Observable<ResponseModel<LiveDataInfoModel>> getLiveDataInfo(
@Query("liveuid") String liveUid
);
}

View File

@@ -16,6 +16,7 @@ import com.yunbao.common.bean.LinkMicUserBean;
import com.yunbao.common.bean.LinkMicUserBeanV2;
import com.yunbao.common.bean.ListInfoMessageModel;
import com.yunbao.common.bean.LiveAiRobotBean;
import com.yunbao.common.bean.LiveDataInfoModel;
import com.yunbao.common.bean.LiveInfoModel;
import com.yunbao.common.bean.LiveRoomActivityBanner;
import com.yunbao.common.bean.LiveStetUpStatusModel;
@@ -1104,6 +1105,20 @@ public class LiveNetManager {
callback.onError(throwable.getMessage());
}).isDisposed();
}
/**
* 获取直播数据
*/
public void getLiveData(String liveUid, HttpCallback<LiveDataInfoModel> callback) {
API.get().pdLiveApi(mContext)
.getLiveDataInfo(liveUid)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(listResponseModel -> {
callback.onSuccess(listResponseModel.getData().getInfo());
}, throwable -> {
callback.onError(throwable.getMessage());
}).isDisposed();
}
/**
* 直播间取消网络请求

View File

@@ -1009,4 +1009,14 @@ Limited ride And limited avatar frame</string>
<string name="anchor_agreement">I have read and agreed to the </string>
<string name="anchor_agreement_hint">Please read and agree to the PDLIVE Host Agreement</string>
<string name="anchor_hint">PDLIVE Host Agreement</string>
<string name="live_task_new_user_timer">The statute of limitations for new anchors expires</string>
<string name="live_data_coin">coin</string>
<string name="live_data_gold">gold</string>
<string name="live_data_accept">Number of gifts</string>
<string name="live_data_enter">Number of entry</string>
<string name="live_data_attention">New attention</string>
<string name="live_data_attention_rate">Follow the conversion rate</string>
<string name="live_data_fan_group">New fan group</string>
<string name="live_data_fan_group_rate">Fan group conversion rate</string>
<string name="live_data_loading">loading…</string>
</resources>

View File

@@ -1030,4 +1030,14 @@
<string name="anchor_agreement">我已閱讀並同意</string>
<string name="anchor_agreement_hint">請閱讀並同意《PDLIVE主播協議》</string>
<string name="anchor_hint">《PDLIVE主播協議》</string>
<string name="live_task_new_user_timer">新秀主播時效截止至 </string>
<string name="live_data_coin">鑽石收禮</string>
<string name="live_data_gold">金豆收禮</string>
<string name="live_data_accept">收禮人數</string>
<string name="live_data_enter">進場人數</string>
<string name="live_data_attention">新增關注</string>
<string name="live_data_attention_rate">關注轉化率</string>
<string name="live_data_fan_group">新增粉絲團</string>
<string name="live_data_fan_group_rate">粉絲團轉化率</string>
<string name="live_data_loading">加载中…</string>
</resources>