2020/4/7新包

This commit is contained in:
oujunhui
2020-04-07 16:41:24 +08:00
parent 2f9d26fd7e
commit 9bbeb8e1f6
141 changed files with 4162 additions and 561 deletions

View File

@@ -256,4 +256,9 @@ public class XChatConstants {
public static final String REPORT_TYPE_PERSONAL_DYNAMIC = "PERSONAL_DYNAMIC"; // 个人页动态
public static final String REPORT_TYPE_DYNAMIC_SQUARE = "DYNAMIC_SQUARE";//广场动态
// 轻寻
public static final String QUICK_PASS_BUSINESS_ID = BuildConfig.DEBUG ? "4f7410a22ec8426281d4faf286835c3e" : "398816ccd0094b3fa430dbad3c08c102";
// 侧耳
// public static final String QUICK_PASS_BUSINESS_ID = BuildConfig.DEBUG ? "cadbb4ed892549dab4d1adc9d62013bb" : "ba4a642810294561b9cd17034a448b49";
}

View File

@@ -268,5 +268,13 @@ public class UriProvider {
return JAVA_WEB_URL.concat(linkUrl);
}
/**
* 主播认证
*
*/
public static String getAnchorCertification() {
return JAVA_WEB_URL.concat("/modules/certification/index.html");
}
}

View File

@@ -0,0 +1,30 @@
package com.yizhuan.xchat_android_core.helper;
import com.netease.nimlib.sdk.chatroom.ChatRoomMessageBuilder;
import com.netease.nimlib.sdk.chatroom.model.ChatRoomMessage;
import com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment;
import com.yizhuan.xchat_android_core.manager.AvRoomDataManager;
import com.yizhuan.xchat_android_core.manager.IMNetEaseManager;
import io.reactivex.Single;
/**
* create by lvzebiao @2020/3/18
*/
public class ImHelperUtils {
public static <T extends CustomAttachment> Single<ChatRoomMessage> sendCustomMsg(String roomId, T t) {
ChatRoomMessage message = ChatRoomMessageBuilder.createChatRoomCustomMessage(roomId, t);
return IMNetEaseManager.get().sendChatRoomMessage(message, false);
}
public static <T extends CustomAttachment> Single<ChatRoomMessage> sendChatRoomMessage(T t) {
long roomId = AvRoomDataManager.get().getRoomId();
if (roomId <= 0) {
return Single.error(new Throwable("roomId <= 0"));
}
ChatRoomMessage message = ChatRoomMessageBuilder.createChatRoomCustomMessage(String.valueOf(roomId), t);
return IMNetEaseManager.get().sendChatRoomMessage(message, false);
}
}

View File

@@ -44,6 +44,9 @@ public class HomeHallMsgInfo implements Serializable, MultiItemEntity {
private int messageType = MESSAGE_TYPE_TEXT;
private int itemType;
private String fixedWord;
private String iconPic;
@Override
public int getItemType() {
return itemType;

View File

@@ -85,9 +85,11 @@ import com.yizhuan.xchat_android_core.im.custom.bean.RoomInfoAttachment;
import com.yizhuan.xchat_android_core.im.custom.bean.RoomTipAttachment;
import com.yizhuan.xchat_android_core.im.custom.bean.RouterType;
import com.yizhuan.xchat_android_core.im.custom.bean.SysMsgAttachment;
import com.yizhuan.xchat_android_core.im.custom.bean.WelcomeAttachment;
import com.yizhuan.xchat_android_core.level.UserLevelVo;
import com.yizhuan.xchat_android_core.luckymoney.LuckyMoneyInfo;
import com.yizhuan.xchat_android_core.magic.MagicModel;
import com.yizhuan.xchat_android_core.magic.bean.MagicInfo;
import com.yizhuan.xchat_android_core.magic.toolbox.MagicToolbox;
import com.yizhuan.xchat_android_core.miniworld.bean.MiniWorldDetailInfo;
import com.yizhuan.xchat_android_core.miniworld.bean.MiniWorldDetailInfoWithCurrentMember;
@@ -97,6 +99,7 @@ import com.yizhuan.xchat_android_core.monsterhunting.bean.MonsterInfo;
import com.yizhuan.xchat_android_core.monsterhunting.bean.MonsterProtocol;
import com.yizhuan.xchat_android_core.msg.sys.ErbanSysMsgInfo;
import com.yizhuan.xchat_android_core.msg.sys.ErbanSysMsgParamKey;
import com.yizhuan.xchat_android_core.msg.sysv2.ErbanSysMsgV2Info;
import com.yizhuan.xchat_android_core.noble.NobleInfo;
import com.yizhuan.xchat_android_core.noble.NobleResourceType;
import com.yizhuan.xchat_android_core.noble.NobleUtil;
@@ -150,6 +153,7 @@ import com.yizhuan.xchat_android_core.user.UserModel;
import com.yizhuan.xchat_android_core.user.bean.BaseInfo;
import com.yizhuan.xchat_android_core.user.bean.UserInfo;
import com.yizhuan.xchat_android_core.utils.SharedPreferenceUtils;
import com.yizhuan.xchat_android_core.utils.net.DontWarnObserver;
import com.yizhuan.xchat_android_library.net.rxnet.callback.CallBack;
import com.yizhuan.xchat_android_library.rxbus.RxBus;
import com.yizhuan.xchat_android_library.utils.JavaUtil;
@@ -849,19 +853,27 @@ public final class IMNetEaseManager {
break;
case CUSTOM_MSG_HEADER_TYPE_SEND_MAGIC:
// 如果本地没有的话,尝试获取服务器最新列表
MagicModel.get().getLocalMagicList().subscribe();
if (second == CUSTOM_MSG_SUB_TYPE_SEND_SINGLE_MAGIC) {
MagicAttachment magicAttachment = (MagicAttachment) attachment;
noticeReceivedSingleMagic(magicAttachment);
} else if (second == CUSTOM_MSG_SUB_TYPE_SEND_MULTI_MAGIC) {
MagicAllMicAttachment magicAllMicAttachment = (MagicAllMicAttachment) attachment;
noticeReceivedAllMicMagic(magicAllMicAttachment);
} else if (second == CustomAttachment.CUSTOM_MSG_SUB_TYPE_BATCH_SEND_MAGIC) {
MagicBatchAttachment magicBatchAttachment = (MagicBatchAttachment) attachment;
MagicAllMicAttachment magicAllMicAttachment = new MagicAllMicAttachment();
magicAllMicAttachment.setMultiMagicReceivedInfo(MagicToolbox.transformToMultiMagicReceivedInfo(magicBatchAttachment.getMagicMultiReceiverInfo()));
noticeReceivedAllMicMagic(magicAllMicAttachment);
}
// iOS那边没传url如果是首次接收的话可能缓存没有
// 改成访问成功,再处理消息
MagicModel.get().getLocalMagicList()
.subscribe(new DontWarnObserver<List<MagicInfo>>() {
@Override
public void acceptThrowable(List<MagicInfo> magicInfos, Throwable throwable) {
super.acceptThrowable(magicInfos, throwable);
if (second == CUSTOM_MSG_SUB_TYPE_SEND_SINGLE_MAGIC) {
MagicAttachment magicAttachment = (MagicAttachment) attachment;
noticeReceivedSingleMagic(magicAttachment);
} else if (second == CUSTOM_MSG_SUB_TYPE_SEND_MULTI_MAGIC) {
MagicAllMicAttachment magicAllMicAttachment = (MagicAllMicAttachment) attachment;
noticeReceivedAllMicMagic(magicAllMicAttachment);
} else if (second == CustomAttachment.CUSTOM_MSG_SUB_TYPE_BATCH_SEND_MAGIC) {
MagicBatchAttachment magicBatchAttachment = (MagicBatchAttachment) attachment;
MagicAllMicAttachment magicAllMicAttachment = new MagicAllMicAttachment();
magicAllMicAttachment.setMultiMagicReceivedInfo(MagicToolbox.transformToMultiMagicReceivedInfo(magicBatchAttachment.getMagicMultiReceiverInfo()));
noticeReceivedAllMicMagic(magicAllMicAttachment);
}
}
});
MagicModel.get().handleMagicGiftValue(customAttachment);
break;
case CUSTOM_MSG_HEADER_TYPE_KICK_MIC:
@@ -1167,6 +1179,15 @@ public final class IMNetEaseManager {
EventBus.getDefault().post(new ActivityTimerEvent(timerBean));
}
break;
//公屏欢迎语
case CustomAttachment.CUSTOM_MSG_HEADER_TYPE_PUBLIC_SCREEN:
if (second == CustomAttachment.CUSTOM_MSG_SUB_TYPE_PUBLIC_SCREEN_WELCOME) {
WelcomeAttachment welcomeAttachment = (WelcomeAttachment) msg.getAttachment();
if (welcomeAttachment.isNeedAddToMsg()) {
addMessages(msg);
}
}
break;
default:
}
@@ -2920,6 +2941,22 @@ public final class IMNetEaseManager {
}
}
/**
* 更新系统消息到本地数据库
*
* @param uuid 消息 UUID
* @param sysMsgV2Info 系统消息实体
*/
public void updateErbanSysMsgV2InfoMessage(String uuid, ErbanSysMsgV2Info sysMsgV2Info) {
IMMessage message = queryMessageByUuid(uuid);
if (message != null) {
Map<String, Object> localExtension = ErbanSysMsgV2Info.convertToMap(sysMsgV2Info);
message.setLocalExtension(localExtension);
NIMClient.getService(MsgService.class)
.updateIMMessage(message);
}
}
/**
* -------------------------通知begin-------------------------------
*/

View File

@@ -12,6 +12,7 @@ import com.netease.nimlib.sdk.NIMClient;
import com.netease.nimlib.sdk.Observer;
import com.netease.nimlib.sdk.RequestCallback;
import com.netease.nimlib.sdk.RequestCallbackWrapper;
import com.netease.nimlib.sdk.StatusBarNotificationConfig;
import com.netease.nimlib.sdk.StatusCode;
import com.netease.nimlib.sdk.auth.AuthService;
import com.netease.nimlib.sdk.auth.AuthServiceObserver;
@@ -28,6 +29,7 @@ import com.yizhuan.xchat_android_core.auth.event.KickOutEvent;
import com.yizhuan.xchat_android_core.auth.event.LoginEvent;
import com.yizhuan.xchat_android_core.auth.event.LogoutEvent;
import com.yizhuan.xchat_android_core.auth.exception.BanAccountException;
import com.yizhuan.xchat_android_core.auth.exception.BigHeadPhoneException;
import com.yizhuan.xchat_android_core.auth.exception.IsSuperAdminException;
import com.yizhuan.xchat_android_core.auth.exception.OldMemberException;
import com.yizhuan.xchat_android_core.auth.exception.ShowPhoneCodeException;
@@ -122,6 +124,11 @@ public class AuthModel extends BaseModel implements IAuthModel {
*/
public static final int CODE_HIT_YI_DUN = 24000;
/**
* 一个手机绑定多个账号(大头账号)
*/
public static final int CODE_BIG_HEAD_NUM = 25002;
private Api api;
@@ -725,6 +732,76 @@ public class AuthModel extends BaseModel implements IAuthModel {
}
@Override
public Single<String> quickPassLogin(String token, String accessToken, String shuMeiDeviceId, String yiDunToken) {
return Single.create(new SingleOnSubscribe<String>() {
@Override
public void subscribe(SingleEmitter<String> emitter) throws Exception {
//获取登录信息
try {
LoginResult loginResult = api.quickPassLogin( token, accessToken, yiDunToken, shuMeiDeviceId ).blockingGet();
if (!loginResult.isSuccess()) {
if (loginResult.getCode() == CODE_BAN_ACCOUNT || loginResult.getCode() == CODE_BAN_DEVICE) {
emitter.onError(new BanAccountException(loginResult.getReason(), loginResult.getDate()));
} else if (loginResult.getCode() == CODE_SHOW_CODE) {
emitter.onError(new ShowPhoneCodeException(loginResult.getMessage(), loginResult.isVerifyCode()));
} else if (loginResult.getCode() == SUPER_CODE_SHOW_CODE) {
//是否是超管
if (loginResult.getSuperCodeVerify() == 1) {
emitter.onError(new IsSuperAdminException(loginResult.getMessage()));
}else {
emitter.onError(new Throwable(loginResult.getMessage()));
}
} else if (loginResult.getCode() == CODE_BIG_HEAD_NUM) {
emitter.onError(new BigHeadPhoneException(loginResult.getMessage()));
} else {
emitter.onError(new Throwable(loginResult.getMessage()));
}
return;
}
currentAccountInfo = loginResult.getData();
DemoCache.saveCurrentAccountInfo(currentAccountInfo);
//成功获取到uid后就通知首页刷新审核中状态的数据
EventBus.getDefault().post(new GetCurrentUidEvent(true));
} catch (Exception e) {
emitter.onError(handleException(e));
//emitter.onError(new Throwable(OldHttpErrorHandleUtil.handle(e)));
return;
}
//获取tick
try {
TicketResult ticketResult = requestTicket().blockingGet();
if (!ticketResult.isSuccess()) {
emitter.onError(new Throwable(ticketResult.getMessage()));
return;
}
ticketInfo = ticketResult.getData();
DemoCache.saveTicketInfo(ticketInfo);
} catch (Exception e) {
emitter.onError(new Throwable(OldHttpErrorHandleUtil.handle(e)));
return;
}
emitter.onSuccess("登录成功!");
}
})
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.flatMap(new Function<String, SingleSource<String>>() {
@Override
public SingleSource<String> apply(String s) throws Exception {
return imLogin(currentAccountInfo);
}
})
.doOnSuccess(new Consumer<String>() {
@Override
public void accept(String s) throws Exception {
//登录成功后发出登录事件
EventBus.getDefault().post(new LoginEvent());
}
});
}
/**
* 获取tick
*
@@ -1117,6 +1194,7 @@ public class AuthModel extends BaseModel implements IAuthModel {
return statusCode == StatusCode.LOGINED;
}
boolean isInit = false;
/**
@@ -1234,9 +1312,9 @@ public class AuthModel extends BaseModel implements IAuthModel {
private void initNotificationConfig() {
// 初始化消息提醒
NIMClient.toggleNotification(true);
// 加载状态栏配置
// // 加载状态栏配置
// StatusBarNotificationConfig statusBarNotificationConfig = new StatusBarNotificationConfig();
// 更新配置
//// 更新配置
// NIMClient.updateStatusBarNotificationConfig(statusBarNotificationConfig);
}
@@ -1523,6 +1601,25 @@ public class AuthModel extends BaseModel implements IAuthModel {
@POST("sms/login/verify")
Single<ServiceResult<Object>> check(@Query("phone") String phone, @Query("code") String code);
/**
*
* @param token
* 易盾一键登录token
* @param accessToken
* 易盾一键登录accessToken
* @param shuMeiDeviceId
* 数美设备id
* @param yiDunToken
* 易盾登录保护token
* @return
*/
@POST("acc/oneclick/login")
Single<LoginResult> quickPassLogin(@Query("token") String token,
@Query("accessToken") String accessToken,
@Query("shuMeiDeviceId") String shuMeiDeviceId,
@Query("yiDunToken") String yiDunToken
);
}
}

View File

@@ -155,4 +155,9 @@ public interface IAuthModel extends IModel{
* @return
*/
boolean isImLogin();
/**
* 一键登录
*/
Single<String> quickPassLogin(String token, String accessToken, String shuMeiDeviceId, String yiDunToken);
}

View File

@@ -0,0 +1,8 @@
package com.yizhuan.xchat_android_core.auth.exception;
public class BigHeadPhoneException extends Exception {
public BigHeadPhoneException(String message) {
super(message);
}
}

View File

@@ -31,7 +31,6 @@ public class UserInfoItem<T extends Serializable> implements MultiItemEntity, Pa
public static final transient int TYPE_DES_FAMILY = 13;// 资料_家族
public static final transient int TYPE_DES_HALL = 14;// 资料_模厅
public static final transient int TYPE_DES_GAME = 15;// 资料_本周战绩
public static final transient int TYPE_DES_TAG = 16;// 资料_认证标签
public static final transient int TYPE_DES_JOIN_WORLDS = 17;// 资料_小世界列表
//类型

View File

@@ -455,6 +455,20 @@ public class CustomAttachParser implements MsgAttachmentParser {
}
break;
case CustomAttachment.CUSTOM_MSG_HEADER_TYPE_PUBLIC_SCREEN:
if (second == CustomAttachment.CUSTOM_MSG_SUB_TYPE_PUBLIC_SCREEN_WELCOME) {
attachment = new WelcomeAttachment();
}
break;
case CustomAttachment.CUSTOM_MSG_HEADER_COMMON_SYSTEM_MSG_V2:
if (second == CustomAttachment.CUSTOM_MSG_SUB_TYPE_COMMON_SYSTEM_MSG_V2_TEXT
|| second == CustomAttachment.CUSTOM_MSG_SUB_TYPE_COMMON_SYSTEM_MSG_V2_APPROVAL) {
attachment = new SysMsgV2Attachment(first, second);
}
break;
default:
break;
}

View File

@@ -315,11 +315,27 @@ public class CustomAttachment implements MsgAttachment {
public static final int CUSTOM_DYNAMTC_BAN_DELETE = 522; // 违禁删除
public static final int CUSTOM_DYNAMTC_PASS = 523; // 动态审核
public static final int CUSTOM_MSG_SUB_TYPE_WORLD_DYNAMIC_SHARE = 524; //分享app内好友
public static final int CUSTOM_MSG_SUB_TYPE_WORLD_DYNAMIC_PUBLISH = 525; // 关注用户发了一条动态
//活动的暴走倒计时
public static final int CUSTOM_MSG_HEADER_TYPE_ACTIVITY = 53;
public static final int CUSTOM_MSG_SUB_TYPE_ACTIVITY_TIMER = 531;
//54 55 iOS使用了
//麦上用户 公屏欢迎消息
public static final int CUSTOM_MSG_HEADER_TYPE_PUBLIC_SCREEN = 56;
public static final int CUSTOM_MSG_SUB_TYPE_PUBLIC_SCREEN_WELCOME = 561; //欢迎语
//通用系统通知带路由跳转功能23废弃因为字段乱定义
public static final int CUSTOM_MSG_HEADER_COMMON_SYSTEM_MSG_V2 = 57;
public static final int CUSTOM_MSG_SUB_TYPE_COMMON_SYSTEM_MSG_V2_TEXT = 571;
public static final int CUSTOM_MSG_SUB_TYPE_COMMON_SYSTEM_MSG_V2_APPROVAL = 572;
//系统通知一个通用的头可以往下拓展second
public static final int CUSTOM_MSG_HEADER_TYPE_COMMON_SYS_NOTICATION = 58;
public static final int CUSTOM_MSG_SUB_TYPE_FIRST_RECHARGE_SUCCESS = 581; //首充成功
public CustomAttachment() {
}

View File

@@ -178,5 +178,9 @@ public class RouterType {
* 发布动态
*/
public static final int SQUARE_PUBLISH = 51;
/**
* APP内的反馈
*/
public static final int FEED_BACK = 52;
}

View File

@@ -0,0 +1,43 @@
package com.yizhuan.xchat_android_core.im.custom.bean;
import com.alibaba.fastjson.JSONObject;
import com.google.gson.Gson;
import com.yizhuan.xchat_android_core.msg.sysv2.ErbanSysMsgV2Info;
import lombok.Getter;
import lombok.Setter;
/**
* Created by lvzebiao on 2020/3/28.
*/
public class SysMsgV2Attachment extends CustomAttachment{
@Getter
@Setter
private ErbanSysMsgV2Info erbanSysMsgV2Info;
public SysMsgV2Attachment(int first, int second) {
super(first, second);
}
@Override
protected void parseData(JSONObject data) {
try {
erbanSysMsgV2Info = new Gson().fromJson(data.toJSONString(), ErbanSysMsgV2Info.class);
} catch (Exception ex) {
ex.printStackTrace();
}
}
@Override
protected JSONObject packData() {
try {
String jsonStr = new Gson().toJson(erbanSysMsgV2Info);
return JSONObject.parseObject(jsonStr);
} catch (Exception ex) {
ex.printStackTrace();
}
return new JSONObject();
}
}

View File

@@ -0,0 +1,57 @@
package com.yizhuan.xchat_android_core.im.custom.bean;
import com.alibaba.fastjson.JSONObject;
import com.google.gson.Gson;
import com.netease.nimlib.sdk.chatroom.model.ChatRoomMessage;
import com.yizhuan.xchat_android_core.auth.AuthModel;
import com.yizhuan.xchat_android_core.room.bean.WelcomeInfo;
import lombok.Getter;
import lombok.Setter;
/**
* Created by lvzebiao on 2020/3/17.
*/
public class WelcomeAttachment extends CustomAttachment {
@Getter
@Setter
private WelcomeInfo welcomeInfo;
public WelcomeAttachment() {
super(CUSTOM_MSG_HEADER_TYPE_PUBLIC_SCREEN,
CUSTOM_MSG_SUB_TYPE_PUBLIC_SCREEN_WELCOME);
}
@Override
protected void parseData(JSONObject data) {
try {
welcomeInfo = new Gson().fromJson(data.toJSONString(), WelcomeInfo.class);
} catch (Exception ex) {
ex.printStackTrace();
}
}
@Override
protected JSONObject packData() {
try {
if (welcomeInfo != null) {
return JSONObject.parseObject(new Gson().toJson(welcomeInfo));
}
} catch (Exception ex) {
ex.printStackTrace();
}
return new JSONObject();
}
/**
* 判断下这条消息,对当前用户来说,需不需要添加到公屏
*
* @return -
*/
public boolean isNeedAddToMsg() {
return welcomeInfo != null && welcomeInfo.getTargetUid() > 0
&& welcomeInfo.getTargetUid() == AuthModel.get().getCurrentUid();
}
}

View File

@@ -66,8 +66,6 @@ public class MagicModel extends BaseModel implements IMagicModel {
api = RxNet.create(Api.class);
magicQueue = new ArrayList<>();
handler = new UiHandler(this);
// 获取服务器的魔法列表
getRemoteMagicList().subscribe();
}

View File

@@ -531,6 +531,9 @@ public final class AvRoomDataManager {
* @return -
*/
public int getMicPosition(long currentUid) {
if (AvRoomDataManager.get().isLeaveMode() && AvRoomDataManager.get().isRoomOwner(currentUid)) {
return -1;
}
int size = mMicQueueMemberMap.size();
for (int i = 0; i < size; i++) {
RoomQueueInfo roomQueueInfo = mMicQueueMemberMap.valueAt(i);

View File

@@ -5,6 +5,7 @@ import android.util.Log;
import com.alibaba.fastjson.JSONObject;
import com.google.gson.Gson;
import com.netease.nim.uikit.common.util.log.LogUtil;
import com.netease.nimlib.sdk.NIMClient;
import com.netease.nimlib.sdk.Observer;
import com.netease.nimlib.sdk.msg.MessageBuilder;
@@ -34,6 +35,7 @@ import com.yizhuan.xchat_android_core.miniworld.event.MWGroupChatMemberEvent;
import com.yizhuan.xchat_android_core.patriarch.bean.LimitNotice;
import com.yizhuan.xchat_android_core.patriarch.event.ImPushMsgPmLimitTimeEvent;
import com.yizhuan.xchat_android_core.pay.event.ChargeCustomNotificationEvent;
import com.yizhuan.xchat_android_core.pay.event.FirstRechargeEvent;
import com.yizhuan.xchat_android_core.statistic.StatisticManager;
import com.yizhuan.xchat_android_core.statistic.protocol.StatisticsProtocol;
@@ -270,6 +272,14 @@ public class IMSystemMsgManager {
EventBus.getDefault().post(new UnReadCountEvent(unReadCountAttachment.getTotal()));
}
break;
case CustomAttachment.CUSTOM_MSG_HEADER_TYPE_COMMON_SYS_NOTICATION:
//首充成功
if (subType == CustomAttachment.CUSTOM_MSG_SUB_TYPE_FIRST_RECHARGE_SUCCESS) {
EventBus.getDefault().post(new FirstRechargeEvent());
}
break;
}
}
}

View File

@@ -0,0 +1,16 @@
package com.yizhuan.xchat_android_core.msg.sysv2;
import lombok.Data;
/**
* Created by lvzebiao on 2020/3/28.
*/
@Data
public class ErbanSysMsgV2Component {
private String content;
private float fontSize;
private String fontColor;
private boolean fontBold;
private int routerType;
private String routerValue;
}

View File

@@ -0,0 +1,88 @@
package com.yizhuan.xchat_android_core.msg.sysv2;
import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;
import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;
import lombok.Data;
/**
* 以前23的协议照搬一套
* Created by lvzebiao on 28/03/2020.
*/
@Data
public class ErbanSysMsgV2Info implements Serializable{
/**
* 未处理
*/
public static final int STATE_UNTREATED = 1;
/**
* 已同意
*/
public static final int STATE_AGREE = 2;
/**
* 已拒绝
*/
public static final int STATE_REFUSED = 3;
/**
* 已过期
*/
public static final int STATE_OUT_DATE = 4;
/**
* 消息已过期
*/
public static final int MSG_HAS_EXPIRED = 7005;
/**
* 你被该家族拒绝
*/
public static final int FAMILY_HAS_REJECTED = 7003;
/**
* 你已经加入了该家族
*/
public static final int FAMILY_HAS_JOINED = 70002;
private String url;
private int state;
private int routerType;
private String routerValue;
private Map<String, String> params;
private String layout;
public static Map<String, Object> convertToMap(ErbanSysMsgV2Info sysMsgInfo) {
if (sysMsgInfo == null) {
return null;
}
Map<String, Object> localExtension = new HashMap<>();
localExtension.put("url", sysMsgInfo.getUrl());
localExtension.put("state", sysMsgInfo.getState());
localExtension.put("routerType", sysMsgInfo.getRouterType());
localExtension.put("routerValue", sysMsgInfo.getRouterValue());
localExtension.put("layout", sysMsgInfo.getLayout());
localExtension.put("params",new Gson().toJson(sysMsgInfo.getParams()));
return localExtension;
}
public static ErbanSysMsgV2Info convertMapToObject(Map<String, Object> localExtension) {
if (localExtension != null) {
ErbanSysMsgV2Info sysMsgInfo = new ErbanSysMsgV2Info();
sysMsgInfo.setUrl(String.valueOf(localExtension.get("url")));
sysMsgInfo.setState((Integer) localExtension.get("state"));
sysMsgInfo.setRouterType((Integer) localExtension.get("routerType"));
sysMsgInfo.setRouterValue((String) localExtension.get("routerValue"));
sysMsgInfo.setLayout((String) localExtension.get("layout"));
sysMsgInfo.setParams(new Gson().fromJson((String) localExtension.get("params"), new TypeToken<Map<String, String>>(){}.getType()));
return sysMsgInfo;
}
return null;
}
}

View File

@@ -0,0 +1,16 @@
package com.yizhuan.xchat_android_core.msg.sysv2;
import java.util.List;
import lombok.Data;
/**
* Created by lvzebiao on 2020/3/28.
*/
@Data
public class ErbanSysMsgV2Layout {
private ErbanSysMsgV2Component title;
private ErbanSysMsgV2Component time;
private List<ErbanSysMsgV2Component> contents;
}

View File

@@ -81,4 +81,14 @@ public interface IPayModel extends IModel {
String ticket);
Single<String> getSmsBindAli();
/**
* 是否首次充值
*/
Single<Boolean> isFirstCharge();
boolean isFirstChargeSuccess();
void setFirstChargeSuccess(boolean firstChargeSuccess);
}

View File

@@ -4,6 +4,7 @@ import android.content.Context;
import com.alibaba.fastjson.JSONObject;
import com.google.gson.JsonObject;
import com.netease.nim.uikit.common.util.log.LogUtil;
import com.yizhuan.xchat_android_core.auth.AuthModel;
import com.yizhuan.xchat_android_core.auth.event.LoginEvent;
import com.yizhuan.xchat_android_core.base.BaseModel;
@@ -15,6 +16,7 @@ import com.yizhuan.xchat_android_core.manager.RoomEvent;
import com.yizhuan.xchat_android_core.pay.bean.ChargeBean;
import com.yizhuan.xchat_android_core.pay.bean.WalletInfo;
import com.yizhuan.xchat_android_core.pay.event.ChargeCustomNotificationEvent;
import com.yizhuan.xchat_android_core.pay.event.FirstRechargeEvent;
import com.yizhuan.xchat_android_core.pay.event.GetWalletInfoEvent;
import com.yizhuan.xchat_android_core.pay.event.UpdateWalletInfoEvent;
import com.yizhuan.xchat_android_core.utils.net.RxHelper;
@@ -55,6 +57,8 @@ public class PayModel extends BaseModel implements IPayModel {
protected WalletInfo walletInfo;
private boolean firstChargeSuccess = false;
protected Api api = RxNet.create(Api.class);
private static final class Helper {
@@ -358,6 +362,29 @@ public class PayModel extends BaseModel implements IPayModel {
setCurrentWalletInfo(walletInfo);
}
/**
* 是否首次充值
*/
@Override
public Single<Boolean> isFirstCharge() {
return api.apiIsFirstCharge()
.compose(RxHelper.handleCommon());
}
@Subscribe(threadMode = ThreadMode.MAIN)
public void onFirstRechargeEvent(FirstRechargeEvent event) {
setFirstChargeSuccess(true);
}
@Override
public boolean isFirstChargeSuccess() {
return firstChargeSuccess;
}
@Override
public void setFirstChargeSuccess(boolean firstChargeSuccess) {
this.firstChargeSuccess = firstChargeSuccess;
}
public interface Api {
@@ -480,6 +507,12 @@ public class PayModel extends BaseModel implements IPayModel {
*/
@POST("/withDraw/verification/code")
Single<ServiceResult<String>> getSmsBindAli(@Query("uid") String uid);
/**
* 是否首次充值
*/
@GET("/chargeRecord/isFirstCharge")
Single<ServiceResult<Boolean>> apiIsFirstCharge();
}
}

View File

@@ -0,0 +1,7 @@
package com.yizhuan.xchat_android_core.pay.event;
/**
* create by lvzebiao @2020/3/23
*/
public class FirstRechargeEvent {
}

View File

@@ -0,0 +1,20 @@
package com.yizhuan.xchat_android_core.room.bean;
import lombok.Data;
/**
* create by lvzebiao @2020/3/18
*/
@Data
public class RoomWelcomeConfig {
/**
* toUid 是否为当前用户的粉丝
*/
private boolean isFans;
/**
* 欢迎语,${nick}为昵称占位符
*/
private String msg;
}

View File

@@ -0,0 +1,78 @@
package com.yizhuan.xchat_android_core.room.bean;
import android.text.TextUtils;
import com.netease.nim.uikit.common.util.log.LogUtil;
import lombok.Getter;
import lombok.Setter;
/**
* 公屏欢迎语
* Created by lvzebiao on 2020/3/17.
*/
@Setter
@Getter
public class WelcomeInfo {
/**
* 被欢迎人Uid
*/
private long targetUid;
/**
* 被欢迎人昵称
*/
private String targetNick;
/**
* 欢迎语
*/
private String content;
/**
* 用于标识 被欢迎人是否关注过 麦上用户
*/
private boolean isFans;
/**
* true 表示需要显示已关注按钮
*/
private boolean showAttentedBtn;
private boolean connecting;
private static final String NICK_FLAG = "${nick}";
public String getLastConent() {
String lastContent = null;
try {
if (!TextUtils.isEmpty(content) && content.contains(NICK_FLAG)) {
lastContent = content.substring(0, content.indexOf(NICK_FLAG));
}
} catch (Exception ex) {
ex.printStackTrace();
}
if (TextUtils.isEmpty(lastContent)) {
lastContent = "欢迎";
}
LogUtil.print("lastContent:" + lastContent);
return lastContent;
}
public String getNextContent() {
String nextContent = null;
try {
if (!TextUtils.isEmpty(content) && content.contains(NICK_FLAG)) {
nextContent = content.substring(content.indexOf(NICK_FLAG) + NICK_FLAG.length());
}
} catch (Exception ex) {
ex.printStackTrace();
}
if (nextContent == null) {
nextContent = "";
}
LogUtil.print("nextContent:" + nextContent);
return nextContent;
}
}

View File

@@ -33,6 +33,7 @@ import com.yizhuan.xchat_android_core.room.activitytimer.TimerBean;
import com.yizhuan.xchat_android_core.room.bean.ActivityInfo;
import com.yizhuan.xchat_android_core.room.bean.RoomInfo;
import com.yizhuan.xchat_android_core.room.bean.RoomResult;
import com.yizhuan.xchat_android_core.room.bean.RoomWelcomeConfig;
import com.yizhuan.xchat_android_core.room.bean.SearchRoomInfo;
import com.yizhuan.xchat_android_core.room.bean.SimplePartyRoomInfo;
import com.yizhuan.xchat_android_core.room.event.RoomInfoEvent;
@@ -539,4 +540,10 @@ public class AvRoomModel extends RoomBaseModel implements IAvRoomModel {
.compose(RxHelper.handleCommon())
.doOnSuccess(timerBean -> EventBus.getDefault().post(new ActivityTimerEvent(timerBean)));
}
@Override
public Single<RoomWelcomeConfig> getWelcomeConfig(long toUid) {
return mRoomService.apiGetWelcomeConfig(toUid)
.compose(RxHelper.handleCommon());
}
}

View File

@@ -29,6 +29,7 @@ import com.yizhuan.xchat_android_core.room.bean.ActivityInfo;
import com.yizhuan.xchat_android_core.room.bean.RoomInfo;
import com.yizhuan.xchat_android_core.room.bean.RoomResult;
import com.yizhuan.xchat_android_core.room.bean.RoomSettingTabInfo;
import com.yizhuan.xchat_android_core.room.bean.RoomWelcomeConfig;
import com.yizhuan.xchat_android_core.room.bean.SearchRoomInfo;
import com.yizhuan.xchat_android_core.room.bean.SimplePartyRoomInfo;
import com.yizhuan.xchat_android_core.room.giftvalue.helper.GiftValueMrg;
@@ -941,6 +942,9 @@ public class RoomBaseModel extends BaseModel implements IRoomBaseModel {
@GET("/activities/draw/getRoomRunawayTime")
Single<ServiceResult<TimerBean>> apiGetRoomActTimer(@Query("roomUid") long roomUid);
@GET("/welcome/room/msg/getOne")
Single<ServiceResult<RoomWelcomeConfig>> apiGetWelcomeConfig(@Query("toUid") long toUid);
}

View File

@@ -9,6 +9,7 @@ import com.yizhuan.xchat_android_core.room.activitytimer.TimerBean;
import com.yizhuan.xchat_android_core.room.bean.ActivityInfo;
import com.yizhuan.xchat_android_core.room.bean.RoomInfo;
import com.yizhuan.xchat_android_core.room.bean.RoomResult;
import com.yizhuan.xchat_android_core.room.bean.RoomWelcomeConfig;
import com.yizhuan.xchat_android_core.room.bean.SearchRoomInfo;
import com.yizhuan.xchat_android_core.room.bean.SimplePartyRoomInfo;
import com.yizhuan.xchat_android_library.net.rxnet.callback.CallBack;
@@ -130,4 +131,6 @@ public interface IAvRoomModel extends IModel {
Single<TimerBean> getRoomActTimer(long roomUid);
Single<RoomWelcomeConfig> getWelcomeConfig(long toUid);
}

View File

@@ -24,4 +24,6 @@ public interface ISettingsModel extends IModel {
Single<SysAccount> getSysAccount();
Single<String> interactiveMsgNotify(boolean interactiveMsgNotify);
}

View File

@@ -100,6 +100,12 @@ public class SettingsModel implements ISettingsModel {
.compose(RxHelper.handleCommon());
}
@Override
public Single<String> interactiveMsgNotify(boolean interactiveMsgNotify) {
return api.interactiveMsgNotify(AuthModel.get().getCurrentUid(), interactiveMsgNotify)
.compose(RxHelper.handleIgnoreData());
}
private interface Api {
/**
* @param uid
@@ -127,5 +133,9 @@ public class SettingsModel implements ISettingsModel {
@GET("client/prop")
Single<ServiceResult<SysAccount>> apiSysAccount();
@POST("user/interactiveMsgNotify")
Single<ServiceResult<JsonElement>> interactiveMsgNotify(@Query("uid") long uid,
@Query("interactiveMsgNotify") boolean interactiveMsgNotify);
}
}

View File

@@ -490,10 +490,29 @@ public class StatisticsProtocol {
EVENT_ROOM_ACTIVITY_ENTRANCE("room_activity_entrance"), //房间左上角活动入口-区分活动
EVENT_ROOM_ACTIVITY_ENTRANCE_B("room_activity_entrance_b"), //房间右下角活动入口-区分活动
//欢迎语
EVENT_ROOM_WELCOME_HIM("room_welcome_him"), //用户进房麦上用户点击“欢迎TA”的次数
EVENT_ROOM_FOLLOW_HIM("room_follow_him"), //收到欢迎语用户点击“关注TA”的次数
//1元首充
EVENT_ROOM_GIFT_ONEYUAN_ENTRANCE("room_gift_oneyuan_entrance"), //礼物面板_一元首充-区分入口
EVENT_INFORMATION_RANDOM_AVATAR("information_random_avatar"), //随机头像
EVENT_INFORMATION_RANDOM_NAME("information_random_name"), //随机昵称
EVENT_HOME_PUSH_INQUIRE("home_push_inquire"), //通知权限弹窗-区分-“立即开启”/“下次再说”
EVENT_ONE_CLICK_LOGIN("one_click_login"), // 一键登录
EVENT_ONE_CLICK_LOGIN_SUCCEED("one_click_login_succeed"), // 一键登录成功
EVENT_ONE_CLICK_LOGIN_FAILED("one_click_login_failed"), // 一键登录失败
EVENT_ONE_CLICK_LOGIN_CHANGE_ID("one_click_login_change_id"), // 一键登录-切换账号
//主播认证
EVENT_MY_OFFICIAL_ANCHOR("my_official_anchor"), //“我的”页面点击官方主播入口的次数
;
private String name;
private String name;
Event(String name) {
this.name = name;

View File

@@ -11,6 +11,7 @@ import com.yizhuan.xchat_android_core.user.bean.NewUserInfo;
import com.yizhuan.xchat_android_core.user.bean.GiftWallInfo;
import com.yizhuan.xchat_android_core.user.bean.UserGameInfo;
import com.yizhuan.xchat_android_core.user.bean.UserInfo;
import com.yizhuan.xchat_android_core.user.bean.UserRandomConfig;
import java.util.List;
@@ -140,7 +141,7 @@ public interface IUserModel extends IModel {
* @param newPwd
* @return
*/
Single<String> setPayPwd(String newPwd);
Single<String> setPayPwd(String newPwd, String payPwdCode);
/**
@@ -187,4 +188,22 @@ public interface IUserModel extends IModel {
Single<List<RoomHistoryInfo>> getInRoomRecord();
Single<ServiceResult> deleteInRoomRecord();
/**
*
* 随机头像昵称开关
*/
Single<UserRandomConfig> getRandomConfig();
/**
*
* 随机昵称
*/
Single<String> getRandomNick();
/**
*
* 随机头像
*/
Single<String> getRandomAvatar();
}

View File

@@ -23,6 +23,7 @@ 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.UserGameInfo;
import com.yizhuan.xchat_android_core.user.bean.UserInfo;
import com.yizhuan.xchat_android_core.user.bean.UserRandomConfig;
import com.yizhuan.xchat_android_core.user.event.CurrentUserInfoCompleteEvent;
import com.yizhuan.xchat_android_core.user.event.CurrentUserInfoCompleteFailEvent;
import com.yizhuan.xchat_android_core.user.event.LoadLoginUserInfoEvent;
@@ -591,11 +592,11 @@ public final class UserModel extends BaseModel implements IUserModel {
* @return
*/
@Override
public Single<String> setPayPwd(String newPwd) {
public Single<String> setPayPwd(String newPwd, String payPwdCode) {
String currentUid = String.valueOf(AuthModel.get().getCurrentUid());
String desNewPwd = DESUtils.DESAndBase64(newPwd);
String ticket = AuthModel.get().getTicket();
return api.setPayPwd(currentUid, desNewPwd, ticket)
return api.setPayPwd(currentUid, desNewPwd, ticket, payPwdCode)
.flatMap(new Function<ServiceResult<String>, SingleSource<String>>() {
@Override
public SingleSource<String> apply(ServiceResult<String> stringServiceResult) throws Exception {
@@ -722,6 +723,36 @@ public final class UserModel extends BaseModel implements IUserModel {
return api.deleteInRoomRecord(AuthModel.get().getCurrentUid()).compose(RxHelper.handleSchAndExce());
}
/**
*
* 随机头像昵称开关
*/
@Override
public Single<UserRandomConfig> getRandomConfig() {
return api.apiRandomConfig()
.compose(RxHelper.handleCommon());
}
/**
*
* 随机昵称
*/
@Override
public Single<String> getRandomNick() {
return api.apiRandomNick()
.compose(RxHelper.handleCommon());
}
/**
*
* 随机头像
*/
@Override
public Single<String> getRandomAvatar() {
return api.apiRandomAvatar()
.compose(RxHelper.handleCommon());
}
private interface Api {
/**
* 获取某个用户的用户信息
@@ -826,7 +857,8 @@ public final class UserModel extends BaseModel implements IUserModel {
@POST("user/paymentPasswd/reset")
Single<ServiceResult<String>> setPayPwd(@Query("uid") String uid,
@Query("newPasswd") String newPasswd,
@Query("ticket") String ticket);
@Query("ticket") String ticket,
@Query("code") String code);
/**
* 新秀玩友
@@ -896,5 +928,14 @@ public final class UserModel extends BaseModel implements IUserModel {
@POST("userroom/deleteInRoomRecord")
Single<ServiceResult> deleteInRoomRecord(@Query("uid") long uid);
@GET("/userRandom/getConfig")
Single<ServiceResult<UserRandomConfig>> apiRandomConfig();
@GET("/userRandom/getNickname")
Single<ServiceResult<String>> apiRandomNick();
@GET("/userRandom/getAvatar")
Single<ServiceResult<String>> apiRandomAvatar();
}
}

View File

@@ -35,6 +35,7 @@ public class BaseUserInfo implements Serializable {
* 贵族头饰
*/
private String micDecorate;
private UserInfo.NamePlate nameplate;
/**
* 判断是否为官方账号

View File

@@ -75,5 +75,7 @@ public class RecommendationUserInfo implements Serializable {
*/
private Integer onlineNum;
private int age;
private UserInfo.NamePlate nameplate;
}

View File

@@ -161,6 +161,17 @@ public class UserInfo implements Serializable {
@Setter
private String bankCardNumPlain;
/**
* 官方主播铭牌标识
*/
@Getter
@Setter
private NamePlate nameplate;
@Getter
@Setter
private String attestationBackPic;
public Location getUserExpand() {
return userExpand;
}
@@ -243,6 +254,8 @@ public class UserInfo implements Serializable {
public static String IS_OFFICIAL="official";
public static String DEF_USER = "defUser";
public static String HAS_PRETTY = "hasPrettyErbanNo";
public static String OAC_NAME = "officialAnchorCertificationName";
public static String OAC_ICON = "officialAnchorCertificationIcon";
@Getter
@Setter
@@ -526,6 +539,16 @@ public class UserInfo implements Serializable {
map.put(IS_NEW_USER, isNewUser());
map.put(DEF_USER, userInfo.getDefUser());
map.put(HAS_PRETTY, userInfo.isHasPrettyErbanNo());
// 官方认证文本,图标
if (userInfo.getNameplate() != null) {
map.put(OAC_NAME, userInfo.getNameplate().getFixedWord());
map.put(OAC_ICON, userInfo.getNameplate().getIconPic());
} else {
map.put(OAC_NAME, "");
map.put(OAC_ICON, "");
}
return map;
}
@@ -668,6 +691,20 @@ public class UserInfo implements Serializable {
*/
private boolean sysMsgNotify;
/**
* 互动消息通知true:提醒
*/
private boolean interactiveMsgNotify = true;
}
/**
* 官方主播认证铭牌
*/
@Data
public static class NamePlate{
private long id;
private String iconPic;
private String fixedWord;
}
public boolean isSuperAdmin() {

View File

@@ -0,0 +1,15 @@
package com.yizhuan.xchat_android_core.user.bean;
import lombok.Data;
/**
* create by lvzebiao @2020/3/20
*/
@Data
public class UserRandomConfig {
private boolean nick;
private boolean avatar;
}

View File

@@ -2,6 +2,8 @@ package com.yizhuan.xchat_android_core.utils;
import android.text.TextUtils;
import com.google.gson.Gson;
import com.netease.nim.uikit.common.util.log.LogUtil;
import com.netease.nimlib.sdk.chatroom.model.ChatRoomMember;
import com.netease.nimlib.sdk.chatroom.model.ChatRoomMessage;
import com.netease.nimlib.sdk.msg.constant.MsgTypeEnum;
@@ -88,4 +90,51 @@ public class ExtensionUtil {
return null;
}
private static final String KEY_IS_WELCOME = "is_welcome";
/**
* 判断聊天室消息本地字段 是否已经欢迎过了
*/
public static boolean isWelcomeLocal(ChatRoomMessage chatRoomMessage) {
try {
if (chatRoomMessage == null) {
return false;
}
Map<String, Object> localExt = chatRoomMessage.getLocalExtension();
if (localExt == null) {
LogUtil.print("isWelcomeLocal:localExt == null");
return false;
}
LogUtil.print("isWelcomeLocal:" + new Gson().toJson(localExt));
if (localExt.containsKey(KEY_IS_WELCOME)) {
Object objIsWelcome = localExt.get(KEY_IS_WELCOME);
if (objIsWelcome instanceof Boolean) {
return (boolean) objIsWelcome;
}
}
} catch (Exception ex) {
ex.printStackTrace();
}
return false;
}
/**
* 设置聊天室消息本地字段 是否已经欢迎过了
*/
public static void setWelcomeLocal(ChatRoomMessage chatRoomMessage, boolean welcome) {
try {
if (chatRoomMessage == null) {
return;
}
Map<String, Object> localExt = chatRoomMessage.getLocalExtension();
if (localExt == null) {
localExt = new HashMap<>();
}
localExt.put(KEY_IS_WELCOME, welcome);
chatRoomMessage.setLocalExtension(localExt);
LogUtil.print("setWelcomeLocal:" + new Gson().toJson(localExt));
} catch (Exception ex) {
ex.printStackTrace();
}
}
}