From 994bd2a3aa1001e73d4f16ccf3048b9c079c0707 Mon Sep 17 00:00:00 2001 From: 18401019693 Date: Tue, 8 Aug 2023 09:34:15 +0800 Subject: [PATCH] =?UTF-8?q?6.5.4=E7=A4=BC=E7=89=A9=E5=86=A0=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/yunbao/common/http/PDLiveApi.java | 9 +++ .../common/http/live/LiveNetManager.java | 26 +++++++- .../live/views/GiftAlreadyWallFragment.java | 61 +++++++++++++------ 3 files changed, 76 insertions(+), 20 deletions(-) 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 8779c4866..a32b22392 100644 --- a/common/src/main/java/com/yunbao/common/http/PDLiveApi.java +++ b/common/src/main/java/com/yunbao/common/http/PDLiveApi.java @@ -863,6 +863,15 @@ public interface PDLiveApi { @Query("to_uid") String toUid ); + /** + * 礼物墙已点亮 + */ + @GET("/api/public/?service=Gift.giftUserSendWall") + Observable> giftUserSendWall( + @Query("liveuid") String liveUid, + @Query("to_uid") String toUid + ); + /** * 礼物墙未点亮 */ 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 aeeb32a15..b628a359e 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 @@ -1874,6 +1874,28 @@ public class LiveNetManager { }).isDisposed(); } + public void giftUserSendWall(String liveUid, String toUid, HttpCallback callback) { + API.get().pdLiveApi(mContext) + .giftUserSendWall(liveUid, toUid) + .subscribeOn(Schedulers.io()) + .observeOn(AndroidSchedulers.mainThread()) + .subscribe(new Consumer>() { + @Override + public void accept(ResponseModel giftAlreadyWallModelResponseModel) throws Exception { + if (callback != null) { + callback.onSuccess(giftAlreadyWallModelResponseModel.getData().getInfo()); + } + } + }, new Consumer() { + @Override + public void accept(Throwable throwable) throws Exception { + if (callback != null) { + callback.onError(mContext.getString(R.string.net_error)); + } + } + }).isDisposed(); + } + public void giftWithoutWall(String liveUid, String toUid, HttpCallback callback) { API.get().pdLiveApi(mContext) .giftWithoutWall(liveUid, toUid) @@ -2072,9 +2094,9 @@ public class LiveNetManager { }).isDisposed(); } - public void buyFansExclusivePack(String liveUid, String packId,String stream, HttpCallback callback) { + public void buyFansExclusivePack(String liveUid, String packId, String stream, HttpCallback callback) { API.get().pdLiveApi(mContext) - .buyFansExclusivePack(liveUid, packId,stream) + .buyFansExclusivePack(liveUid, packId, stream) .subscribeOn(Schedulers.io()) .observeOn(AndroidSchedulers.mainThread()) .subscribe(new Consumer>() { diff --git a/live/src/main/java/com/yunbao/live/views/GiftAlreadyWallFragment.java b/live/src/main/java/com/yunbao/live/views/GiftAlreadyWallFragment.java index 542558451..0eb6d30d1 100644 --- a/live/src/main/java/com/yunbao/live/views/GiftAlreadyWallFragment.java +++ b/live/src/main/java/com/yunbao/live/views/GiftAlreadyWallFragment.java @@ -82,27 +82,52 @@ public class GiftAlreadyWallFragment extends BaseFragment { @Override protected void loadData() { - LiveNetManager.get(getActivity()). - giftAlreadyWall(mLiveUid, toUid, new HttpCallback() { - @Override - public void onSuccess(GiftAlreadyWallModel data) { - if (data.getGiftWall().size() > 0) { - giftWallNoData.setVisibility(View.GONE); - giftWallData.setVisibility(View.VISIBLE); - alreadyWallAdapter.addAllData(data.getGiftWall()); - litIcon.setText(data.getGiftWallLightenNumber()); - giftAll.setText("/" + data.getGiftWallLightenTotal()); - } else { - giftWallNoData.setVisibility(View.VISIBLE); - giftWallData.setVisibility(View.GONE); + if (isAnchor){ + LiveNetManager.get(getActivity()). + giftAlreadyWall(mLiveUid, toUid, new HttpCallback() { + @Override + public void onSuccess(GiftAlreadyWallModel data) { + if (data.getGiftWall().size() > 0) { + giftWallNoData.setVisibility(View.GONE); + giftWallData.setVisibility(View.VISIBLE); + alreadyWallAdapter.addAllData(data.getGiftWall()); + litIcon.setText(data.getGiftWallLightenNumber()); + giftAll.setText("/" + data.getGiftWallLightenTotal()); + } else { + giftWallNoData.setVisibility(View.VISIBLE); + giftWallData.setVisibility(View.GONE); + } } - } - @Override - public void onError(String error) { + @Override + public void onError(String error) { + + } + }); + }else { + LiveNetManager.get(getActivity()). + giftUserSendWall(mLiveUid, toUid, new HttpCallback() { + @Override + public void onSuccess(GiftAlreadyWallModel data) { + if (data.getGiftWall().size() > 0) { + giftWallNoData.setVisibility(View.GONE); + giftWallData.setVisibility(View.VISIBLE); + alreadyWallAdapter.addAllData(data.getGiftWall()); + litIcon.setText(data.getGiftWallLightenNumber()); + giftAll.setText("/" + data.getGiftWallLightenTotal()); + } else { + giftWallNoData.setVisibility(View.VISIBLE); + giftWallData.setVisibility(View.GONE); + } + } + + @Override + public void onError(String error) { + + } + }); + } - } - }); } public static GiftAlreadyWallFragment newInstance(String mStream, String mLiveUid, String toUid, boolean isAnchor) {