新增访客记录

This commit is contained in:
huangjian
2022-01-14 15:00:59 +08:00
parent b2af96390d
commit 15cb4a502b
19 changed files with 421 additions and 4 deletions

View File

@@ -1245,6 +1245,10 @@
android:name=".vip.VipMainActivity" android:name=".vip.VipMainActivity"
android:screenOrientation="portrait" /> android:screenOrientation="portrait" />
<activity
android:name=".home.activity.VisitorListActivity"
android:screenOrientation="portrait" />
</application> </application>
</manifest> </manifest>

View File

@@ -123,6 +123,7 @@ import com.yizhuan.xchat_android_core.channel_page.model.ChannelPageModel;
import com.yizhuan.xchat_android_core.community.attachment.DynamicSysAttachment; import com.yizhuan.xchat_android_core.community.attachment.DynamicSysAttachment;
import com.yizhuan.xchat_android_core.community.event.SquareTaskEvent; import com.yizhuan.xchat_android_core.community.event.SquareTaskEvent;
import com.yizhuan.xchat_android_core.community.event.UnReadCountEvent; import com.yizhuan.xchat_android_core.community.event.UnReadCountEvent;
import com.yizhuan.xchat_android_core.home.event.VisitorUnreadCountEvent;
import com.yizhuan.xchat_android_core.user.bean.ProtocolInfo; import com.yizhuan.xchat_android_core.user.bean.ProtocolInfo;
import com.yizhuan.xchat_android_core.community.im.WorldDynamicAttachment; import com.yizhuan.xchat_android_core.community.im.WorldDynamicAttachment;
import com.yizhuan.xchat_android_core.home.model.GameHomeModel; import com.yizhuan.xchat_android_core.home.model.GameHomeModel;
@@ -1106,6 +1107,13 @@ public class MainActivity extends BaseMvpActivity<IMainView, MainPresenter>
CommonWebViewActivity.start(event.getContext(), event.getUrl()); CommonWebViewActivity.start(event.getContext(), event.getUrl());
} }
@Subscribe(threadMode = ThreadMode.MAIN)
public void onVisitorUnreadCountEvent(VisitorUnreadCountEvent event) {
if (mMainTabLayout != null) {
mMainTabLayout.setUnreadVisitorCount(event.getVisitNum());
}
}
@Override @Override
public void onClick(View v) { public void onClick(View v) {
switch (v.getId()) { switch (v.getId()) {

View File

@@ -0,0 +1,77 @@
package com.yizhuan.erban.home.activity
import android.annotation.SuppressLint
import android.content.Context
import android.content.Intent
import androidx.recyclerview.widget.LinearLayoutManager
import com.netease.nim.uikit.StatusBarUtil
import com.yizhuan.erban.R
import com.yizhuan.erban.base.BaseViewBindingActivity
import com.yizhuan.erban.common.EmptyViewHelper
import com.yizhuan.erban.databinding.ActivityVisitorListBinding
import com.yizhuan.erban.home.adapter.VisitorListAdapter
import com.yizhuan.erban.ui.utils.RVDelegate
import com.yizhuan.xchat_android_core.home.bean.VisitorInfo
import com.yizhuan.xchat_android_core.user.UserModel
import com.yizhuan.xchat_android_library.annatation.ActLayoutRes
@ActLayoutRes(R.layout.activity_visitor_list)
class VisitorListActivity : BaseViewBindingActivity<ActivityVisitorListBinding>() {
private lateinit var rvDelegate: RVDelegate<VisitorInfo>
companion object {
@JvmStatic
fun start(context: Context) {
val starter = Intent(context, VisitorListActivity::class.java)
context.startActivity(starter)
}
}
private var pageNum = 1
private val pageSize = 20
@SuppressLint("CheckResult")
override fun init() {
initTitleBar("访客记录")
rvDelegate = RVDelegate.Builder<VisitorInfo>()
.setRefreshLayout(binding.swipeRefresh)
.setLayoutManager(LinearLayoutManager(this))
.setRecyclerView(binding.recyclerView)
.setAdapter(VisitorListAdapter())
.setPageSize(pageSize)
.setEmptyView(EmptyViewHelper.createEmptyView(this, "暂未有人到访"))
.build()
rvDelegate.adapter.setOnLoadMoreListener({ loadData(false) }, binding.recyclerView)
binding.swipeRefresh.setOnRefreshListener {
loadData(true)
}
loadData(true)
}
@SuppressLint("CheckResult")
private fun loadData(refresh: Boolean) {
pageNum = if (refresh) 1 else pageNum + 1
UserModel.get().getVisitorUserList(pageNum, pageSize)
.compose(bindToLifecycle())
.subscribe(
{
rvDelegate.loadData(it, refresh)
},
{
rvDelegate.loadErr(true)
}
)
}
override fun needSteepStateBar() = true
override fun setStatusBar() {
super.setStatusBar()
StatusBarUtil.transparencyBar(this)
StatusBarUtil.StatusBarLightMode(this)
}
}

View File

@@ -0,0 +1,49 @@
package com.yizhuan.erban.home.adapter;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.yizhuan.erban.R;
import com.yizhuan.erban.ui.im.avtivity.NimP2PMessageActivity;
import com.yizhuan.erban.ui.user.UserInfoActivity;
import com.yizhuan.erban.ui.utils.ImageLoadUtils;
import com.yizhuan.xchat_android_core.home.bean.VisitorInfo;
import org.jetbrains.annotations.NotNull;
/**
* create by lvzebiao @2019/11/13
* 人气主播更多
*/
public class VisitorListAdapter extends BaseQuickAdapter<VisitorInfo, BaseViewHolder> {
public VisitorListAdapter() {
super(R.layout.item_home_visitor_list);
}
@Override
protected void convert(@NotNull BaseViewHolder helper, VisitorInfo item) {
if (item == null) {
return;
}
ImageLoadUtils.loadAvatar(mContext,
item.getAvatar(),
helper.getView(R.id.iv_avatar)
);
helper.setText(R.id.tv_nickname, item.getNick())
.setText(R.id.tv_id, "大鹅号:" + item.getErbanNo())
.setText(R.id.tv_time, item.getVisitTimeDesc())
.setImageResource(R.id.iv_gender, item.getGender() == 1 ? R.drawable.ic_gender_male : R.drawable.ic_gender_female);
helper.getView(R.id.iv_avatar).setOnClickListener(v ->
UserInfoActivity.Companion.start(mContext, item.getUid())
);
helper.getView(R.id.iv_msg).setOnClickListener(v ->
NimP2PMessageActivity.start(mContext, String.valueOf(item.getUid()))
);
}
}

View File

@@ -4,6 +4,7 @@ import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUS
import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MESS_SUB_OPENNOBLE; import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MESS_SUB_OPENNOBLE;
import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MESS_SUB_RENEWNOBLE; import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MESS_SUB_RENEWNOBLE;
import android.annotation.SuppressLint;
import android.content.Intent; import android.content.Intent;
import android.os.Bundle; import android.os.Bundle;
import android.text.TextUtils; import android.text.TextUtils;
@@ -22,6 +23,7 @@ import com.yizhuan.erban.decoration.view.MyDecorationActivity;
import com.yizhuan.erban.flutter.RouterConstants; import com.yizhuan.erban.flutter.RouterConstants;
import com.yizhuan.erban.flutter.event.ShowInviteEvent; import com.yizhuan.erban.flutter.event.ShowInviteEvent;
import com.yizhuan.erban.home.activity.CollectionRoomActivity; import com.yizhuan.erban.home.activity.CollectionRoomActivity;
import com.yizhuan.erban.home.activity.VisitorListActivity;
import com.yizhuan.erban.home.helper.OpenRoomHelper; import com.yizhuan.erban.home.helper.OpenRoomHelper;
import com.yizhuan.erban.module_hall.HallDataManager; import com.yizhuan.erban.module_hall.HallDataManager;
import com.yizhuan.erban.module_hall.hall.activity.ModuleClanActivity; import com.yizhuan.erban.module_hall.hall.activity.ModuleClanActivity;
@@ -37,6 +39,7 @@ import com.yizhuan.erban.vip.VipHelper;
import com.yizhuan.erban.vip.VipMainActivity; import com.yizhuan.erban.vip.VipMainActivity;
import com.yizhuan.xchat_android_core.UriProvider; import com.yizhuan.xchat_android_core.UriProvider;
import com.yizhuan.xchat_android_core.decoration.headwear.bean.HeadWearInfo; import com.yizhuan.xchat_android_core.decoration.headwear.bean.HeadWearInfo;
import com.yizhuan.xchat_android_core.home.event.VisitorUnreadCountEvent;
import com.yizhuan.xchat_android_core.level.UserLevelVo; import com.yizhuan.xchat_android_core.level.UserLevelVo;
import com.yizhuan.xchat_android_core.manager.IMNetEaseManager; import com.yizhuan.xchat_android_core.manager.IMNetEaseManager;
import com.yizhuan.xchat_android_core.manager.RelationShipEvent; import com.yizhuan.xchat_android_core.manager.RelationShipEvent;
@@ -241,6 +244,19 @@ public class MeFragment extends BaseFragment implements View.OnClickListener {
mBinding.meItemInviteFlag.setVisibility(event.mShowInvite ? View.VISIBLE : View.GONE); mBinding.meItemInviteFlag.setVisibility(event.mShowInvite ? View.VISIBLE : View.GONE);
} }
@SuppressLint("SetTextI18n")
@Subscribe(threadMode = ThreadMode.MAIN)
public void onVisitorUnreadCountEvent(VisitorUnreadCountEvent event) {
if (mBinding == null) return;
if (event.getVisitNum() == 0) {
mBinding.tvRedDot.setVisibility(View.GONE);
} else {
mBinding.tvRedDot.setVisibility(View.VISIBLE);
mBinding.tvRedDot.setText(event.getVisitNum() > 99 ? "99+" : String.valueOf(event.getVisitNum()));
}
}
private void requestUpdateUserInfo() { private void requestUpdateUserInfo() {
if (mUserInfo != null) { if (mUserInfo != null) {
UserModel.get().updateCurrentUserInfo().subscribe(); UserModel.get().updateCurrentUserInfo().subscribe();
@@ -345,6 +361,10 @@ public class MeFragment extends BaseFragment implements View.OnClickListener {
StatisticManager.Instance() StatisticManager.Instance()
.onEvent(StatisticsProtocol.Event.EVENT_VIP_ENTRANCE_ME_CLICK, "贵族我的入口点击事件"); .onEvent(StatisticsProtocol.Event.EVENT_VIP_ENTRANCE_ME_CLICK, "贵族我的入口点击事件");
break; break;
case R.id.me_item_visitor:
EventBus.getDefault().post(new VisitorUnreadCountEvent(0));
VisitorListActivity.start(mContext);
break;
default: default:
break; break;
} }

View File

@@ -140,7 +140,9 @@ public class UserInfoActivity extends BaseBindingActivity<ActivityUserInfoBindin
setEditButton(identityState, true); setEditButton(identityState, true);
setBackBottom(true); setBackBottom(true);
setTitleVisible(false); setTitleVisible(false);
if (userId != AuthModel.get().getCurrentUid()) {
UserModel.get().visitUserDetail(userId).subscribe();
}
} }
@Override @Override

View File

@@ -25,7 +25,8 @@ public class MainTabLayout extends LinearLayout implements View.OnClickListener
public static final int MAIN_TAB_POS_HOME = 4; public static final int MAIN_TAB_POS_HOME = 4;
public static final int MAIN_TAB_POS_GAME = 5; public static final int MAIN_TAB_POS_GAME = 5;
private MainTab gameTab, homeTab, meTab; private MainTab gameTab, homeTab;
private MainRedPointTab meTab;
private MainRedPointTab mMsgTab; private MainRedPointTab mMsgTab;
private MainRedPointTab mAttentionTab; private MainRedPointTab mAttentionTab;
private int mLastPosition = -1; private int mLastPosition = -1;
@@ -111,6 +112,12 @@ public class MainTabLayout extends LinearLayout implements View.OnClickListener
mMsgTab.setNumber(number); mMsgTab.setNumber(number);
} }
public void setUnreadVisitorCount(int count) {
if (meTab != null)
meTab.setNumber(count);
}
public void select(int position) { public void select(int position) {
if (mLastPosition == position) return; if (mLastPosition == position) return;
mAttentionTab.select(position == MAIN_TAB_POS_SQUARE); mAttentionTab.select(position == MAIN_TAB_POS_SQUARE);

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

View File

@@ -0,0 +1,40 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/white"
android:orientation="vertical">
<com.yizhuan.erban.base.TitleBar
android:id="@+id/title_bar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_25" />
<androidx.swiperefreshlayout.widget.SwipeRefreshLayout
android:id="@+id/swipe_refresh"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/color_F9F9F9">
<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recycler_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginStart="13dp"
android:layout_marginTop="10dp"
android:layout_marginEnd="13dp"
android:layout_marginBottom="10dp"
android:background="@drawable/bg_secondary_radius_10"
android:clipToPadding="false"
android:paddingTop="10dp" />
</FrameLayout>
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
</LinearLayout>

View File

@@ -627,6 +627,47 @@
android:textColor="@color/text_normal_c6c6e9" android:textColor="@color/text_normal_c6c6e9"
android:textSize="13sp" /> android:textSize="13sp" />
<FrameLayout
android:id="@+id/me_item_visitor"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:onClick="@{click}"
android:orientation="horizontal"
android:paddingEnd="15dp"
tools:ignore="UseCompoundDrawables">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/dp_me_text_padding_to_icon"
android:drawableStart="@mipmap/icon_visitor"
android:drawableEnd="@drawable/arrow_right"
android:drawablePadding="@dimen/dp_me_text_padding_to_icon"
android:gravity="center_vertical"
android:paddingTop="@dimen/dp_20"
android:paddingBottom="@dimen/dp_20"
android:text="访客记录"
android:textColor="@color/color_333333"
android:textSize="13sp" />
<TextView
android:id="@+id/tv_red_dot"
android:layout_width="wrap_content"
android:layout_height="15dp"
android:layout_gravity="start|center_vertical"
android:layout_marginStart="110dp"
android:background="@drawable/shap_red_point"
android:gravity="center"
android:includeFontPadding="false"
android:minWidth="15dp"
android:textColor="@color/white"
android:textSize="11dp"
android:visibility="gone"
tools:text="9"
tools:visibility="visible" />
</FrameLayout>
<View <View
android:layout_width="match_parent" android:layout_width="match_parent"

View File

@@ -0,0 +1,96 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/root_view"
android:layout_width="match_parent"
android:layout_height="70dp"
android:orientation="vertical">
<com.yizhuan.erban.common.widget.CircleImageView
android:id="@+id/iv_avatar"
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_marginStart="15dp"
android:layout_marginBottom="5dp"
android:scaleType="centerCrop"
android:src="@drawable/default_avatar"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/tv_nickname"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/dp_10"
android:ellipsize="end"
android:lines="1"
android:textColor="@color/color_333333"
android:textSize="13sp"
app:layout_constrainedWidth="true"
app:layout_constraintBottom_toTopOf="@id/tv_id"
app:layout_constraintEnd_toStartOf="@id/iv_gender"
app:layout_constraintHorizontal_bias="0"
app:layout_constraintHorizontal_chainStyle="packed"
app:layout_constraintStart_toEndOf="@+id/iv_avatar"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_chainStyle="packed"
tools:text="交友厅官方交友厅交友厅官方交友厅" />
<TextView
android:id="@+id/tv_id"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:textColor="@color/color_999999"
android:textSize="10sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="@id/tv_nickname"
app:layout_constraintTop_toBottomOf="@id/tv_nickname"
tools:text="66号1234567" />
<ImageView
android:id="@+id/iv_gender"
android:layout_width="14dp"
android:layout_height="14dp"
android:layout_marginStart="5dp"
android:layout_marginEnd="10dp"
android:src="@drawable/ic_gender_male"
app:layout_constraintBottom_toBottomOf="@id/tv_nickname"
app:layout_constraintStart_toEndOf="@id/tv_nickname"
app:layout_constraintTop_toTopOf="@id/tv_nickname" />
<ImageView
android:id="@+id/iv_msg"
android:layout_width="22dp"
android:layout_height="22dp"
android:src="@drawable/ic_visitor_msg"
app:layout_constraintBottom_toTopOf="@id/tv_time"
app:layout_constraintEnd_toEndOf="@id/tv_time"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_chainStyle="packed" />
<TextView
android:id="@+id/tv_time"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="15dp"
android:textColor="@color/color_999999"
android:textSize="10sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@id/iv_msg"
tools:text="37分钟前看过你" />
<View
android:layout_width="match_parent"
android:layout_height="1px"
android:layout_marginStart="15dp"
android:layout_marginEnd="15dp"
android:background="@color/color_f5f5f5"
app:layout_constraintBottom_toBottomOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@@ -59,7 +59,7 @@
app:tab_text_color="@color/main_tab_normal" app:tab_text_color="@color/main_tab_normal"
app:tab_text_color_select="@color/color_333333" /> app:tab_text_color_select="@color/color_333333" />
<com.yizhuan.erban.ui.widget.MainTab <com.yizhuan.erban.ui.widget.MainRedPointTab
android:id="@+id/main_me_tab" android:id="@+id/main_me_tab"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

View File

@@ -0,0 +1,10 @@
package com.yizhuan.xchat_android_core.home.bean
data class VisitorInfo(
val avatar: String? = null,
val erbanNo: Int = 0,
val gender: Int = 0,
val nick: String? = null,
val uid: Long = 0,
val visitTimeDesc: String? = null
)

View File

@@ -0,0 +1,10 @@
package com.yizhuan.xchat_android_core.home.event;
import lombok.AllArgsConstructor;
import lombok.Data;
@AllArgsConstructor
@Data
public class VisitorUnreadCountEvent {
private int visitNum;
}

View File

@@ -397,6 +397,10 @@ public class CustomAttachment implements MsgAttachment {
public static final int CUSTOM_MSG_FIRST_CHARGE = 76; public static final int CUSTOM_MSG_FIRST_CHARGE = 76;
public static final int CUSTOM_MSG_SUB_FIRST_CHARGE_PRIZE = 761; public static final int CUSTOM_MSG_SUB_FIRST_CHARGE_PRIZE = 761;
//访客未读
public static final int CUSTOM_MSG_HEADER_TYPE_VISITOR = 78;
public static final int CUSTOM_MSG_SUB_TYPE_VISITOR_UNREAD = 781;
//跨房PK //跨房PK
public static final int CUSTOM_MSG_ROOM_PK = 83; public static final int CUSTOM_MSG_ROOM_PK = 83;
public static final int CUSTOM_MSG_SUB_ROOM_PK_INVITE = 831; public static final int CUSTOM_MSG_SUB_ROOM_PK_INVITE = 831;

View File

@@ -16,6 +16,7 @@ import com.netease.nimlib.sdk.msg.model.IMMessage;
import com.yizhuan.xchat_android_core.auth.AuthModel; import com.yizhuan.xchat_android_core.auth.AuthModel;
import com.yizhuan.xchat_android_core.community.attachment.UnReadCountAttachment; import com.yizhuan.xchat_android_core.community.attachment.UnReadCountAttachment;
import com.yizhuan.xchat_android_core.community.event.UnReadCountEvent; import com.yizhuan.xchat_android_core.community.event.UnReadCountEvent;
import com.yizhuan.xchat_android_core.home.event.VisitorUnreadCountEvent;
import com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment; import com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment;
import com.yizhuan.xchat_android_core.im.custom.bean.VoiceBottleSayHiAttachment; import com.yizhuan.xchat_android_core.im.custom.bean.VoiceBottleSayHiAttachment;
import com.yizhuan.xchat_android_core.mentoring_relationship.attachment.MentoringApprenticeMissionFourAttachment; import com.yizhuan.xchat_android_core.mentoring_relationship.attachment.MentoringApprenticeMissionFourAttachment;
@@ -51,8 +52,10 @@ import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUS
import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MSG_GROUP_CHAT_ROOM_NOTIFY; import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MSG_GROUP_CHAT_ROOM_NOTIFY;
import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MSG_GROUP_CHAT_TOPIC; import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MSG_GROUP_CHAT_TOPIC;
import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MSG_HEADER_TYPE_ACCOUNT; import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MSG_HEADER_TYPE_ACCOUNT;
import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MSG_HEADER_TYPE_VISITOR;
import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MSG_HEADER_TYPE_WORLD_DYNAMIC; import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MSG_HEADER_TYPE_WORLD_DYNAMIC;
import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MSG_MINI_WORLD; import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MSG_MINI_WORLD;
import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MSG_SUB_TYPE_VISITOR_UNREAD;
import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MSG_VIP; import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MSG_VIP;
import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MSG_VIP_SELF_OPEN; import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MSG_VIP_SELF_OPEN;
import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MSG_VIP_SELF_UPGRADE; import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MSG_VIP_SELF_UPGRADE;
@@ -301,7 +304,6 @@ public class IMSystemMsgManager {
EventBus.getDefault().post(event); EventBus.getDefault().post(event);
} }
break; break;
case CUSTOM_MSG_VIP: case CUSTOM_MSG_VIP:
if (subType == CUSTOM_MSG_VIP_SELF_UPGRADE) { if (subType == CUSTOM_MSG_VIP_SELF_UPGRADE) {
VipInfo vipInfo = new Gson().fromJson(data.toJSONString(), VipInfo.class); VipInfo vipInfo = new Gson().fromJson(data.toJSONString(), VipInfo.class);
@@ -311,6 +313,15 @@ public class IMSystemMsgManager {
EventBus.getDefault().post(new VipOpenEvent()); EventBus.getDefault().post(new VipOpenEvent());
} }
break; break;
case CUSTOM_MSG_HEADER_TYPE_VISITOR:
if (subType == CUSTOM_MSG_SUB_TYPE_VISITOR_UNREAD) {
int visitNum = 0;
if (data.containsKey("visitNum")) {
visitNum = data.getIntValue("visitNum");
}
EventBus.getDefault().post(new VisitorUnreadCountEvent(visitNum));
}
break;
default: default:
break; break;
} }

View File

@@ -5,6 +5,7 @@ import androidx.annotation.Nullable;
import com.yizhuan.xchat_android_core.base.IModel; import com.yizhuan.xchat_android_core.base.IModel;
import com.yizhuan.xchat_android_core.bean.RoomHistoryInfo; import com.yizhuan.xchat_android_core.bean.RoomHistoryInfo;
import com.yizhuan.xchat_android_core.bean.response.ServiceResult; import com.yizhuan.xchat_android_core.bean.response.ServiceResult;
import com.yizhuan.xchat_android_core.home.bean.VisitorInfo;
import com.yizhuan.xchat_android_core.user.bean.GiftAchievementInfo; import com.yizhuan.xchat_android_core.user.bean.GiftAchievementInfo;
import com.yizhuan.xchat_android_core.user.bean.GiftWallInfo; import com.yizhuan.xchat_android_core.user.bean.GiftWallInfo;
import com.yizhuan.xchat_android_core.user.bean.NewUserInfo; import com.yizhuan.xchat_android_core.user.bean.NewUserInfo;
@@ -222,4 +223,8 @@ public interface IUserModel extends IModel {
String getPreFillInviteCode(); String getPreFillInviteCode();
Single<ProtocolInfo> getProtocolInfo(); Single<ProtocolInfo> getProtocolInfo();
Single<String> visitUserDetail(long uid);
Single<List<VisitorInfo>> getVisitorUserList(int pageNum, int pageSize);
} }

View File

@@ -17,6 +17,7 @@ import com.yizhuan.xchat_android_core.bean.response.ServiceResult;
import com.yizhuan.xchat_android_core.bean.response.result.GiftWallListResult; import com.yizhuan.xchat_android_core.bean.response.result.GiftWallListResult;
import com.yizhuan.xchat_android_core.bean.response.result.UserListResult; import com.yizhuan.xchat_android_core.bean.response.result.UserListResult;
import com.yizhuan.xchat_android_core.bean.response.result.UserResult; import com.yizhuan.xchat_android_core.bean.response.result.UserResult;
import com.yizhuan.xchat_android_core.home.bean.VisitorInfo;
import com.yizhuan.xchat_android_core.level.event.CharmLevelUpEvent; import com.yizhuan.xchat_android_core.level.event.CharmLevelUpEvent;
import com.yizhuan.xchat_android_core.level.event.LevelUpEvent; import com.yizhuan.xchat_android_core.level.event.LevelUpEvent;
import com.yizhuan.xchat_android_core.noble.NobleUtil; import com.yizhuan.xchat_android_core.noble.NobleUtil;
@@ -800,6 +801,21 @@ public final class UserModel extends BaseModel implements IUserModel {
.compose(RxHelper.handleSchedulers()); .compose(RxHelper.handleSchedulers());
} }
@Override
public Single<String> visitUserDetail(long uid) {
return api.visitUserDetail(uid)
.compose(RxHelper.handleStringData())
.compose(RxHelper.handleSchedulers());
}
@Override
public Single<List<VisitorInfo>> getVisitorUserList(int pageNum, int pageSize) {
return api.getVisitorUserList(pageNum, pageSize)
.compose(RxHelper.handleBeanData())
.compose(RxHelper.handleSchedulers());
}
private interface Api { private interface Api {
/** /**
@@ -1021,5 +1037,22 @@ public final class UserModel extends BaseModel implements IUserModel {
*/ */
@GET("/user/latestPrivacyPolicy") @GET("/user/latestPrivacyPolicy")
Single<ServiceResult<ProtocolInfo>> getProtocolInfo(); Single<ServiceResult<ProtocolInfo>> getProtocolInfo();
/**
* 访客列表
*
* @return
*/
@GET("/user/detail/visitUserDetail")
Single<ServiceResult<String>> visitUserDetail(@Query("uid") long uid);
/**
* 访客列表
*
* @return -
*/
@GET("/uservisitrecord/visitUserList")
Single<ServiceResult<List<VisitorInfo>>> getVisitorUserList(@Query("pageNum") int pageNum,
@Query("pageSize") int pageSize);
} }
} }