修复缺少的接口请求

修复消息列表数组下标越界问题
This commit is contained in:
zlzw 2024-07-27 11:14:30 +08:00
parent 05f1bc6e20
commit 5f107fef25
5 changed files with 39 additions and 12 deletions

View File

@ -136,7 +136,7 @@ public abstract class AbsMainMessageChatListFragment extends Fragment {
});
}
public void loadLiveOnlineStatus(List<BaseUiConversation> srcList, OnRecyclerListRefreshListener<List<BaseUiConversation>> onRefreshListener){
public void loadLiveOnlineStatus(List<BaseUiConversation> srcList, OnRecyclerListRefreshListener<List<BaseUiConversation>> onRefreshListener) {
List<String> uids = new ArrayList<>();
isNet = true;
for (BaseUiConversation conversation : srcList) {
@ -148,10 +148,17 @@ public abstract class AbsMainMessageChatListFragment extends Fragment {
CommonHttpUtil.getUserOnline(String.join(",", uids), new com.yunbao.common.http.HttpCallback() {
@Override
public void onSuccess(int code, String msg, String[] info) {
if(code==0&&info!=null){
if (code == 0 && info != null) {
List<MsgOnlineStatusBean> listUserBean = JSON.parseArray(Arrays.toString(info), MsgOnlineStatusBean.class);
for (int i = 0; i <srcList.size(); i++) {
srcList.get(i).mCore.setDraft(listUserBean.get(i).getOnline());
for (int i = 0; i < srcList.size(); i++) {
for (int j = 0; j < listUserBean.size(); j++) {
if (!StringUtil.isEmpty(srcList.get(i).mCore.getTargetId()) &&
srcList.get(i).mCore.getTargetId().equals(listUserBean.get(j).getId())) {
srcList.get(i).mCore.setDraft(listUserBean.get(j).getOnline());
break;
}
}
}
onRefreshListener.onFinish(srcList);
isNet = false;

View File

@ -705,6 +705,12 @@ public class CommonHttpUtil {
.params("behavior_type","5")
.execute(callback);
}
public static void sayHi(String toUid,String type,HttpCallback callback) {
HttpClient.getInstance().get("Pdluser.liveCall", "Pdluser.liveCall")
.params("target_uid",toUid)
.params("behavior_type",type)
.execute(callback);
}
/**
*获取聊天列表用户在线状态

View File

@ -4,7 +4,7 @@ ext {
buildToolsVersion: "29.0.2",
minSdkVersion : 23,
targetSdkVersion : 34,
versionCode : 538,
versionCode : 539,
versionName : "6.7.2",
namespace : "com.pandoralive.shayu"
]

View File

@ -762,6 +762,13 @@ public class LiveUserDialogFragment extends AbsDialogFragment implements View.On
showMsgError();
return;
}
boolean isAnchor = CommonAppConfig.getInstance().getUserBean().getUsers_type().equals("C");
CommonHttpUtil.sayHi(mToUid, isAnchor ? "6" : "7",new HttpCallback() {
@Override
public void onSuccess(int code, String msg, String[] info) {
}
});
EventBus.getDefault().post(new MainHomeCommunityToChatEvent().setTargetId(mToUid));
}
}

View File

@ -589,7 +589,7 @@ public class UserHomeActivity extends AbsActivity {
communityRecyclerView.setOverScrollMode(View.OVER_SCROLL_NEVER);
msgLayout = findViewById(R.id.msgLayout);
msgLayout.setVisibility(uid.equals(CommonAppConfig.getInstance().getUid())?View.GONE:View.VISIBLE);
msgLayout.setVisibility(uid.equals(CommonAppConfig.getInstance().getUid()) ? View.GONE : View.VISIBLE);
msgLayout.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
@ -610,6 +610,13 @@ public class UserHomeActivity extends AbsActivity {
showMsgError();
return;
}
boolean isAnchor = CommonAppConfig.getInstance().getUserBean().getUsers_type().equals("C");
CommonHttpUtil.sayHi(String.valueOf(userInfo.getUserHomeTopInfo().getUser_id()), isAnchor ? "6" : "7", new com.yunbao.common.http.HttpCallback() {
@Override
public void onSuccess(int code, String msg, String[] info) {
}
});
EventBus.getDefault().post(new MainHomeCommunityToChatEvent().setTargetId(String.valueOf(userInfo.getUserHomeTopInfo().getUser_id())));
}
});
@ -655,7 +662,7 @@ public class UserHomeActivity extends AbsActivity {
liveBean.setParams(gotoRoomKey);
new LiveRoomCheckLivePresenter(mContext, liveBean.getUid(), liveBean.getStream(), new LiveRoomCheckLivePresenter.NewActionListener() {
@Override
public void onLiveRoomChanged(String liveUid, String stream, int liveType, String liveTypeVal, String liveSdk,boolean isSw) {
public void onLiveRoomChanged(String liveUid, String stream, int liveType, String liveTypeVal, String liveSdk, boolean isSw) {
if (StringUtil.isEmpty(liveUid)) {
return;
}
@ -663,7 +670,7 @@ public class UserHomeActivity extends AbsActivity {
if (AppManager.getInstance().getLiveActivity() != null) {
EventBus.getDefault().post(new LiveRoomChangeEvent(liveBean, liveType, Integer.parseInt(liveTypeVal)).setLiveEnd(true));
} else {
RouteUtil.forwardLiveAudienceActivity(liveBean, liveType, Integer.parseInt(liveTypeVal), Integer.parseInt(liveSdk),isSw);
RouteUtil.forwardLiveAudienceActivity(liveBean, liveType, Integer.parseInt(liveTypeVal), Integer.parseInt(liveSdk), isSw);
}
}
@ -843,7 +850,7 @@ public class UserHomeActivity extends AbsActivity {
}
public void showMsgError() {
ToastUtil.show(WordUtil.isNewZh()?"無法聊天,待開發":"Unable to chat, awaiting development");
ToastUtil.show(WordUtil.isNewZh() ? "無法聊天,待開發" : "Unable to chat, awaiting development");
}