From 7281296d8e7fd7308274a47140f0fecaf68381db Mon Sep 17 00:00:00 2001 From: 18401019693 Date: Mon, 5 Sep 2022 15:57:43 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B6=88=E6=81=AF=E4=B8=AD=E5=BF=83=E9=81=AE?= =?UTF-8?q?=E7=BD=A9=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/yunbao/common/bean/VipModel.java | 12 +++++++++ .../com/yunbao/common/http/PDLiveApi.java | 7 +++++ .../common/http/live/LiveNetManager.java | 17 ++++++++++++ .../yunbao/main/activity/MainActivity.java | 2 ++ .../PDLiveConversationListActivity.java | 19 +++++--------- .../com/yunbao/main/http/MainHttpUtil.java | 2 +- .../ConversationIMListManager.java | 26 ++++++++++++++++++- 7 files changed, 71 insertions(+), 14 deletions(-) diff --git a/common/src/main/java/com/yunbao/common/bean/VipModel.java b/common/src/main/java/com/yunbao/common/bean/VipModel.java index 535c7dd08..21fe92757 100644 --- a/common/src/main/java/com/yunbao/common/bean/VipModel.java +++ b/common/src/main/java/com/yunbao/common/bean/VipModel.java @@ -10,6 +10,9 @@ public class VipModel extends BaseModel { @SerializedName("type") private String type = ""; + @SerializedName("admin_id") + private String adminId; + public String getType() { return type; } @@ -18,4 +21,13 @@ public class VipModel extends BaseModel { this.type = type; return this; } + + public String getAdminId() { + return adminId; + } + + public VipModel setAdminId(String adminId) { + this.adminId = adminId; + return this; + } } 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 1aca32221..65307f2ff 100644 --- a/common/src/main/java/com/yunbao/common/http/PDLiveApi.java +++ b/common/src/main/java/com/yunbao/common/http/PDLiveApi.java @@ -14,6 +14,7 @@ import com.yunbao.common.bean.NobleTrumpetModel; import com.yunbao.common.bean.SearchModel; import com.yunbao.common.bean.SetAttentsModel; import com.yunbao.common.bean.SlideInBannerModel; +import com.yunbao.common.bean.VipModel; import java.util.List; @@ -218,4 +219,10 @@ public interface PDLiveApi { */ @GET("/api/public/?service=Message.setMessageReadAll") Observable>> setMessageReadAll(); + + /** + * 获取当前用户指导员ID + */ + @GET("/api/public/?service=User.getUserInstructor") + Observable>> getUserInstructor(); } 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 f1cdf7b41..9273db11c 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 @@ -7,6 +7,7 @@ import com.yunbao.common.bean.BaseModel; import com.yunbao.common.bean.LiveInfoModel; import com.yunbao.common.bean.NobleTrumpetModel; import com.yunbao.common.bean.SetAttentsModel; +import com.yunbao.common.bean.VipModel; import com.yunbao.common.http.API; import com.yunbao.common.http.base.HttpCallback; @@ -172,4 +173,20 @@ public class LiveNetManager { } }).isDisposed(); } + + /** + * 获取当前用户指导员ID + */ + public void getUserInstructor(HttpCallback> callback) { + API.get().pdLiveApi(mContext).getUserInstructor() + .subscribeOn(Schedulers.io()) + .observeOn(AndroidSchedulers.mainThread()) + .subscribe(listResponseModel -> { + if (callback != null) + callback.onSuccess(listResponseModel.getData().getInfo()); + }, throwable -> { + if (callback != null) + callback.onError(throwable.getMessage()); + }).isDisposed(); + } } diff --git a/main/src/main/java/com/yunbao/main/activity/MainActivity.java b/main/src/main/java/com/yunbao/main/activity/MainActivity.java index 810de03b9..d46603ece 100644 --- a/main/src/main/java/com/yunbao/main/activity/MainActivity.java +++ b/main/src/main/java/com/yunbao/main/activity/MainActivity.java @@ -577,6 +577,8 @@ public class MainActivity extends AbsActivity implements MainAppBarLayoutListene isfloatBannernet = false; } }); + //获取指导员账号 + ConversationIMListManager.get(this).getUserInstructor(this); } /** diff --git a/main/src/main/java/com/yunbao/main/activity/PDLiveConversationListActivity.java b/main/src/main/java/com/yunbao/main/activity/PDLiveConversationListActivity.java index df9114f91..33d415a82 100644 --- a/main/src/main/java/com/yunbao/main/activity/PDLiveConversationListActivity.java +++ b/main/src/main/java/com/yunbao/main/activity/PDLiveConversationListActivity.java @@ -145,18 +145,14 @@ public class PDLiveConversationListActivity extends AbsActivity implements View. } }, null); //点击事件 - politicalInstructor.setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View v) { - ViewClicksAntiShake.clicksAntiShake(v, () -> { - String targetId = ConversationIMListManager.get(mContext).getTargetId(); - if (!TextUtils.isEmpty(targetId)) { - ConversationIMListManager.get(mContext).jumpConversation(mContext, targetId); - guide.dismiss(); - } - }); + ViewClicksAntiShake.clicksAntiShake(politicalInstructor, () -> { + String targetId = ConversationIMListManager.get(mContext).getTargetId(); + if (!TextUtils.isEmpty(targetId)) { + ConversationIMListManager.get(mContext).jumpConversation(mContext, targetId); + guide.dismiss(); } }); + } /** @@ -212,7 +208,6 @@ public class PDLiveConversationListActivity extends AbsActivity implements View. * 初始化数据 */ private void initData() { - ConversationIMListManager.get(mContext).getConversationListByPage(false); IMLoginManager.get(mContext).checkInstructor(); mProcessResultUtil = new ProcessResultUtil(this); netHandler.post(imUserInfoRunnable); @@ -413,7 +408,7 @@ public class PDLiveConversationListActivity extends AbsActivity implements View. DialogUitl.showSimpleDialog(mContext, null, getString(R.string.clear_unread_messages), false, new DialogUitl.SimpleCallback3() { @Override public void onConfirmClick(Dialog dialog) { - ConversationIMListManager.get(mContext).getConversationListByPage(true); +// ConversationIMListManager.get(mContext).getConversationListByPage(true); LiveNetManager.get(mContext) .setMessageReadAll(new com.yunbao.common.http.base.HttpCallback() { @Override diff --git a/main/src/main/java/com/yunbao/main/http/MainHttpUtil.java b/main/src/main/java/com/yunbao/main/http/MainHttpUtil.java index 427d2f77d..b0610618c 100644 --- a/main/src/main/java/com/yunbao/main/http/MainHttpUtil.java +++ b/main/src/main/java/com/yunbao/main/http/MainHttpUtil.java @@ -690,7 +690,7 @@ public class MainHttpUtil { } // public static void setMessageReadAll(){ - HttpClient.getInstance().get("Message.setMessageReadAll","") + HttpClient.getInstance().get("User.getUserInstructor","") .execute(new HttpCallback() { @Override public void onSuccess(int code, String msg, String[] info) { diff --git a/main/src/main/java/com/yunbao/main/manager/imrongcloud/ConversationIMListManager.java b/main/src/main/java/com/yunbao/main/manager/imrongcloud/ConversationIMListManager.java index 454768faa..9bba5a866 100644 --- a/main/src/main/java/com/yunbao/main/manager/imrongcloud/ConversationIMListManager.java +++ b/main/src/main/java/com/yunbao/main/manager/imrongcloud/ConversationIMListManager.java @@ -13,8 +13,10 @@ import com.alibaba.fastjson.JSONObject; import com.blankj.utilcode.util.GsonUtils; import com.google.gson.Gson; import com.yunbao.common.bean.IMLoginModel; +import com.yunbao.common.bean.VipModel; import com.yunbao.common.http.CommonHttpUtil; import com.yunbao.common.http.HttpCallback; +import com.yunbao.common.http.live.LiveNetManager; import com.yunbao.common.manager.InstructorRemarkManager; import com.yunbao.common.utils.RouteUtil; import com.yunbao.live.activity.PDLIiveChatActivity; @@ -280,8 +282,30 @@ public class ConversationIMListManager { private long timeStamp = 0; /** - * 获取新手指导员账号 + * 获取当前指导员ID */ + + public void getUserInstructor(Activity context) { + LiveNetManager.get(context) + .getUserInstructor(new com.yunbao.common.http.base.HttpCallback>() { + @Override + public void onSuccess(List data) { + if (data != null && data.size() > 0) { + targetId = data.get(0).getAdminId(); + } + } + + @Override + public void onError(String error) { + + } + }); + } + + /** + * 获取新手指导员账号(废弃,过时) + */ + @Deprecated public void getConversationListByPage(boolean clearMessages) { RongIMClient.getInstance().getConversationListByPage(new RongIMClient.ResultCallback>() { @Override