From 8a8a7a83266a5a0b545816475a78d70b2a018ac7 Mon Sep 17 00:00:00 2001 From: 18401019693 Date: Mon, 27 Nov 2023 10:38:20 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B0=8F=E7=A4=BC=E7=89=A9=E9=80=BB=E8=BE=91?= =?UTF-8?q?=E7=AC=ACsan=E6=AC=A1=E4=B8=8A=E4=BC=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../common/bean/QuickGiftSendGiftModel.java | 11 +++++ .../yunbao/live/bean/SendQuickGiftModel.java | 41 +++++++++++++++++++ .../yunbao/live/socket/SocketRyClient.java | 10 +++++ .../live/views/LiveAudienceViewHolder.java | 9 ++-- 4 files changed, 68 insertions(+), 3 deletions(-) create mode 100644 live/src/main/java/com/yunbao/live/bean/SendQuickGiftModel.java diff --git a/common/src/main/java/com/yunbao/common/bean/QuickGiftSendGiftModel.java b/common/src/main/java/com/yunbao/common/bean/QuickGiftSendGiftModel.java index 16bb5fab3..493c83b2a 100644 --- a/common/src/main/java/com/yunbao/common/bean/QuickGiftSendGiftModel.java +++ b/common/src/main/java/com/yunbao/common/bean/QuickGiftSendGiftModel.java @@ -7,6 +7,17 @@ public class QuickGiftSendGiftModel extends BaseModel { private int quickGiftRemainingQuantity;//剩余的小PD礼物数量 @SerializedName("if_viewing_duration_complete") 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() { return quickGiftRemainingQuantity; diff --git a/live/src/main/java/com/yunbao/live/bean/SendQuickGiftModel.java b/live/src/main/java/com/yunbao/live/bean/SendQuickGiftModel.java new file mode 100644 index 000000000..2317872e0 --- /dev/null +++ b/live/src/main/java/com/yunbao/live/bean/SendQuickGiftModel.java @@ -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; + } +} diff --git a/live/src/main/java/com/yunbao/live/socket/SocketRyClient.java b/live/src/main/java/com/yunbao/live/socket/SocketRyClient.java index b3a5087cc..385713a19 100644 --- a/live/src/main/java/com/yunbao/live/socket/SocketRyClient.java +++ b/live/src/main/java/com/yunbao/live/socket/SocketRyClient.java @@ -62,6 +62,7 @@ import com.yunbao.live.bean.LiveGiftPrizePoolWinBean; import com.yunbao.live.bean.LiveLuckGiftWinBean; import com.yunbao.live.bean.LivePKUserListBean; import com.yunbao.live.bean.LiveReceiveGiftBean; +import com.yunbao.live.bean.SendQuickGiftModel; import com.yunbao.live.event.LiveAnchorEvent; import com.yunbao.live.event.LiveAudienceEvent; 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")) .setCreateSudRoomModel(GsonUtils.fromJson(map.toString(), SudGameDateModel.class))); 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; } } diff --git a/live/src/main/java/com/yunbao/live/views/LiveAudienceViewHolder.java b/live/src/main/java/com/yunbao/live/views/LiveAudienceViewHolder.java index 16d61a803..0ea9779d3 100644 --- a/live/src/main/java/com/yunbao/live/views/LiveAudienceViewHolder.java +++ b/live/src/main/java/com/yunbao/live/views/LiveAudienceViewHolder.java @@ -341,7 +341,7 @@ public class LiveAudienceViewHolder extends AbsLiveViewHolder { } else { quick_gift_remaining_quantity.setVisibility(View.GONE); } - if (quickGiftRemainingQuantity >= 10 && ifViewingDurationComplete > 0) { + if (quickGiftRemainingQuantity < 10 && ifViewingDurationComplete > 0) { 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() { @Override public void onSuccess(QuickGiftSendGiftModel data) { - if (data.getQuickGiftRemainingQuantity() >= 10 && data.getIfViewingDurationComplete() > 0) { + if (data.getQuickGiftRemainingQuantity() < 10 && data.getIfViewingDurationComplete() > 0) { upDataQuickGift(data.getQuickGiftRemainingQuantity(), data.getIfViewingDurationComplete()); } } @@ -415,9 +415,12 @@ public class LiveAudienceViewHolder extends AbsLiveViewHolder { @Override public void onSuccess(QuickGiftSendGiftModel data) { upDataQuickGift(data.getQuickGiftRemainingQuantity(), data.getIfViewingDurationComplete()); - if (mQuickGiftRemainingQuantity >= 10 && mIfViewingDurationComplete > 0) { + if (mQuickGiftRemainingQuantity < 10 && mIfViewingDurationComplete > 0) { quickGiftHandler.postDelayed(quickGiftRunnable, 1000); } + if (data.getIfHiddenEgg() == 3) { + ToastUtil.show(WordUtil.isNewZh() ? "恭喜您解鎖隱藏彩蛋! 獎勵已發放!" : "Congratulations on unlocking the hidden easter egg! Rewards have been distributed!"); + } } @Override