diff --git a/common/src/main/java/com/yunbao/common/bean/LiveDataInfoModel.java b/common/src/main/java/com/yunbao/common/bean/LiveDataInfoModel.java new file mode 100644 index 000000000..a6c3b203e --- /dev/null +++ b/common/src/main/java/com/yunbao/common/bean/LiveDataInfoModel.java @@ -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 + + '}'; + } +} diff --git a/common/src/main/java/com/yunbao/common/bean/LiveTaskModel.java b/common/src/main/java/com/yunbao/common/bean/LiveTaskModel.java index 27e51caa0..401be64fc 100644 --- a/common/src/main/java/com/yunbao/common/bean/LiveTaskModel.java +++ b/common/src/main/java/com/yunbao/common/bean/LiveTaskModel.java @@ -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> getList() { + if (user != null && user.isNew()) { + for (List 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) { diff --git a/common/src/main/java/com/yunbao/common/http/PDLiveApi.java b/common/src/main/java/com/yunbao/common/http/PDLiveApi.java index f90f9e761..3961dbefa 100644 --- a/common/src/main/java/com/yunbao/common/http/PDLiveApi.java +++ b/common/src/main/java/com/yunbao/common/http/PDLiveApi.java @@ -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> getLiveDataInfo( + @Query("liveuid") String liveUid + ); } diff --git a/common/src/main/java/com/yunbao/common/http/live/LiveNetManager.java b/common/src/main/java/com/yunbao/common/http/live/LiveNetManager.java index 1bb664ab2..e3a23e104 100644 --- a/common/src/main/java/com/yunbao/common/http/live/LiveNetManager.java +++ b/common/src/main/java/com/yunbao/common/http/live/LiveNetManager.java @@ -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 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(); + } /** * 直播间取消网络请求 diff --git a/common/src/main/res/values-en/strings.xml b/common/src/main/res/values-en/strings.xml index 004dcf125..e92aa3e9f 100644 --- a/common/src/main/res/values-en/strings.xml +++ b/common/src/main/res/values-en/strings.xml @@ -1009,4 +1009,14 @@ Limited ride And limited avatar frame I have read and agreed to the Please read and agree to the PDLIVE Host Agreement PDLIVE Host Agreement + The statute of limitations for new anchors expires + coin + gold + Number of gifts + Number of entry + New attention + Follow the conversion rate + New fan group + Fan group conversion rate + loading… diff --git a/common/src/main/res/values/strings.xml b/common/src/main/res/values/strings.xml index 0d846e4e7..795f8a9eb 100644 --- a/common/src/main/res/values/strings.xml +++ b/common/src/main/res/values/strings.xml @@ -1030,4 +1030,14 @@ 我已閱讀並同意 請閱讀並同意《PDLIVE主播協議》 《PDLIVE主播協議》 + 新秀主播時效截止至 + 鑽石收禮 + 金豆收禮 + 收禮人數 + 進場人數 + 新增關注 + 關注轉化率 + 新增粉絲團 + 粉絲團轉化率 + 加载中… diff --git a/live/src/main/java/com/yunbao/live/adapter/LiveDataInfoRecyclerAdapter.java b/live/src/main/java/com/yunbao/live/adapter/LiveDataInfoRecyclerAdapter.java index 0e58c2e75..5bf22b60a 100644 --- a/live/src/main/java/com/yunbao/live/adapter/LiveDataInfoRecyclerAdapter.java +++ b/live/src/main/java/com/yunbao/live/adapter/LiveDataInfoRecyclerAdapter.java @@ -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 { private Context mContext; - private List list; + private List list=new ArrayList<>(); public LiveDataInfoRecyclerAdapter(Context mContext) { this.mContext = mContext; diff --git a/live/src/main/java/com/yunbao/live/bean/LiveDataInfoModel.java b/live/src/main/java/com/yunbao/live/bean/LiveDataInfoModel.java index 80f3f283a..81a65ec4e 100644 --- a/live/src/main/java/com/yunbao/live/bean/LiveDataInfoModel.java +++ b/live/src/main/java/com/yunbao/live/bean/LiveDataInfoModel.java @@ -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; } diff --git a/live/src/main/java/com/yunbao/live/dialog/LiveDataInfoDialog.java b/live/src/main/java/com/yunbao/live/dialog/LiveDataInfoDialog.java index 87392a0fb..a9ebf66b2 100644 --- a/live/src/main/java/com/yunbao/live/dialog/LiveDataInfoDialog.java +++ b/live/src/main/java/com/yunbao/live/dialog/LiveDataInfoDialog.java @@ -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 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() { + @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) { + + } + }); + } } diff --git a/live/src/main/java/com/yunbao/live/dialog/LiveNewFunctionDialogFragment.java b/live/src/main/java/com/yunbao/live/dialog/LiveNewFunctionDialogFragment.java index bf647b326..7e2468f40 100644 --- a/live/src/main/java/com/yunbao/live/dialog/LiveNewFunctionDialogFragment.java +++ b/live/src/main/java/com/yunbao/live/dialog/LiveNewFunctionDialogFragment.java @@ -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) { //主播任务 diff --git a/live/src/main/res/values-en/strings.xml b/live/src/main/res/values-en/strings.xml index 9c055f285..ab25dee3f 100644 --- a/live/src/main/res/values-en/strings.xml +++ b/live/src/main/res/values-en/strings.xml @@ -18,19 +18,19 @@ Only those who have the room code can watch Submit The number of voices has reached 3, and no more can be added. - 當日連續開播時長(分鐘) - 當日累計PK次數(不限模式) - 當日累積新增關註粉絲 - 當日累積新增粉絲團成員 - 直播互動 - 粉絲增漲 - 主播任務特別說明 - 所有主播在開播後,即可獲得一系列的當日任務,當根據相應的要求完成任務後,主播即可在第二天開播後,獲得前一天的任務獎勵。 - ● 所有任務數值將由系統進行實時計算,如因個人手機電腦設備問題、網絡問題或是沒有正常進行下播導致數據出現錯誤等問題,為此相關主播可進行聯系相關平臺工作人員或是在線客服,進行反饋,待相關部分確認後,將會再進行補償處理。\n● 所有任務數據的正常結算周期將會在每日的淩晨6點進行結算,若開播時間超過淩晨6點,將會出現獎勵無法正常結算的情況,請知悉。\n● 當主播規範分低於90時,主播任務中心的所有獎勵,將僅能獲得50%的,當主播規範分低於80以下時,將無法獲得主播任務獎勵。 - 已完成 - 未完成 - 直播熱度 - 主播經驗 - 本場直播數據統計 - 歷史數據可在主播中心查看 + Consecutive broadcast duration of the day (minutes) + PK count on the day (unlimited mode) + Accumulated new followers on that day + Cumulative new fan group members on that day + Live interaction + Fan growth + Special instructions for anchor tasks + 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. + ● 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. + success + incomplete + hot + exp + This live data statistics + Historical data can be viewed in the anchor center \ No newline at end of file