小礼物逻辑第san次上传

This commit is contained in:
18401019693 2023-11-27 10:38:20 +08:00
parent 089b1881f1
commit 8a8a7a8326
4 changed files with 68 additions and 3 deletions

View File

@ -7,6 +7,17 @@ public class QuickGiftSendGiftModel extends BaseModel {
private int quickGiftRemainingQuantity;//剩余的小PD礼物数量 private int quickGiftRemainingQuantity;//剩余的小PD礼物数量
@SerializedName("if_viewing_duration_complete") @SerializedName("if_viewing_duration_complete")
private int ifViewingDurationComplete;//通过观看时间获取小PD礼物的次数 private int ifViewingDurationComplete;//通过观看时间获取小PD礼物的次数
@SerializedName("if_hidden_egg")
private int ifHiddenEgg = 1;//1.未解锁 2.已解锁过奖励 3.当前请求解锁了奖励
public int getIfHiddenEgg() {
return ifHiddenEgg;
}
public QuickGiftSendGiftModel setIfHiddenEgg(int ifHiddenEgg) {
this.ifHiddenEgg = ifHiddenEgg;
return this;
}
public int getQuickGiftRemainingQuantity() { public int getQuickGiftRemainingQuantity() {
return quickGiftRemainingQuantity; return quickGiftRemainingQuantity;

View File

@ -0,0 +1,41 @@
package com.yunbao.live.bean;
import com.google.gson.annotations.SerializedName;
import com.yunbao.common.bean.BaseModel;
public class SendQuickGiftModel extends BaseModel {
@SerializedName("_method_")
private String method;
@SerializedName("user_nicename")
private String userNicename;
@SerializedName("quick_gift_number")
private String quickGiftNumber;
public String getMethod() {
return method;
}
public SendQuickGiftModel setMethod(String method) {
this.method = method;
return this;
}
public String getUserNicename() {
return userNicename;
}
public SendQuickGiftModel setUserNicename(String userNicename) {
this.userNicename = userNicename;
return this;
}
public String getQuickGiftNumber() {
return quickGiftNumber;
}
public SendQuickGiftModel setQuickGiftNumber(String quickGiftNumber) {
this.quickGiftNumber = quickGiftNumber;
return this;
}
}

View File

@ -62,6 +62,7 @@ import com.yunbao.live.bean.LiveGiftPrizePoolWinBean;
import com.yunbao.live.bean.LiveLuckGiftWinBean; import com.yunbao.live.bean.LiveLuckGiftWinBean;
import com.yunbao.live.bean.LivePKUserListBean; import com.yunbao.live.bean.LivePKUserListBean;
import com.yunbao.live.bean.LiveReceiveGiftBean; import com.yunbao.live.bean.LiveReceiveGiftBean;
import com.yunbao.live.bean.SendQuickGiftModel;
import com.yunbao.live.event.LiveAnchorEvent; import com.yunbao.live.event.LiveAnchorEvent;
import com.yunbao.live.event.LiveAudienceEvent; import com.yunbao.live.event.LiveAudienceEvent;
import com.yunbao.live.views.LiveEndViewHolder; import com.yunbao.live.views.LiveEndViewHolder;
@ -762,6 +763,15 @@ public class SocketRyClient {
.setAvatar(WordUtil.isNewZh() ? map.getString("sud_game_name") : map.getString("sud_game_name_en")) .setAvatar(WordUtil.isNewZh() ? map.getString("sud_game_name") : map.getString("sud_game_name_en"))
.setCreateSudRoomModel(GsonUtils.fromJson(map.toString(), SudGameDateModel.class))); .setCreateSudRoomModel(GsonUtils.fromJson(map.toString(), SudGameDateModel.class)));
break; break;
case "sendQuickGift":
SendQuickGiftModel sendQuickGiftModel = GsonUtils.fromJson(map.toString(), SendQuickGiftModel.class);
StringBuffer stringBuffer = new StringBuffer();
stringBuffer.append(sendQuickGiftModel.getUserNicename())
.append(WordUtil.isNewZh()?"送出了":"sent")
.append(sendQuickGiftModel.getQuickGiftNumber())
.append(WordUtil.isNewZh()?"個小PD":"small pandas");
systemChatMessage2(stringBuffer.toString());
break;
} }
} }

View File

@ -341,7 +341,7 @@ public class LiveAudienceViewHolder extends AbsLiveViewHolder {
} else { } else {
quick_gift_remaining_quantity.setVisibility(View.GONE); quick_gift_remaining_quantity.setVisibility(View.GONE);
} }
if (quickGiftRemainingQuantity >= 10 && ifViewingDurationComplete > 0) { if (quickGiftRemainingQuantity < 10 && ifViewingDurationComplete > 0) {
quickGiftHandler.postDelayed(quickGiftRunnable, 1000); quickGiftHandler.postDelayed(quickGiftRunnable, 1000);
} }
} }
@ -370,7 +370,7 @@ public class LiveAudienceViewHolder extends AbsLiveViewHolder {
LiveNetManager.get(mContext).viewingDurationGetGift(mLiveUid, new com.yunbao.common.http.base.HttpCallback<QuickGiftSendGiftModel>() { LiveNetManager.get(mContext).viewingDurationGetGift(mLiveUid, new com.yunbao.common.http.base.HttpCallback<QuickGiftSendGiftModel>() {
@Override @Override
public void onSuccess(QuickGiftSendGiftModel data) { public void onSuccess(QuickGiftSendGiftModel data) {
if (data.getQuickGiftRemainingQuantity() >= 10 && data.getIfViewingDurationComplete() > 0) { if (data.getQuickGiftRemainingQuantity() < 10 && data.getIfViewingDurationComplete() > 0) {
upDataQuickGift(data.getQuickGiftRemainingQuantity(), data.getIfViewingDurationComplete()); upDataQuickGift(data.getQuickGiftRemainingQuantity(), data.getIfViewingDurationComplete());
} }
} }
@ -415,9 +415,12 @@ public class LiveAudienceViewHolder extends AbsLiveViewHolder {
@Override @Override
public void onSuccess(QuickGiftSendGiftModel data) { public void onSuccess(QuickGiftSendGiftModel data) {
upDataQuickGift(data.getQuickGiftRemainingQuantity(), data.getIfViewingDurationComplete()); upDataQuickGift(data.getQuickGiftRemainingQuantity(), data.getIfViewingDurationComplete());
if (mQuickGiftRemainingQuantity >= 10 && mIfViewingDurationComplete > 0) { if (mQuickGiftRemainingQuantity < 10 && mIfViewingDurationComplete > 0) {
quickGiftHandler.postDelayed(quickGiftRunnable, 1000); quickGiftHandler.postDelayed(quickGiftRunnable, 1000);
} }
if (data.getIfHiddenEgg() == 3) {
ToastUtil.show(WordUtil.isNewZh() ? "恭喜您解鎖隱藏彩蛋! 獎勵已發放!" : "Congratulations on unlocking the hidden easter egg! Rewards have been distributed!");
}
} }
@Override @Override