礼物盲盒基本逻辑

This commit is contained in:
18401019693
2023-05-24 14:50:39 +08:00
parent 3e72b4a9eb
commit 1f7aef91a8
17 changed files with 491 additions and 8 deletions

View File

@@ -0,0 +1,77 @@
package com.yunbao.common.bean;
import com.google.gson.annotations.SerializedName;
import java.util.List;
public class BlindBoxInfoModel extends BaseModel {
/**
* "info":[{"item_name":["麒麟勛章饰品","麒麟頭像框饰品","麒麟坐騎饰品","水晶项链礼物","夢幻水晶球礼物","心動泡泡礼物","蝴蝶少女礼物","金色唱片礼物","鑽石禮盒礼物","紙花船礼物"],"threshold_value":268,"threshold_dress_name":"麒麟坐騎","dress_threshold_value":0,"blind_box_type":1,"blind_box_id":1636},{"item_name":["金鳳勛章饰品","金鳳頭像框饰品","金鳳坐騎饰品","浪漫氣球礼物","捕夢網礼物","仙女棒礼物","藍寶石鈴鐺礼物","榮耀星礼物","童話屋礼物","夢幻許願池礼物"],"threshold_value":198,"threshold_dress_name":"金鳳坐騎","dress_threshold_value":0,"blind_box_type":2,"blind_box_id":1637},{"item_name":["神龍勛章饰品","神龍頭像框饰品","神龍坐騎饰品","水晶玫瑰礼物","sweet香水礼物","甜蜜熱氣球礼物","風鈴舞動礼物","音樂噴泉礼物","星空列車礼物","漂洋過海來看你礼物"],"threshold_value":128,"threshold_dress_name":"神龍坐騎","dress_threshold_value":0,"blind_box_type":3,"blind_box_id":1638}]
*/
@SerializedName("item_name")
private List<String> itemName;
@SerializedName("threshold_value")
private String thresholdValue = "0";
@SerializedName("threshold_dress_name")
private String thresholdDressName;
@SerializedName("dress_threshold_value")
private String dressThresholdValue;
@SerializedName("blind_box_type")
private String blindBoxType;
@SerializedName("blind_box_id")
private String blindBoxId;
public List<String> getItemName() {
return itemName;
}
public BlindBoxInfoModel setItemName(List<String> itemName) {
this.itemName = itemName;
return this;
}
public String getThresholdValue() {
return thresholdValue;
}
public BlindBoxInfoModel setThresholdValue(String thresholdValue) {
this.thresholdValue = thresholdValue;
return this;
}
public String getThresholdDressName() {
return thresholdDressName;
}
public BlindBoxInfoModel setThresholdDressName(String thresholdDressName) {
this.thresholdDressName = thresholdDressName;
return this;
}
public String getDressThresholdValue() {
return dressThresholdValue;
}
public BlindBoxInfoModel setDressThresholdValue(String dressThresholdValue) {
this.dressThresholdValue = dressThresholdValue;
return this;
}
public String getBlindBoxType() {
return blindBoxType;
}
public BlindBoxInfoModel setBlindBoxType(String blindBoxType) {
this.blindBoxType = blindBoxType;
return this;
}
public String getBlindBoxId() {
return blindBoxId;
}
public BlindBoxInfoModel setBlindBoxId(String blindBoxId) {
this.blindBoxId = blindBoxId;
return this;
}
}

View File

@@ -18,7 +18,7 @@ public class LiveGiftBean {
// public static final int MARK_LUCK = 3;
private int id;
private int type;//0 普通礼物 1是贵族 2守护 3粉丝团
private int type;//0 普通礼物 1是贵族 2守护 3粉丝团 5盲盒礼物
private int mark;// 0 普通 1热门 2守护 3幸运
private String name;
private String price;
@@ -34,6 +34,17 @@ public class LiveGiftBean {
private String isweek;
private String end_time;
private String tag;
@JSONField(name = "blind_box_type")
private int blind_box_type = 0;
public int getBlind_box_type() {
return blind_box_type;
}
public LiveGiftBean setBlind_box_type(int blind_box_type) {
this.blind_box_type = blind_box_type;
return this;
}
public String getTag() {
return tag;

View File

@@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSONObject;
import com.yunbao.common.bean.ActiveModel;
import com.yunbao.common.bean.AnchorRecommendModel;
import com.yunbao.common.bean.BaseModel;
import com.yunbao.common.bean.BlindBoxInfoModel;
import com.yunbao.common.bean.CheckLiveModel;
import com.yunbao.common.bean.ContributeModel;
import com.yunbao.common.bean.CustomSidebarInfoModel;
@@ -17,11 +18,11 @@ import com.yunbao.common.bean.LinkMicUserBeanV2;
import com.yunbao.common.bean.ListInfoMessageModel;
import com.yunbao.common.bean.LiveAiRobotBean;
import com.yunbao.common.bean.LiveAnchorCallMeModel;
import com.yunbao.common.bean.LiveRoomVoteModel;
import com.yunbao.common.bean.LiveAnchorSayModel;
import com.yunbao.common.bean.LiveDataInfoModel;
import com.yunbao.common.bean.LiveInfoModel;
import com.yunbao.common.bean.LiveRoomActivityBanner;
import com.yunbao.common.bean.LiveRoomVoteModel;
import com.yunbao.common.bean.LiveStetUpStatusModel;
import com.yunbao.common.bean.LiveTaskModel;
import com.yunbao.common.bean.LiveUserMailBoxModel;
@@ -716,10 +717,17 @@ public interface PDLiveApi {
*/
@GET("/api/public/?service=Live.setLiveVote")
Observable<ResponseModel<List<String>>> updateLiveVote(@Query("liveuid") String liveUid,
@Query("option_content_key") String key);
@Query("option_content_key") String key);
/**
* 主动结束投票
*/
@GET("/api/public/?service=Live.endLiveVote")
Observable<ResponseModel<List<String>>> endLiveVote(@Query("liveuid") String liveUid);
/**
* 获取盲盒礼物当前数据
*/
@GET("/api/public/?service=Live.getBlindBoxInfo")
Observable<ResponseModel<List<BlindBoxInfoModel>>> getBlindBoxInfo();
}

View File

@@ -8,6 +8,7 @@ import com.yunbao.common.Constants;
import com.yunbao.common.R;
import com.yunbao.common.bean.ActiveModel;
import com.yunbao.common.bean.BaseModel;
import com.yunbao.common.bean.BlindBoxInfoModel;
import com.yunbao.common.bean.CheckLiveModel;
import com.yunbao.common.bean.CustomSidebarInfoModel;
import com.yunbao.common.bean.DiscountsModel;
@@ -18,11 +19,11 @@ import com.yunbao.common.bean.LinkMicUserBeanV2;
import com.yunbao.common.bean.ListInfoMessageModel;
import com.yunbao.common.bean.LiveAiRobotBean;
import com.yunbao.common.bean.LiveAnchorCallMeModel;
import com.yunbao.common.bean.LiveRoomVoteModel;
import com.yunbao.common.bean.LiveAnchorSayModel;
import com.yunbao.common.bean.LiveDataInfoModel;
import com.yunbao.common.bean.LiveInfoModel;
import com.yunbao.common.bean.LiveRoomActivityBanner;
import com.yunbao.common.bean.LiveRoomVoteModel;
import com.yunbao.common.bean.LiveStetUpStatusModel;
import com.yunbao.common.bean.LiveTaskModel;
import com.yunbao.common.bean.LiveUserMailBoxModel;
@@ -1522,6 +1523,33 @@ public class LiveNetManager {
}).isDisposed();
}
/**
* 获取盲盒礼物信息
*
* @param callback
*/
public void getBlindBoxInfo(HttpCallback<List<BlindBoxInfoModel>> callback) {
API.get().pdLiveApi(mContext)
.getBlindBoxInfo()
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(new Consumer<ResponseModel<List<BlindBoxInfoModel>>>() {
@Override
public void accept(ResponseModel<List<BlindBoxInfoModel>> listResponseModel) throws Exception {
if (callback != null) {
callback.onSuccess(listResponseModel.getData().getInfo());
}
}
}, new Consumer<Throwable>() {
@Override
public void accept(Throwable throwable) throws Exception {
if (callback != null) {
callback.onError(mContext.getString(R.string.net_error));
}
}
}).isDisposed();
}
/**
* 直播间取消网络请求
*/