创建接口,红包展示接口
This commit is contained in:
@@ -179,10 +179,11 @@ public class Constants {
|
||||
public static final String CUSTOM_FULL_SERVICE_NOTIFY = "customFullServiceNotify";//全服通知
|
||||
public static final String XYD_COMPLETE = "XydComplete";//心愿单完成通知
|
||||
public static final String WISH_LIST_PROGRESS = "wishListProgress";//心愿单进度通知
|
||||
public static final String LIVE_VOTE_CREATE="createVote";
|
||||
public static final String LIVE_VOTE_UPDATE="updateVote";
|
||||
public static final String LIVE_VOTE_END="endVote";
|
||||
public static final String LIVE_PK_END="endPK";//结束PK,以这个PK获取到的参数为准
|
||||
public static final String LIVE_VOTE_CREATE = "createVote";
|
||||
public static final String LIVE_VOTE_UPDATE = "updateVote";
|
||||
public static final String LIVE_VOTE_END = "endVote";
|
||||
public static final String LIVE_PK_END = "endPK";//结束PK,以这个PK获取到的参数为准
|
||||
public static final String RED_PACKET = "RedPacket";//红包通知
|
||||
|
||||
//游戏socket
|
||||
public static final String SOCKET_GAME_ZJH = "startGame";//炸金花
|
||||
|
||||
@@ -103,9 +103,20 @@ public class EnterRoomInfoModel extends BaseModel {
|
||||
@SerializedName("anchor_goodnum")
|
||||
private String anchorGoodnum;
|
||||
@SerializedName("jackpot_level")
|
||||
private String jackpotLevel="-1";
|
||||
private String jackpotLevel = "-1";
|
||||
@SerializedName("live_vote")
|
||||
private LiveRoomVoteModel voteModel;
|
||||
@SerializedName("red_packet")
|
||||
private RedPacketModel redPacketModel;
|
||||
|
||||
public RedPacketModel getRedPacketModel() {
|
||||
return redPacketModel;
|
||||
}
|
||||
|
||||
public EnterRoomInfoModel setRedPacketModel(RedPacketModel redPacketModel) {
|
||||
this.redPacketModel = redPacketModel;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getJackpotLevel() {
|
||||
|
||||
@@ -486,8 +497,8 @@ public class EnterRoomInfoModel extends BaseModel {
|
||||
}
|
||||
|
||||
public String getIsconnection() {
|
||||
if(StringUtil.isEmpty(isconnection)){
|
||||
isconnection="0";
|
||||
if (StringUtil.isEmpty(isconnection)) {
|
||||
isconnection = "0";
|
||||
}
|
||||
return isconnection;
|
||||
}
|
||||
@@ -498,8 +509,8 @@ public class EnterRoomInfoModel extends BaseModel {
|
||||
}
|
||||
|
||||
public String getIsleave() {
|
||||
if(StringUtil.isEmpty(isleave)){
|
||||
isleave="0";
|
||||
if (StringUtil.isEmpty(isleave)) {
|
||||
isleave = "0";
|
||||
}
|
||||
return isleave;
|
||||
}
|
||||
|
||||
@@ -357,4 +357,8 @@ public class MsgModel extends BaseModel {
|
||||
public void setSystem_bubble(String system_bubble) {
|
||||
this.system_bubble = system_bubble;
|
||||
}
|
||||
|
||||
/**
|
||||
* 红包
|
||||
*/
|
||||
}
|
||||
|
||||
@@ -0,0 +1,72 @@
|
||||
package com.yunbao.common.bean;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
/**
|
||||
* 红包随机礼物
|
||||
*/
|
||||
public class RedPacketGiftModel extends BaseModel {
|
||||
/**
|
||||
* {
|
||||
* "id": 210,
|
||||
* "giftname": "玫瑰",
|
||||
* "needcoin": 20,
|
||||
* "gifticon": "https://downs.yaoulive.com/603f25d9aa969.png"
|
||||
* }
|
||||
*/
|
||||
@SerializedName("id")
|
||||
private String id;
|
||||
@SerializedName("giftname")
|
||||
private String giftname;
|
||||
@SerializedName("needcoin")
|
||||
private String needcoin;
|
||||
@SerializedName("gifticon")
|
||||
private String gifticon;
|
||||
@SerializedName("gift_num")
|
||||
private String giftNum;
|
||||
|
||||
public String getGiftNum() {
|
||||
return "X" +giftNum;
|
||||
}
|
||||
|
||||
public RedPacketGiftModel setGiftNum(String giftNum) {
|
||||
this.giftNum = giftNum;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public RedPacketGiftModel setId(String id) {
|
||||
this.id = id;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getGiftname() {
|
||||
return giftname;
|
||||
}
|
||||
|
||||
public RedPacketGiftModel setGiftname(String giftname) {
|
||||
this.giftname = giftname;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getNeedcoin() {
|
||||
return "X" + needcoin;
|
||||
}
|
||||
|
||||
public RedPacketGiftModel setNeedcoin(String needcoin) {
|
||||
this.needcoin = needcoin;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getGifticon() {
|
||||
return gifticon;
|
||||
}
|
||||
|
||||
public RedPacketGiftModel setGifticon(String gifticon) {
|
||||
this.gifticon = gifticon;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,212 @@
|
||||
package com.yunbao.common.bean;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 红包信息
|
||||
*/
|
||||
public class RedPacketInfoModel extends BaseModel {
|
||||
|
||||
@SerializedName("liveuid")
|
||||
private String liveuid;
|
||||
@SerializedName("uid")
|
||||
private String uid;
|
||||
@SerializedName("amount_diamond")
|
||||
private String amountDiamond;
|
||||
@SerializedName("red_packet_money")
|
||||
private String redPacketMoney;
|
||||
@SerializedName("red_packet_quantity")
|
||||
private String redPacketQuantity;
|
||||
@SerializedName("conditions")
|
||||
private String conditions;
|
||||
@SerializedName("create_time")
|
||||
private String createTime;
|
||||
@SerializedName("start_time")
|
||||
private String startTime;
|
||||
@SerializedName("end_time")
|
||||
private String endTime;
|
||||
@SerializedName("user_id")
|
||||
private String userId;
|
||||
@SerializedName("user_nicename")
|
||||
private String userNicename;
|
||||
@SerializedName("avatar")
|
||||
private String avatar;
|
||||
@SerializedName("avatar_thumb")
|
||||
private String avatarThumb;
|
||||
@SerializedName("id")
|
||||
private String id;
|
||||
@SerializedName("user_exists")
|
||||
private String userExists;
|
||||
@SerializedName("is_attention")
|
||||
private String isAttention;
|
||||
|
||||
public String getIsAttention() {
|
||||
return isAttention;
|
||||
}
|
||||
|
||||
public RedPacketInfoModel setIsAttention(String isAttention) {
|
||||
this.isAttention = isAttention;
|
||||
return this;
|
||||
}
|
||||
|
||||
@SerializedName("user_golden_bean")
|
||||
private String userGoldenBean;
|
||||
|
||||
@SerializedName("red_packet_gift")
|
||||
private List<RedPacketGiftModel> packetGiftModels;
|
||||
|
||||
public List<RedPacketGiftModel> getPacketGiftModels() {
|
||||
return packetGiftModels;
|
||||
}
|
||||
|
||||
public RedPacketInfoModel setPacketGiftModels(List<RedPacketGiftModel> packetGiftModels) {
|
||||
this.packetGiftModels = packetGiftModels;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getLiveuid() {
|
||||
return liveuid;
|
||||
}
|
||||
|
||||
public RedPacketInfoModel setLiveuid(String liveuid) {
|
||||
this.liveuid = liveuid;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getUid() {
|
||||
return uid;
|
||||
}
|
||||
|
||||
public RedPacketInfoModel setUid(String uid) {
|
||||
this.uid = uid;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getAmountDiamond() {
|
||||
return amountDiamond;
|
||||
}
|
||||
|
||||
public RedPacketInfoModel setAmountDiamond(String amountDiamond) {
|
||||
this.amountDiamond = amountDiamond;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getRedPacketMoney() {
|
||||
return redPacketMoney;
|
||||
}
|
||||
|
||||
public RedPacketInfoModel setRedPacketMoney(String redPacketMoney) {
|
||||
this.redPacketMoney = redPacketMoney;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getRedPacketQuantity() {
|
||||
return redPacketQuantity;
|
||||
}
|
||||
|
||||
public RedPacketInfoModel setRedPacketQuantity(String redPacketQuantity) {
|
||||
this.redPacketQuantity = redPacketQuantity;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getConditions() {
|
||||
return conditions;
|
||||
}
|
||||
|
||||
public RedPacketInfoModel setConditions(String conditions) {
|
||||
this.conditions = conditions;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getCreateTime() {
|
||||
return createTime;
|
||||
}
|
||||
|
||||
public RedPacketInfoModel setCreateTime(String createTime) {
|
||||
this.createTime = createTime;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getStartTime() {
|
||||
return startTime;
|
||||
}
|
||||
|
||||
public RedPacketInfoModel setStartTime(String startTime) {
|
||||
this.startTime = startTime;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getEndTime() {
|
||||
return endTime;
|
||||
}
|
||||
|
||||
public RedPacketInfoModel setEndTime(String endTime) {
|
||||
this.endTime = endTime;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getUserId() {
|
||||
return userId;
|
||||
}
|
||||
|
||||
public RedPacketInfoModel setUserId(String userId) {
|
||||
this.userId = userId;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getUserNicename() {
|
||||
return userNicename;
|
||||
}
|
||||
|
||||
public RedPacketInfoModel setUserNicename(String userNicename) {
|
||||
this.userNicename = userNicename;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getAvatar() {
|
||||
return avatar;
|
||||
}
|
||||
|
||||
public RedPacketInfoModel setAvatar(String avatar) {
|
||||
this.avatar = avatar;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getAvatarThumb() {
|
||||
return avatarThumb;
|
||||
}
|
||||
|
||||
public RedPacketInfoModel setAvatarThumb(String avatarThumb) {
|
||||
this.avatarThumb = avatarThumb;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public RedPacketInfoModel setId(String id) {
|
||||
this.id = id;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getUserExists() {
|
||||
return userExists;
|
||||
}
|
||||
|
||||
public RedPacketInfoModel setUserExists(String userExists) {
|
||||
this.userExists = userExists;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getUserGoldenBean() {
|
||||
return userGoldenBean;
|
||||
}
|
||||
|
||||
public RedPacketInfoModel setUserGoldenBean(String userGoldenBean) {
|
||||
this.userGoldenBean = userGoldenBean;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,90 @@
|
||||
package com.yunbao.common.bean;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
public class RedPacketModel extends BaseModel {
|
||||
//是否展示
|
||||
@SerializedName("is_show")
|
||||
private int isShow;
|
||||
//正在进行的红包数量
|
||||
@SerializedName("red_packet_count")
|
||||
private int redPacketCount;
|
||||
//正在进行的红包总数量
|
||||
@SerializedName("red_packet_quantity")
|
||||
private int redPacketQuantity;
|
||||
//当前红包剩余数量
|
||||
@SerializedName("red_packet_remain")
|
||||
private int redPacketRemain;
|
||||
//红包倒计时
|
||||
@SerializedName("countdown")
|
||||
private int countdown;
|
||||
//红包id
|
||||
@SerializedName("red_packet_id")
|
||||
private String redPacketId;
|
||||
//红包领取条件
|
||||
@SerializedName("conditions")
|
||||
private int conditions;
|
||||
|
||||
public int getIsShow() {
|
||||
return isShow;
|
||||
}
|
||||
|
||||
public RedPacketModel setIsShow(int isShow) {
|
||||
this.isShow = isShow;
|
||||
return this;
|
||||
}
|
||||
|
||||
public int getRedPacketCount() {
|
||||
return redPacketCount;
|
||||
}
|
||||
|
||||
public RedPacketModel setRedPacketCount(int redPacketCount) {
|
||||
this.redPacketCount = redPacketCount;
|
||||
return this;
|
||||
}
|
||||
|
||||
public int getRedPacketQuantity() {
|
||||
return redPacketQuantity;
|
||||
}
|
||||
|
||||
public RedPacketModel setRedPacketQuantity(int redPacketQuantity) {
|
||||
this.redPacketQuantity = redPacketQuantity;
|
||||
return this;
|
||||
}
|
||||
|
||||
public int getRedPacketRemain() {
|
||||
return redPacketRemain;
|
||||
}
|
||||
|
||||
public RedPacketModel setRedPacketRemain(int redPacketRemain) {
|
||||
this.redPacketRemain = redPacketRemain;
|
||||
return this;
|
||||
}
|
||||
|
||||
public int getCountdown() {
|
||||
return countdown;
|
||||
}
|
||||
|
||||
public RedPacketModel setCountdown(int countdown) {
|
||||
this.countdown = countdown;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getRedPacketId() {
|
||||
return redPacketId;
|
||||
}
|
||||
|
||||
public RedPacketModel setRedPacketId(String redPacketId) {
|
||||
this.redPacketId = redPacketId;
|
||||
return this;
|
||||
}
|
||||
|
||||
public int getConditions() {
|
||||
return conditions;
|
||||
}
|
||||
|
||||
public RedPacketModel setConditions(int conditions) {
|
||||
this.conditions = conditions;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@@ -35,6 +35,7 @@ import com.yunbao.common.bean.PrankGiftBean;
|
||||
import com.yunbao.common.bean.PrankHttpTurntableBean;
|
||||
import com.yunbao.common.bean.RandomPkUserBean;
|
||||
import com.yunbao.common.bean.RankPkInfoBean;
|
||||
import com.yunbao.common.bean.RedPacketInfoModel;
|
||||
import com.yunbao.common.bean.SearchModel;
|
||||
import com.yunbao.common.bean.SetAttentsModel;
|
||||
import com.yunbao.common.bean.SlideInBannerModel;
|
||||
@@ -730,4 +731,24 @@ public interface PDLiveApi {
|
||||
*/
|
||||
@GET("/api/public/?service=Live.getBlindBoxInfo")
|
||||
Observable<ResponseModel<List<BlindBoxInfoModel>>> getBlindBoxInfo();
|
||||
|
||||
/**
|
||||
* 获取盲盒礼物当前数据
|
||||
*/
|
||||
@GET("/api/public/?service=Live.createRedPacket")
|
||||
Observable<ResponseModel<Object>> createRedPacket(
|
||||
@Query("liveuid") String liveUid,
|
||||
@Query("red_packet_money") String redPacketMoney,
|
||||
@Query("red_packet_quantity") String redPacketQuantity,
|
||||
@Query("conditions") String conditions
|
||||
);
|
||||
|
||||
/**
|
||||
* 获取盲盒礼物当前数据
|
||||
*/
|
||||
@GET("/api/public/?service=Live.redPacketInfo")
|
||||
Observable<ResponseModel<RedPacketInfoModel>> redPacketInfo(
|
||||
@Query("liveuid") String liveUid,
|
||||
@Query("red_packet_id") String redPacketId
|
||||
);
|
||||
}
|
||||
|
||||
@@ -34,6 +34,7 @@ import com.yunbao.common.bean.PrankGiftBean;
|
||||
import com.yunbao.common.bean.PrankHttpTurntableBean;
|
||||
import com.yunbao.common.bean.RandomPkUserBean;
|
||||
import com.yunbao.common.bean.RankPkInfoBean;
|
||||
import com.yunbao.common.bean.RedPacketInfoModel;
|
||||
import com.yunbao.common.bean.SetAttentsModel;
|
||||
import com.yunbao.common.bean.StarChallengeStatusModel;
|
||||
import com.yunbao.common.bean.UserAreaBean;
|
||||
@@ -1550,6 +1551,58 @@ public class LiveNetManager {
|
||||
}).isDisposed();
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建红包
|
||||
*
|
||||
* @param liveUid 直播间id
|
||||
* @param redPacketMoney 红包金额
|
||||
* @param redPacketQuantity 红包数量
|
||||
* @param conditions 红包领取条件 0.无 1.关注主播
|
||||
*/
|
||||
public void createRedPacket(String liveUid, String redPacketMoney, String redPacketQuantity, String conditions, HttpCallback<String> callback) {
|
||||
API.get().pdLiveApi(mContext)
|
||||
.createRedPacket(liveUid, redPacketMoney, redPacketQuantity, conditions)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new Consumer<ResponseModel<Object>>() {
|
||||
@Override
|
||||
public void accept(ResponseModel<Object> objectResponseModel) throws Exception {
|
||||
if (callback != null) {
|
||||
callback.onSuccess(objectResponseModel.getData().getMsg());
|
||||
}
|
||||
}
|
||||
}, new Consumer<Throwable>() {
|
||||
@Override
|
||||
public void accept(Throwable throwable) throws Exception {
|
||||
if (callback != null) {
|
||||
callback.onError(mContext.getString(R.string.net_error));
|
||||
}
|
||||
}
|
||||
}).isDisposed();
|
||||
}
|
||||
|
||||
/**
|
||||
* 红包信息
|
||||
*
|
||||
* @param liveUid 直播间id
|
||||
* @param redPacketId 红包id
|
||||
*/
|
||||
public void redPacketInfo(String liveUid, String redPacketId, HttpCallback<RedPacketInfoModel> callback) {
|
||||
API.get().pdLiveApi(mContext)
|
||||
.redPacketInfo(liveUid, redPacketId)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(redPacketInfoModelResponseModel -> {
|
||||
if (callback != null) {
|
||||
callback.onSuccess(redPacketInfoModelResponseModel.getData().getInfo());
|
||||
}
|
||||
}, throwable -> {
|
||||
if (callback != null) {
|
||||
callback.onError(mContext.getString(R.string.net_error));
|
||||
}
|
||||
}).isDisposed();
|
||||
}
|
||||
|
||||
/**
|
||||
* 直播间取消网络请求
|
||||
*/
|
||||
|
||||
@@ -6,6 +6,7 @@ package com.yunbao.common.utils;
|
||||
public class TimeUtils {
|
||||
/**
|
||||
* 毫秒转秒
|
||||
*
|
||||
* @param duration 毫秒数
|
||||
* @return
|
||||
*/
|
||||
@@ -17,4 +18,53 @@ public class TimeUtils {
|
||||
toSecond = ((minute * 60) + second);
|
||||
return toSecond;
|
||||
}
|
||||
|
||||
//根据秒数转化为时分秒 00:00:00
|
||||
public static String getTime(int second) {
|
||||
if (second < 10) {
|
||||
return "" + second;
|
||||
}
|
||||
if (second < 60) {
|
||||
return "" + second;
|
||||
}
|
||||
if (second < 3600) {
|
||||
int minute = second / 60;
|
||||
second = second - minute * 60;
|
||||
if (minute < 10) {
|
||||
if (second < 10) {
|
||||
return "0" + minute + ":0" + second;
|
||||
}
|
||||
return "0" + minute + ":" + second;
|
||||
}
|
||||
if (second < 10) {
|
||||
return minute + ":0" + second;
|
||||
}
|
||||
return minute + ":" + second;
|
||||
}
|
||||
int hour = second / 3600;
|
||||
int minute = (second - hour * 3600) / 60;
|
||||
second = second - hour * 3600 - minute * 60;
|
||||
if (hour < 10) {
|
||||
if (minute < 10) {
|
||||
if (second < 10) {
|
||||
return "0" + hour + ":0" + minute + ":0" + second;
|
||||
}
|
||||
return "0" + hour + ":0" + minute + ":" + second;
|
||||
}
|
||||
if (second < 10) {
|
||||
return "0" + hour + minute + ":0" + second;
|
||||
}
|
||||
return "0" + hour + minute + ":" + second;
|
||||
}
|
||||
if (minute < 10) {
|
||||
if (second < 10) {
|
||||
return hour + ":0" + minute + ":0" + second;
|
||||
}
|
||||
return hour + ":0" + minute + ":" + second;
|
||||
}
|
||||
if (second < 10) {
|
||||
return hour + minute + ":0" + second;
|
||||
}
|
||||
return hour + minute + ":" + second;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1223,4 +1223,7 @@ Limited ride And limited avatar frame</string>
|
||||
<string name="cred_envelope_obtained">獲得%s</string>
|
||||
<string name="view_lucky_viewers">查看幸運觀衆></string>
|
||||
<string name="anchor_his_heart">贈送主播禮物表達心意</string>
|
||||
<string name="red_packet_countdown">倒計時:%s</string>
|
||||
<string name="open_red_packet">待開紅包:%s</string>
|
||||
<string name="together_to_achieve_goal">來自%s的獎勵,齊心協力連成目標</string>
|
||||
</resources>
|
||||
|
||||
Reference in New Issue
Block a user