直播数据对接接口

This commit is contained in:
zlzw 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>

View File

@ -13,11 +13,12 @@ import androidx.recyclerview.widget.RecyclerView;
import com.yunbao.live.R;
import com.yunbao.live.bean.LiveDataInfoModel;
import java.util.ArrayList;
import java.util.List;
public class LiveDataInfoRecyclerAdapter extends RecyclerView.Adapter<LiveDataInfoRecyclerAdapter.LiveDataHolder> {
private Context mContext;
private List<LiveDataInfoModel> list;
private List<LiveDataInfoModel> list=new ArrayList<>();
public LiveDataInfoRecyclerAdapter(Context mContext) {
this.mContext = mContext;

View File

@ -7,6 +7,20 @@ public class LiveDataInfoModel extends BaseModel {
private String title;
private String data;
public LiveDataInfoModel(String color, String title, String data) {
this.color = color;
this.title = title;
this.data = data;
}
public LiveDataInfoModel(String title, String data) {
this.title = title;
this.data = data;
}
public LiveDataInfoModel() {
}
public String getColor() {
return color;
}

View File

@ -8,6 +8,9 @@ import androidx.recyclerview.widget.RecyclerView;
import com.lxj.xpopup.XPopup;
import com.yunbao.common.dialog.AbsDialogPopupWindow;
import com.yunbao.common.http.base.HttpCallback;
import com.yunbao.common.http.live.LiveNetManager;
import com.yunbao.common.utils.WordUtil;
import com.yunbao.live.R;
import com.yunbao.live.adapter.LiveDataInfoRecyclerAdapter;
import com.yunbao.live.bean.LiveDataInfoModel;
@ -21,11 +24,20 @@ public class LiveDataInfoDialog extends AbsDialogPopupWindow {
private RecyclerView recyclerView;
private LiveDataInfoRecyclerAdapter adapter;
private List<LiveDataInfoModel> list;
private String liveUid;
public LiveDataInfoDialog(@NonNull Context context) {
super(context);
}
public LiveDataInfoDialog(@NonNull Context context, String liveUid) {
super(context);
this.liveUid = liveUid;
}
public void setLiveUid(String liveUid) {
this.liveUid = liveUid;
}
@Override
public void buildDialog(XPopup.Builder builder) {
@ -49,17 +61,36 @@ public class LiveDataInfoDialog extends AbsDialogPopupWindow {
private void initData() {
list = new ArrayList<>();
for (int i = 0; i < 8; i++) {
LiveDataInfoModel model = new LiveDataInfoModel();
if (i == 0) {
model.setColor("#00FFFF");
} else if (i == 1) {
model.setColor("#FFF69F");
}
model.setTitle("标题:" + i);
model.setData("数据:" + i);
list.add(model);
}
list.add(new LiveDataInfoModel("#00FFFF", WordUtil.getString(R.string.live_data_coin), WordUtil.getString(R.string.live_data_loading)));
list.add(new LiveDataInfoModel("#FFF69F", WordUtil.getString(R.string.live_data_gold), WordUtil.getString(R.string.live_data_loading)));
list.add(new LiveDataInfoModel(WordUtil.getString(R.string.live_data_accept), WordUtil.getString(R.string.live_data_loading)));
list.add(new LiveDataInfoModel(WordUtil.getString(R.string.live_data_enter), WordUtil.getString(R.string.live_data_loading)));
list.add(new LiveDataInfoModel(WordUtil.getString(R.string.live_data_attention), WordUtil.getString(R.string.live_data_loading)));
list.add(new LiveDataInfoModel(WordUtil.getString(R.string.live_data_attention_rate), WordUtil.getString(R.string.live_data_loading)));
list.add(new LiveDataInfoModel(WordUtil.getString(R.string.live_data_fan_group), WordUtil.getString(R.string.live_data_loading)));
list.add(new LiveDataInfoModel(WordUtil.getString(R.string.live_data_fan_group_rate), WordUtil.getString(R.string.live_data_loading)));
adapter.setList(list);
LiveNetManager.get(getContext())
.getLiveData(liveUid, new HttpCallback<com.yunbao.common.bean.LiveDataInfoModel>() {
@Override
public void onSuccess(com.yunbao.common.bean.LiveDataInfoModel data) {
list.clear();
list.add(new LiveDataInfoModel("#00FFFF", WordUtil.getString(R.string.live_data_coin), data.getTotalCoin() + ""));
list.add(new LiveDataInfoModel("#FFF69F", WordUtil.getString(R.string.live_data_gold), data.getTotalGold() + ""));
list.add(new LiveDataInfoModel(WordUtil.getString(R.string.live_data_accept), data.getAcceptNum() + ""));
list.add(new LiveDataInfoModel(WordUtil.getString(R.string.live_data_enter), data.getEnterNum() + ""));
list.add(new LiveDataInfoModel(WordUtil.getString(R.string.live_data_attention), data.getAttentionNum() + ""));
list.add(new LiveDataInfoModel(WordUtil.getString(R.string.live_data_attention_rate), data.getAttentionNumRate() + ""));
list.add(new LiveDataInfoModel(WordUtil.getString(R.string.live_data_fan_group), data.getFanGroupNum() + ""));
list.add(new LiveDataInfoModel(WordUtil.getString(R.string.live_data_fan_group_rate), data.getFanGroupNumRate() + ""));
adapter.setList(list);
}
@Override
public void onError(String error) {
}
});
}
}

View File

@ -181,7 +181,7 @@ public class LiveNewFunctionDialogFragment extends AbsDialogFragment implements
dismiss();
} else if (id == R.id.broadcast_data) {
//主播数据
new LiveDataInfoDialog(mContext).showDialog();
new LiveDataInfoDialog(mContext, liveUid).showDialog();
dismiss();
} else if (id == R.id.anchor_task) {
//主播任务

View File

@ -18,19 +18,19 @@
<string name="live_room_private_des">Only those who have the room code can watch</string>
<string name="live_room_type_submit">Submit</string>
<string name="live_mic_max">The number of voices has reached 3, and no more can be added.</string>
<string name="live_task_no1">當日連續開播時長(分鐘)</string>
<string name="live_task_no2">當日累計PK次數(不限模式)</string>
<string name="live_task_fans_no1">當日累積新增關註粉絲</string>
<string name="live_task_fans_no2">當日累積新增粉絲團成員</string>
<string name="live_task_tab1">直播互動</string>
<string name="live_task_tab2">粉絲增漲</string>
<string name="live_task_info_title">主播任務特別說明</string>
<string name="live_task_info_msg1">所有主播在開播後,即可獲得一系列的當日任務,當根據相應的要求完成任務後,主播即可在第二天開播後,獲得前一天的任務獎勵。</string>
<string name="live_task_info_msg2">所有任務數值將由系統進行實時計算,如因個人手機電腦設備問題、網絡問題或是沒有正常進行下播導致數據出現錯誤等問題,為此相關主播可進行聯系相關平臺工作人員或是在線客服,進行反饋,待相關部分確認後,將會再進行補償處理。\n● 所有任務數據的正常結算周期將會在每日的淩晨6點進行結算若開播時間超過淩晨6點將會出現獎勵無法正常結算的情況請知悉。\n● 當主播規範分低於90時主播任務中心的所有獎勵將僅能獲得50%的當主播規範分低於80以下時將無法獲得主播任務獎勵。</string>
<string name="live_task_item_complete_true">已完成</string>
<string name="live_task_item_complete_false">未完成</string>
<string name="live_task_item_hot">直播熱度</string>
<string name="live_task_item_xp">主播經驗</string>
<string name="live_data_msg1">本場直播數據統計</string>
<string name="live_data_msg2">歷史數據可在主播中心查看</string>
<string name="live_task_no1">Consecutive broadcast duration of the day (minutes)</string>
<string name="live_task_no2">PK count on the day (unlimited mode)</string>
<string name="live_task_fans_no1">Accumulated new followers on that day</string>
<string name="live_task_fans_no2">Cumulative new fan group members on that day</string>
<string name="live_task_tab1">Live interaction</string>
<string name="live_task_tab2">Fan growth</string>
<string name="live_task_info_title">Special instructions for anchor tasks</string>
<string name="live_task_info_msg1">After the broadcast, all anchors can get a series of tasks of the day. After completing the tasks according to the corresponding requirements, anchors can get the task reward of the previous day after the broadcast of the next day.</string>
<string name="live_task_info_msg2">All task values will be calculated by the system in real time. If data errors occur due to personal, mobile, computer equipment problems, network problems or no normal downcasting, relevant anchors can contact relevant platform staff or online customer service for feedback. After confirmation by relevant part, compensation will be processed.\n● The normal settlement period of all mission data will be settled at 6:00 am every day. If the broadcast time is longer than 6:00 AM, the reward cannot be settled normally, please be noted.\n● When the anchor standard score is lower than 90, the anchor task center can only get 50% of all rewards. When the anchor standard score is lower than 80, the anchor task reward cannot be obtained.</string>
<string name="live_task_item_complete_true">success</string>
<string name="live_task_item_complete_false">incomplete</string>
<string name="live_task_item_hot">hot</string>
<string name="live_task_item_xp">exp</string>
<string name="live_data_msg1">This live data statistics</string>
<string name="live_data_msg2">Historical data can be viewed in the anchor center</string>
</resources>