移除阿里云日志统计
This commit is contained in:
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -9,9 +9,6 @@ import com.netease.nim.uikit.common.util.log.LogUtil;
|
||||
import com.yizhuan.erban.base.BaseActivity;
|
||||
import com.yizhuan.xchat_android_core.linked.LinkedModel;
|
||||
import com.yizhuan.xchat_android_core.linked.bean.LinkedInfo;
|
||||
import com.yizhuan.xchat_android_core.statistic.LogFactory;
|
||||
import com.yizhuan.xchat_android_core.statistic.StatisticManager;
|
||||
import com.yizhuan.xchat_android_core.statistic.protocol.LogProtocol;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
@@ -71,15 +68,6 @@ public class MiddleActivity extends BaseActivity {
|
||||
}
|
||||
|
||||
linkedInfo.setInviteCode(inviteCode);
|
||||
//发送 log 到阿里
|
||||
StatisticManager.Instance().sendAliyunLog(LogFactory.create(
|
||||
LogProtocol.LogLevel.LEVEL_VERBOSE,
|
||||
LogProtocol.Topic.TOPIC_SYSTEM_LOG,
|
||||
LogProtocol.Event.EVENT_LINK_ME
|
||||
)
|
||||
.append("shareUid", uid)
|
||||
.append("channel", channel));
|
||||
|
||||
|
||||
LinkedModel.get().setLinkedInfo(linkedInfo);
|
||||
}
|
||||
|
@@ -3,23 +3,19 @@ package com.yizhuan.erban.avroom.activity;
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
|
||||
import androidx.databinding.DataBindingUtil;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.text.SpannableString;
|
||||
import android.text.TextUtils;
|
||||
import android.view.View;
|
||||
import android.view.inputmethod.InputMethodManager;
|
||||
import android.widget.CompoundButton;
|
||||
import android.widget.EditText;
|
||||
import android.widget.RelativeLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.databinding.DataBindingUtil;
|
||||
|
||||
import com.donkingliang.labels.LabelsView;
|
||||
import com.netease.nim.uikit.StatusBarUtil;
|
||||
import com.netease.nimlib.sdk.chatroom.ChatRoomMessageBuilder;
|
||||
import com.netease.nimlib.sdk.chatroom.model.ChatRoomMember;
|
||||
import com.netease.nimlib.sdk.chatroom.model.ChatRoomMessage;
|
||||
import com.yizhuan.erban.R;
|
||||
import com.yizhuan.erban.avroom.presenter.RoomSettingPresenter;
|
||||
@@ -275,8 +271,6 @@ public class RoomSettingActivity extends BaseMvpActivity<IRoomSettingView, RoomS
|
||||
roomInfo.getMgId())
|
||||
.compose(bindToLifecycle())
|
||||
.subscribe(observer);
|
||||
StatisticManager.Instance().sortLogFileByLastModified();
|
||||
|
||||
} else if (AvRoomDataManager.get().isRoomAdmin()) {
|
||||
model.updateByAdmin(roomInfo.getUid(), name, desc, roomInfo.getIntroduction(), pwd, label, id,
|
||||
AuthModel.get().getCurrentUid(),
|
||||
|
@@ -14,12 +14,10 @@ import com.google.gson.JsonElement;
|
||||
import com.google.gson.JsonObject;
|
||||
import com.google.gson.JsonParser;
|
||||
import com.google.gson.reflect.TypeToken;
|
||||
import com.netease.nim.uikit.common.util.log.LogUtil;
|
||||
import com.netease.nimlib.sdk.chatroom.model.ChatRoomInfo;
|
||||
import com.netease.nimlib.sdk.chatroom.model.ChatRoomMember;
|
||||
import com.netease.nimlib.sdk.chatroom.model.EnterChatRoomResultData;
|
||||
import com.netease.nimlib.sdk.util.Entry;
|
||||
import com.orhanobut.logger.Logger;
|
||||
import com.yizhuan.erban.avroom.activity.AVRoomActivity;
|
||||
import com.yizhuan.erban.avroom.view.IAvRoomView;
|
||||
import com.yizhuan.erban.base.BaseMvpPresenter;
|
||||
@@ -28,24 +26,18 @@ import com.yizhuan.xchat_android_core.auth.AuthModel;
|
||||
import com.yizhuan.xchat_android_core.bean.RoomMicInfo;
|
||||
import com.yizhuan.xchat_android_core.bean.RoomQueueInfo;
|
||||
import com.yizhuan.xchat_android_core.bean.response.ServiceResult;
|
||||
import com.yizhuan.xchat_android_core.channel_page.bean.HelloMessageInfo;
|
||||
import com.yizhuan.xchat_android_core.channel_page.model.ChannelPageModel;
|
||||
import com.yizhuan.xchat_android_core.home.bean.BannerInfo;
|
||||
import com.yizhuan.xchat_android_core.im.custom.bean.RoomPkBean;
|
||||
import com.yizhuan.xchat_android_core.manager.AudioEngineManager;
|
||||
import com.yizhuan.xchat_android_core.manager.AvRoomDataManager;
|
||||
import com.yizhuan.xchat_android_core.manager.EngineType;
|
||||
import com.yizhuan.xchat_android_core.manager.IMNetEaseManager;
|
||||
import com.yizhuan.xchat_android_core.manager.RoomEvent;
|
||||
import com.yizhuan.xchat_android_core.miniworld.event.AudioPartyOpenEvent;
|
||||
import com.yizhuan.xchat_android_core.module_hall.hall.HallModel;
|
||||
import com.yizhuan.xchat_android_core.module_hall.hall.bean.SuperAdminInfo;
|
||||
import com.yizhuan.xchat_android_core.monsterhunting.bean.MonsterInfo;
|
||||
import com.yizhuan.xchat_android_core.monsterhunting.model.MonsterHuntingModel;
|
||||
import com.yizhuan.xchat_android_core.patriarch.exception.PmRoomLimitException;
|
||||
import com.yizhuan.xchat_android_core.public_chat_hall.manager.PublicChatHallDataManager;
|
||||
import com.yizhuan.xchat_android_core.room.anotherroompk.RoomPKModel;
|
||||
import com.yizhuan.xchat_android_core.room.bean.RoomAudioSdkType;
|
||||
import com.yizhuan.xchat_android_core.room.bean.RoomInfo;
|
||||
import com.yizhuan.xchat_android_core.room.giftvalue.helper.GiftValueMrg;
|
||||
import com.yizhuan.xchat_android_core.room.model.AvRoomModel;
|
||||
@@ -53,9 +45,7 @@ import com.yizhuan.xchat_android_core.room.model.MicQueueModel;
|
||||
import com.yizhuan.xchat_android_core.room.queue.bean.MicMemberInfo;
|
||||
import com.yizhuan.xchat_android_core.room.queuing_mic.bean.QueuingMicMemeberInfo;
|
||||
import com.yizhuan.xchat_android_core.room.queuing_mic.event.QueuingMicNotEmptyEvent;
|
||||
import com.yizhuan.xchat_android_core.statistic.LogFactory;
|
||||
import com.yizhuan.xchat_android_core.statistic.StatisticManager;
|
||||
import com.yizhuan.xchat_android_core.statistic.protocol.LogProtocol;
|
||||
import com.yizhuan.xchat_android_core.statistic.protocol.StatisticsProtocol;
|
||||
import com.yizhuan.xchat_android_core.super_admin.SuperAdminDataMrg;
|
||||
import com.yizhuan.xchat_android_core.user.UserModel;
|
||||
@@ -69,7 +59,6 @@ import com.yizhuan.xchat_android_library.utils.JavaUtil;
|
||||
import com.yizhuan.xchat_android_library.utils.ListUtils;
|
||||
|
||||
import org.greenrobot.eventbus.EventBus;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@@ -84,7 +73,6 @@ import io.reactivex.Single;
|
||||
import io.reactivex.SingleSource;
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||
import io.reactivex.disposables.Disposable;
|
||||
import io.reactivex.functions.BiConsumer;
|
||||
import io.reactivex.functions.Consumer;
|
||||
import io.reactivex.functions.Function;
|
||||
import io.reactivex.schedulers.Schedulers;
|
||||
@@ -227,17 +215,6 @@ public class AvRoomPresenter extends BaseMvpPresenter<IAvRoomView> {
|
||||
|
||||
}
|
||||
|
||||
//进入房间失败发送阿里log
|
||||
StatisticManager.Instance().sendAliyunLog(LogFactory.create(
|
||||
LogProtocol.LogLevel.LEVEL_ERROR,
|
||||
LogProtocol.Topic.TOPIC_IM_LOG,
|
||||
LogProtocol.Event.EVENT_IM_CHANNEL
|
||||
)
|
||||
.append("roomUid", roomUid)
|
||||
.append("uid", String.valueOf(AuthModel.get().getCurrentUid()))
|
||||
.append("type", "1")
|
||||
.append("error", "{code:" + throwable.getMessage() + ", reason:" + error + "}"));
|
||||
|
||||
// 首页取消转圈圈
|
||||
IMNetEaseManager.get().getChatRoomEventObservable().onNext(new RoomEvent().setEvent(RoomEvent.ROOM_EXIT));
|
||||
}
|
||||
@@ -369,15 +346,6 @@ public class AvRoomPresenter extends BaseMvpPresenter<IAvRoomView> {
|
||||
if (getMvpView() != null) {
|
||||
getMvpView().showFinishRoomView(JavaUtil.str2long(uId));
|
||||
}
|
||||
//获取房间信息失败 发送log 到阿里
|
||||
StatisticManager.Instance().sendAliyunLog(LogFactory.create(
|
||||
LogProtocol.LogLevel.LEVEL_ERROR,
|
||||
LogProtocol.Topic.TOPIC_BUSINESS_LOG,
|
||||
LogProtocol.Event.EVENT_ROOM_GET
|
||||
)
|
||||
.append("targetUid", uId)
|
||||
.append("uid", String.valueOf(AuthModel.get().getCurrentUid()))
|
||||
.append("error", "{code:" + "" + " reason:" + " RoomInfo == null || RoomInfo.getRoomId() == 0" + "}"));
|
||||
return;
|
||||
}
|
||||
// 如果当前是排麦模式,就自己去拉一次排麦列表
|
||||
@@ -406,18 +374,6 @@ public class AvRoomPresenter extends BaseMvpPresenter<IAvRoomView> {
|
||||
if (getMvpView() != null) {
|
||||
getMvpView().requestRoomInfoFailView(RxHelper.createThrowable(roomResult));
|
||||
}
|
||||
|
||||
//获取房间信息失败 发送log 到阿里
|
||||
StatisticManager.Instance().sendAliyunLog(LogFactory.create(
|
||||
LogProtocol.LogLevel.LEVEL_ERROR,
|
||||
LogProtocol.Topic.TOPIC_BUSINESS_LOG,
|
||||
LogProtocol.Event.EVENT_ROOM_GET
|
||||
)
|
||||
.append("targetUid", uId)
|
||||
.append("uid", String.valueOf(AuthModel.get().getCurrentUid()))
|
||||
.append("error", "{code:" + roomResult.getCode()
|
||||
+ " reason:" + RxHelper.getValidMessage(roomResult) + "}"));
|
||||
|
||||
})
|
||||
.subscribe();
|
||||
}
|
||||
|
@@ -84,7 +84,6 @@ public class SplashActivity extends AppCompatActivity implements View.OnClickLis
|
||||
privacyAgreementDialog.setOnCallBack(this);
|
||||
privacyAgreementDialog.show();
|
||||
} else {
|
||||
XChatApplication.initOtherSDK();
|
||||
showSplash(false);
|
||||
}
|
||||
}
|
||||
|
@@ -1,12 +1,10 @@
|
||||
package com.yizhuan.erban.push;
|
||||
|
||||
import android.content.Context;
|
||||
import android.util.Log;
|
||||
|
||||
import com.meizu.cloud.pushsdk.platform.message.RegisterStatus;
|
||||
import com.netease.nimlib.sdk.mixpush.MeiZuPushReceiver;
|
||||
import com.orhanobut.logger.Logger;
|
||||
import com.yizhuan.xchat_android_core.statistic.StatisticManager;
|
||||
|
||||
/**
|
||||
* Created by lvzebiao on 2019/1/18.
|
||||
@@ -23,7 +21,6 @@ public class MeizuPushReceiver extends MeiZuPushReceiver {
|
||||
public void onRegisterStatus(Context context, RegisterStatus registerStatus) {
|
||||
super.onRegisterStatus(context, registerStatus);
|
||||
Logger.i("魅族推送ID:" + registerStatus.getPushId());
|
||||
StatisticManager.Instance().logToLocalFile("魅族推送ID:" + registerStatus.getPushId());
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -1,17 +1,14 @@
|
||||
package com.yizhuan.erban.push;
|
||||
|
||||
import android.content.Context;
|
||||
import android.util.Log;
|
||||
|
||||
import com.netease.nimlib.sdk.mixpush.MiPushMessageReceiver;
|
||||
import com.orhanobut.logger.Logger;
|
||||
import com.xiaomi.mipush.sdk.ErrorCode;
|
||||
import com.xiaomi.mipush.sdk.MiPushClient;
|
||||
import com.xiaomi.mipush.sdk.MiPushCommandMessage;
|
||||
import com.yizhuan.xchat_android_core.statistic.StatisticManager;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.logging.LogManager;
|
||||
|
||||
/**
|
||||
* Created by lvzebiao on 2019/1/18.
|
||||
@@ -31,9 +28,7 @@ public class MiPushReceiver extends MiPushMessageReceiver {
|
||||
if (message.getResultCode() == ErrorCode.SUCCESS) {
|
||||
String mRegID = arguments.get(0);
|
||||
Logger.i("小米推送mRegID:" + mRegID);
|
||||
StatisticManager.Instance().logToLocalFile("小米推送mRegID:" + mRegID);
|
||||
} else
|
||||
StatisticManager.Instance().logToLocalFile("小米推送mRegID_error:" + message.getReason());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -71,8 +71,6 @@ dependencies {
|
||||
compileOnly "org.projectlombok:lombok:${Lombok}"
|
||||
annotationProcessor "org.projectlombok:lombok:${Lombok}"
|
||||
|
||||
api 'com.aliyun.openservices:aliyun-log-android-sdk:0.4.0'
|
||||
|
||||
api fileTree(dir: 'share-sdk-libs', include: ['*.jar'])
|
||||
|
||||
// 支付
|
||||
|
@@ -1,13 +1,14 @@
|
||||
package com.yizhuan.xchat_android_core.manager;
|
||||
|
||||
import static com.yizhuan.xchat_android_constants.XChatConstants.SELECT_ANIM_DURATION;
|
||||
import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.*;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.graphics.BitmapFactory;
|
||||
import android.graphics.Color;
|
||||
import android.os.Handler;
|
||||
import android.text.SpannableStringBuilder;
|
||||
import android.text.Spanned;
|
||||
import android.text.TextUtils;
|
||||
import android.text.style.ForegroundColorSpan;
|
||||
import android.text.style.ImageSpan;
|
||||
import android.util.Log;
|
||||
import android.util.SparseArray;
|
||||
@@ -151,10 +152,8 @@ import com.yizhuan.xchat_android_core.share.bean.InAppSharingMiniWorldInfo;
|
||||
import com.yizhuan.xchat_android_core.share.bean.InAppSharingRoomInfo;
|
||||
import com.yizhuan.xchat_android_core.share.bean.InAppSharingTeamInfo;
|
||||
import com.yizhuan.xchat_android_core.share.bean.SessionType;
|
||||
import com.yizhuan.xchat_android_core.statistic.LogFactory;
|
||||
import com.yizhuan.xchat_android_core.statistic.StatLogKey;
|
||||
import com.yizhuan.xchat_android_core.statistic.StatisticManager;
|
||||
import com.yizhuan.xchat_android_core.statistic.protocol.LogProtocol;
|
||||
import com.yizhuan.xchat_android_core.statistic.protocol.StatisticsProtocol;
|
||||
import com.yizhuan.xchat_android_core.super_admin.SuperAdminDataMrg;
|
||||
import com.yizhuan.xchat_android_core.super_admin.attachment.SuperAdminOpAttachment;
|
||||
@@ -206,10 +205,6 @@ import io.reactivex.processors.PublishProcessor;
|
||||
import io.reactivex.schedulers.Schedulers;
|
||||
import io.reactivex.subjects.PublishSubject;
|
||||
|
||||
import static com.yizhuan.xchat_android_constants.XChatConstants.SELECT_ANIM_DURATION;
|
||||
import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.*;
|
||||
import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MSG_SUB_FANS_TEAM_EXIT;
|
||||
|
||||
/**
|
||||
* <p>云信聊天室管理,一个全局的Model </p>
|
||||
*
|
||||
@@ -438,17 +433,6 @@ public final class IMNetEaseManager {
|
||||
account = (String) extension.get("account");
|
||||
userIdKick = (String) extension.get(StatLogKey.USER_ID_KICK);
|
||||
}
|
||||
|
||||
//写日志
|
||||
StatisticManager.Instance().logToLocalFileAndSendAliyun(LogFactory.create(
|
||||
LogProtocol.LogLevel.LEVEL_VERBOSE,
|
||||
LogProtocol.Topic.TOPIC_IM_LOG,
|
||||
LogProtocol.Event.EVENT_IM_KICKED)
|
||||
.append(StatLogKey.ROOM_ID, AvRoomDataManager.get().mCurrentRoomInfo != null ?
|
||||
String.valueOf(AvRoomDataManager.get().mCurrentRoomInfo.getRoomId()) : "")
|
||||
.append(StatLogKey.USER_ID_KICK, userIdKick)
|
||||
.append(StatLogKey.USER_ID_KICKED, account));
|
||||
|
||||
if (AvRoomDataManager.get().mCurrentRoomInfo != null) {
|
||||
//通知服务端该用户要退出房间
|
||||
model.quitUserRoomV2().subscribe();
|
||||
@@ -508,15 +492,6 @@ public final class IMNetEaseManager {
|
||||
|
||||
StatisticManager.Instance().onEvent(BasicConfig.INSTANCE.getAppContext(),
|
||||
StatisticsProtocol.EVENT_RECONNECTION_ROOM_CHAT, "重连聊天室事", parans);
|
||||
|
||||
StatisticManager.Instance().sendAliyunLog(LogFactory.create(
|
||||
LogProtocol.LogLevel.LEVEL_VERBOSE,
|
||||
LogProtocol.Topic.TOPIC_IM_LOG,
|
||||
LogProtocol.Event.EVENT_IM_CHANNEL)
|
||||
.append("roomUid", roomInfo != null ? String.valueOf(roomInfo.getUid()) : "")
|
||||
.append("uid", String.valueOf(AuthModel.get().getCurrentUid()))
|
||||
.append("type", "3"));
|
||||
|
||||
} else if (chatRoomStatusChangeData.status.wontAutoLogin()) {
|
||||
MLog.info(TAG, "需要重新登录(被踢或验证信息错误)...");
|
||||
|
||||
|
@@ -29,23 +29,15 @@ import com.yizhuan.xchat_android_core.manager.IMNetEaseManager;
|
||||
import com.yizhuan.xchat_android_core.public_chat_hall.manager.PublicChatHallDataManager;
|
||||
import com.yizhuan.xchat_android_core.public_chat_hall.model.PublicChatHallModel;
|
||||
import com.yizhuan.xchat_android_core.retry.ImRetryManager;
|
||||
import com.yizhuan.xchat_android_core.retry.RetryChatRoomMessage;
|
||||
import com.yizhuan.xchat_android_core.room.bean.RoomInfo;
|
||||
import com.yizhuan.xchat_android_core.statistic.LogFactory;
|
||||
import com.yizhuan.xchat_android_core.statistic.StatLogKey;
|
||||
import com.yizhuan.xchat_android_core.statistic.StatisticManager;
|
||||
import com.yizhuan.xchat_android_core.statistic.protocol.LogProtocol;
|
||||
import com.yizhuan.xchat_android_core.user.UserModel;
|
||||
import com.yizhuan.xchat_android_core.user.bean.UserInfo;
|
||||
import com.yizhuan.xchat_android_library.net.rxnet.callback.CallBack;
|
||||
import com.yizhuan.xchat_android_library.utils.ListUtils;
|
||||
import com.yizhuan.xchat_android_library.utils.TimeUtils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import io.reactivex.Single;
|
||||
import io.reactivex.functions.Consumer;
|
||||
|
||||
/**
|
||||
* @author jack
|
||||
@@ -183,32 +175,6 @@ public class GiftToolbox {
|
||||
GiftModel.get().onSendRoomMessageSuccess(message);
|
||||
// 插入到公屏上
|
||||
IMNetEaseManager.get().addMessagesImmediately(message);
|
||||
//礼物消息发送成功回调
|
||||
StatisticManager.Instance().sendAliyunLog(LogFactory.create(
|
||||
LogProtocol.LogLevel.LEVEL_VERBOSE,
|
||||
LogProtocol.Topic.TOPIC_BUSINESS_LOG,
|
||||
LogProtocol.Event.EVENT_GIFT_CHANNEL
|
||||
)
|
||||
.append("result", "true")
|
||||
.append(StatLogKey.ROOM_ID, String.valueOf(roomInfo.getRoomId()))
|
||||
.append("senderUid", String.valueOf(giftReceiveInfo.getUid()))
|
||||
.append("receiveUid", String.valueOf(giftReceiveInfo.getTargetUid()))
|
||||
.append("number", String.valueOf(giftReceiveInfo.getGiftNum()))
|
||||
.append("send_time", TimeUtils.getCurrentTimeStr()));
|
||||
})
|
||||
.doOnError(throwable -> {
|
||||
//礼物消息发送失败后回调
|
||||
StatisticManager.Instance().sendAliyunLog(LogFactory.create(
|
||||
LogProtocol.LogLevel.LEVEL_ERROR,
|
||||
LogProtocol.Topic.TOPIC_BUSINESS_LOG,
|
||||
LogProtocol.Event.EVENT_GIFT_CHANNEL
|
||||
)
|
||||
.append("result", "false")
|
||||
.append(StatLogKey.ROOM_ID, String.valueOf(roomInfo.getRoomId()))
|
||||
.append("senderUid", String.valueOf(giftReceiveInfo.getUid()))
|
||||
.append("receiveUid", String.valueOf(giftReceiveInfo.getTargetUid()))
|
||||
.append("number", String.valueOf(giftReceiveInfo.getGiftNum()))
|
||||
.append("send_time", TimeUtils.getCurrentTimeStr()));
|
||||
})
|
||||
.subscribe();
|
||||
|
||||
@@ -254,32 +220,6 @@ public class GiftToolbox {
|
||||
GiftModel.get().onSendRoomMessageSuccess(message);
|
||||
// 插入到公屏上
|
||||
IMNetEaseManager.get().addMessagesImmediately(message);
|
||||
//礼物消息发送成功回调
|
||||
StatisticManager.Instance().sendAliyunLog(LogFactory.create(
|
||||
LogProtocol.LogLevel.LEVEL_VERBOSE,
|
||||
LogProtocol.Topic.TOPIC_BUSINESS_LOG,
|
||||
LogProtocol.Event.EVENT_GIFT_CHANNEL
|
||||
)
|
||||
.append("result", "true")
|
||||
.append(StatLogKey.ROOM_ID, String.valueOf(roomInfo.getRoomId()))
|
||||
.append("senderUid", String.valueOf(data.getUid()))
|
||||
.append("receiveUid", new Gson().toJson(data.getTargetUsers()))
|
||||
.append("number", String.valueOf(data.getGiftNum()))
|
||||
.append("send_time", TimeUtils.getCurrentTimeStr()));
|
||||
})
|
||||
.doOnError(throwable -> {
|
||||
//礼物消息发送失败后回调
|
||||
StatisticManager.Instance().sendAliyunLog(LogFactory.create(
|
||||
LogProtocol.LogLevel.LEVEL_ERROR,
|
||||
LogProtocol.Topic.TOPIC_BUSINESS_LOG,
|
||||
LogProtocol.Event.EVENT_GIFT_CHANNEL
|
||||
)
|
||||
.append("result", "false")
|
||||
.append(StatLogKey.ROOM_ID, String.valueOf(roomInfo.getRoomId()))
|
||||
.append("senderUid", String.valueOf(data.getUid()))
|
||||
.append("receiveUid", new Gson().toJson(data.getTargetUsers()))
|
||||
.append("number", String.valueOf(data.getGiftNum()))
|
||||
.append("send_time", TimeUtils.getCurrentTimeStr()));
|
||||
})
|
||||
.subscribe();
|
||||
|
||||
@@ -318,32 +258,6 @@ public class GiftToolbox {
|
||||
GiftModel.get().onSendRoomMessageSuccess(message);
|
||||
// 插入到公屏上
|
||||
IMNetEaseManager.get().addMessagesImmediately(message);
|
||||
//礼物消息发送成功回调
|
||||
StatisticManager.Instance().sendAliyunLog(LogFactory.create(
|
||||
LogProtocol.LogLevel.LEVEL_VERBOSE,
|
||||
LogProtocol.Topic.TOPIC_BUSINESS_LOG,
|
||||
LogProtocol.Event.EVENT_GIFT_CHANNEL
|
||||
)
|
||||
.append("result", "true")
|
||||
.append(StatLogKey.ROOM_ID, String.valueOf(roomInfo.getRoomId()))
|
||||
.append("senderUid", String.valueOf(giftReceiveInfo.getUid()))
|
||||
.append("receiveUid", String.valueOf(giftReceiveInfo.getTargetUids()))
|
||||
.append("number", String.valueOf(giftReceiveInfo.getGiftNum()))
|
||||
.append("send_time", TimeUtils.getCurrentTimeStr()));
|
||||
})
|
||||
.doOnError(throwable -> {
|
||||
//礼物消息发送失败后回调
|
||||
StatisticManager.Instance().sendAliyunLog(LogFactory.create(
|
||||
LogProtocol.LogLevel.LEVEL_ERROR,
|
||||
LogProtocol.Topic.TOPIC_BUSINESS_LOG,
|
||||
LogProtocol.Event.EVENT_GIFT_CHANNEL
|
||||
)
|
||||
.append("result", "false")
|
||||
.append(StatLogKey.ROOM_ID, String.valueOf(roomInfo.getRoomId()))
|
||||
.append("senderUid", String.valueOf(giftReceiveInfo.getUid()))
|
||||
.append("receiveUid", String.valueOf(giftReceiveInfo.getTargetUids()))
|
||||
.append("number", String.valueOf(giftReceiveInfo.getGiftNum()))
|
||||
.append("send_time", TimeUtils.getCurrentTimeStr()));
|
||||
})
|
||||
.subscribe();
|
||||
}
|
||||
|
@@ -1,5 +1,10 @@
|
||||
package com.yizhuan.xchat_android_core.monsterhunting.model;
|
||||
|
||||
import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MSG_HEADER_TYPE_MONSTER_HUNTING;
|
||||
import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MSG_SUB_TYPE_MONSTER_HUNTING;
|
||||
import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_NOTI_SUB_GAME_END;
|
||||
import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_NOTI_SUB_GAME_RESULT;
|
||||
|
||||
import android.os.CountDownTimer;
|
||||
import android.os.Handler;
|
||||
import android.os.Message;
|
||||
@@ -18,13 +23,12 @@ import com.netease.nimlib.sdk.msg.model.BroadcastMessage;
|
||||
import com.orhanobut.logger.Logger;
|
||||
import com.yizhuan.xchat_android_core.auth.AuthModel;
|
||||
import com.yizhuan.xchat_android_core.base.BaseModel;
|
||||
import com.yizhuan.xchat_android_core.manager.IMNetEaseManager;
|
||||
import com.yizhuan.xchat_android_library.rxbus.RxBusHelper;
|
||||
import com.yizhuan.xchat_android_library.utils.ListUtils;
|
||||
import com.yizhuan.xchat_android_core.bean.BaseProtocol;
|
||||
import com.yizhuan.xchat_android_core.bean.response.ServiceResult;
|
||||
import com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment;
|
||||
import com.yizhuan.xchat_android_core.im.custom.bean.MonsterAttackAttachment;
|
||||
import com.yizhuan.xchat_android_core.manager.AvRoomDataManager;
|
||||
import com.yizhuan.xchat_android_core.manager.IMNetEaseManager;
|
||||
import com.yizhuan.xchat_android_core.manager.RoomEvent;
|
||||
import com.yizhuan.xchat_android_core.monsterhunting.bean.MonsterAttackInfo;
|
||||
import com.yizhuan.xchat_android_core.monsterhunting.bean.MonsterHuntingResult;
|
||||
@@ -32,12 +36,9 @@ import com.yizhuan.xchat_android_core.monsterhunting.bean.MonsterInfo;
|
||||
import com.yizhuan.xchat_android_core.monsterhunting.bean.MonsterProtocol;
|
||||
import com.yizhuan.xchat_android_core.monsterhunting.rxevent.MonsterUpdateEvent;
|
||||
import com.yizhuan.xchat_android_core.room.bean.RoomInfo;
|
||||
import com.yizhuan.xchat_android_core.statistic.LogFactory;
|
||||
import com.yizhuan.xchat_android_core.statistic.StatisticManager;
|
||||
import com.yizhuan.xchat_android_core.statistic.protocol.LogProtocol;
|
||||
import com.yizhuan.xchat_android_core.bean.response.ServiceResult;
|
||||
|
||||
import com.yizhuan.xchat_android_library.net.rxnet.RxNet;
|
||||
import com.yizhuan.xchat_android_library.rxbus.RxBusHelper;
|
||||
import com.yizhuan.xchat_android_library.utils.ListUtils;
|
||||
|
||||
import java.lang.ref.WeakReference;
|
||||
import java.util.ArrayList;
|
||||
@@ -54,11 +55,6 @@ import retrofit2.http.GET;
|
||||
import retrofit2.http.POST;
|
||||
import retrofit2.http.Query;
|
||||
|
||||
import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MSG_HEADER_TYPE_MONSTER_HUNTING;
|
||||
import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MSG_SUB_TYPE_MONSTER_HUNTING;
|
||||
import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_NOTI_SUB_GAME_END;
|
||||
import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_NOTI_SUB_GAME_RESULT;
|
||||
|
||||
/**
|
||||
* Created by MadisonRong on 29/03/2018.
|
||||
*/
|
||||
@@ -343,18 +339,6 @@ public class MonsterHuntingModel extends BaseModel implements IMonsterHuntingMod
|
||||
data = monsterProtocol.getData();
|
||||
//列表存在这个怪兽就刷新,没有就添加
|
||||
refreshMonster(data);
|
||||
|
||||
//怪兽出现大log
|
||||
StatisticManager.Instance().sendAliyunLog(LogFactory.create(
|
||||
LogProtocol.LogLevel.LEVEL_VERBOSE,
|
||||
LogProtocol.Topic.TOPIC_BUSINESS_LOG,
|
||||
LogProtocol.Event.EVENT_MONSTER_WILL_APPEAR
|
||||
).append(LogProtocol.CommonKey.KEY_UID.getName(), String.valueOf(AuthModel.get().getCurrentUid()))
|
||||
.append("monsterId",String.valueOf(data.getMonsterId()))
|
||||
.append("monsterStatus",String.valueOf(data.getMonsterStatus()))
|
||||
.append("beforeAppearSeconds",String.valueOf(data.getBeforeAppearSeconds())));
|
||||
|
||||
|
||||
break;
|
||||
case CUSTOM_NOTI_SUB_GAME_END:
|
||||
// 对于 172, 只处理怪兽逃跑的情况
|
||||
|
@@ -3,8 +3,8 @@ package com.yizhuan.xchat_android_core.room.model;
|
||||
import android.annotation.SuppressLint;
|
||||
import android.text.TextUtils;
|
||||
|
||||
import com.google.gson.JsonElement;
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.JsonElement;
|
||||
import com.netease.nimlib.sdk.AbortableFuture;
|
||||
import com.netease.nimlib.sdk.NIMChatRoomSDK;
|
||||
import com.netease.nimlib.sdk.RequestCallback;
|
||||
@@ -19,16 +19,13 @@ import com.yizhuan.xchat_android_core.auth.AuthModel;
|
||||
import com.yizhuan.xchat_android_core.bean.response.ServiceResult;
|
||||
import com.yizhuan.xchat_android_core.decoration.car.bean.CarInfo;
|
||||
import com.yizhuan.xchat_android_core.decoration.headwear.bean.HeadWearInfo;
|
||||
import com.yizhuan.xchat_android_core.home.bean.BannerInfo;
|
||||
import com.yizhuan.xchat_android_core.home.bean.HomeRoomInfo;
|
||||
import com.yizhuan.xchat_android_core.level.UserLevelVo;
|
||||
import com.yizhuan.xchat_android_core.manager.AvRoomDataManager;
|
||||
import com.yizhuan.xchat_android_core.manager.IMNetEaseManager;
|
||||
import com.yizhuan.xchat_android_core.manager.RoomEvent;
|
||||
import com.yizhuan.xchat_android_core.noble.NobleInfo;
|
||||
|
||||
import com.yizhuan.xchat_android_core.patriarch.exception.PmRoomLimitException;
|
||||
|
||||
import com.yizhuan.xchat_android_core.room.activitytimer.ActivityTimerEvent;
|
||||
import com.yizhuan.xchat_android_core.room.activitytimer.TimerBean;
|
||||
import com.yizhuan.xchat_android_core.room.bean.BroadcastInfo;
|
||||
@@ -41,14 +38,12 @@ import com.yizhuan.xchat_android_core.room.event.RoomInfoEvent;
|
||||
import com.yizhuan.xchat_android_core.room.giftvalue.helper.GiftValueMrg;
|
||||
import com.yizhuan.xchat_android_core.room.model.inteface.IAvRoomModel;
|
||||
import com.yizhuan.xchat_android_core.room.pk.model.PkModel;
|
||||
import com.yizhuan.xchat_android_core.statistic.LogFactory;
|
||||
import com.yizhuan.xchat_android_core.statistic.StatisticManager;
|
||||
import com.yizhuan.xchat_android_core.statistic.protocol.LogProtocol;
|
||||
import com.yizhuan.xchat_android_core.statistic.protocol.StatisticsProtocol;
|
||||
import com.yizhuan.xchat_android_core.super_admin.bean.KickOutExtBean;
|
||||
import com.yizhuan.xchat_android_core.super_admin.util.SuperAdminUtil;
|
||||
import com.yizhuan.xchat_android_core.user.UserModel;
|
||||
import com.yizhuan.xchat_android_core.user.bean.UserInfo;
|
||||
import com.yizhuan.xchat_android_core.super_admin.util.SuperAdminUtil;
|
||||
import com.yizhuan.xchat_android_core.utils.net.RxHelper;
|
||||
import com.yizhuan.xchat_android_library.net.rxnet.callback.CallBack;
|
||||
import com.yizhuan.xchat_android_library.utils.JavaUtil;
|
||||
@@ -66,10 +61,8 @@ import java.util.concurrent.TimeUnit;
|
||||
import io.reactivex.Observable;
|
||||
import io.reactivex.ObservableOnSubscribe;
|
||||
import io.reactivex.Single;
|
||||
import io.reactivex.SingleSource;
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||
import io.reactivex.functions.Consumer;
|
||||
import io.reactivex.functions.Function;
|
||||
import io.reactivex.observers.DisposableObserver;
|
||||
import io.reactivex.schedulers.Schedulers;
|
||||
|
||||
@@ -223,17 +216,6 @@ public class AvRoomModel extends RoomBaseModel implements IAvRoomModel {
|
||||
if (currentRoom == null) {
|
||||
String errorMsg = "退出房间 RoomInfo = null 没有房间信息";
|
||||
callBack.onFail(0, errorMsg);
|
||||
|
||||
//退出房间失败 发送阿里log
|
||||
StatisticManager.Instance().sendAliyunLog(LogFactory.create(
|
||||
LogProtocol.LogLevel.LEVEL_ERROR,
|
||||
LogProtocol.Topic.TOPIC_IM_LOG,
|
||||
LogProtocol.Event.EVENT_IM_CHANNEL
|
||||
)
|
||||
.append("roomUid", "")
|
||||
.append("uid", String.valueOf(uid))
|
||||
.append("type", "2")
|
||||
.append(LogProtocol.CommonKey.KEY_ERROR.getName(), errorMsg + "(" + 0 + ")"));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -272,16 +254,6 @@ public class AvRoomModel extends RoomBaseModel implements IAvRoomModel {
|
||||
|
||||
if (callBack != null) {
|
||||
callBack.onSuccess(currentRoom);
|
||||
|
||||
//退出房间成功 发送阿里log
|
||||
StatisticManager.Instance().sendAliyunLog(LogFactory.create(
|
||||
LogProtocol.LogLevel.LEVEL_VERBOSE,
|
||||
LogProtocol.Topic.TOPIC_IM_LOG,
|
||||
LogProtocol.Event.EVENT_IM_CHANNEL
|
||||
)
|
||||
.append("roomUid", roomId)
|
||||
.append("uid", String.valueOf(uid))
|
||||
.append("type", "2"));
|
||||
}
|
||||
quitUserRoomV2().subscribe(new DisposableObserver<String>() {
|
||||
@Override
|
||||
|
@@ -1,57 +0,0 @@
|
||||
package com.yizhuan.xchat_android_core.statistic;
|
||||
|
||||
import androidx.annotation.Keep;
|
||||
|
||||
/**
|
||||
* <p> </p>
|
||||
*
|
||||
* @author jiahui
|
||||
* date 2018/3/14
|
||||
*/
|
||||
@Keep
|
||||
class AliyunLogToken {
|
||||
|
||||
/**
|
||||
* accessKeyId : STS.MDzVBubQb9AH3fTm9at8rwgmi
|
||||
* accessKeySecret : 564Fd92CzheEgtpaVdHCHrPQXy9HFtCxWxReeYBRoZ4J
|
||||
* securityToken : CAIS/wF1q6Ft5B2yfSjIrIfPHfjBj45DjoOjMUDliTk0eLdemKLGizz2IH1JenVhAOscs/41nmhR7/4flqd4T55IQ1DzbOxr2c8Rq1tw0Us8cYjng4YfgbiJREKxaXeiruKwDsz9SNTCAITPD3nPii50x5bjaDymRCbLGJaViJlhHL91N0vCGlggPtpNIRZ4o8I3LGbYMe3XUiTnmW3NFkFlyGEe4CFdkf3gn5TFukSP0g2jm7ZL+dTLT8L6P5U2DvBWSMyo2eF6TK3F3RNL5gJCnKUM1/EZp2uW54rHXgMLuU3farKJ6KdmKA5oe640BqpAqP/zj/p8t7bDSyktSuGz24oagAEaNCrLNAMsilquiqJWPJEl1+PJRM14P/AvwexdKl4gvHKRe8UdBoxrXDN4TSyqL11wws7A9+9j+b76GBU3y7qjGQqKtjEIegi3J6ThdQAIrYlQj/E1uaOzNp6TJy1swu/Cs6gxT/UZ1AFiRVf0Lprshh/RDf9NZCwYHTDDmAIEkA==
|
||||
* expiration : 2018-03-14T04:00:17Z
|
||||
*/
|
||||
|
||||
private String accessKeyId;
|
||||
private String accessKeySecret;
|
||||
private String securityToken;
|
||||
private String expiration;
|
||||
|
||||
public String getAccessKeyId() {
|
||||
return accessKeyId;
|
||||
}
|
||||
|
||||
public void setAccessKeyId(String accessKeyId) {
|
||||
this.accessKeyId = accessKeyId;
|
||||
}
|
||||
|
||||
public String getAccessKeySecret() {
|
||||
return accessKeySecret;
|
||||
}
|
||||
|
||||
public void setAccessKeySecret(String accessKeySecret) {
|
||||
this.accessKeySecret = accessKeySecret;
|
||||
}
|
||||
|
||||
public String getSecurityToken() {
|
||||
return securityToken;
|
||||
}
|
||||
|
||||
public void setSecurityToken(String securityToken) {
|
||||
this.securityToken = securityToken;
|
||||
}
|
||||
|
||||
public String getExpiration() {
|
||||
return expiration;
|
||||
}
|
||||
|
||||
public void setExpiration(String expiration) {
|
||||
this.expiration = expiration;
|
||||
}
|
||||
}
|
@@ -1,33 +0,0 @@
|
||||
package com.yizhuan.xchat_android_core.statistic;
|
||||
|
||||
import com.yizhuan.xchat_android_core.statistic.protocol.LogProtocol;
|
||||
|
||||
/**
|
||||
* @author jiajie
|
||||
* @Description
|
||||
* @Date 2018/4/12
|
||||
*/
|
||||
|
||||
public class LogFactory {
|
||||
|
||||
/**
|
||||
* 构建log
|
||||
* @param level
|
||||
* @param topic
|
||||
* @param event
|
||||
* @return
|
||||
*/
|
||||
public static LogWrapper create(LogProtocol.LogLevel level, LogProtocol.Topic topic, LogProtocol.Event event){
|
||||
LogWrapper log = new LogWrapper();
|
||||
if (level != null){
|
||||
log.PutContent(LogProtocol.CommonKey.KEY_LOG_LEVEL.getName(), String.valueOf(level.getLevel()));
|
||||
}
|
||||
if (topic != null){
|
||||
log.PutContent(LogProtocol.CommonKey.KEY_TOPIC.getName(), topic.getName());
|
||||
}
|
||||
if (event != null){
|
||||
log.PutContent(LogProtocol.CommonKey.KEY_EVENT_ID.getName(), event.getName());
|
||||
}
|
||||
return log;
|
||||
}
|
||||
}
|
@@ -1,109 +0,0 @@
|
||||
package com.yizhuan.xchat_android_core.statistic;
|
||||
|
||||
import androidx.annotation.Keep;
|
||||
|
||||
import com.orhanobut.logger.Logger;
|
||||
import com.yizhuan.xchat_android_library.utils.FileUtils;
|
||||
import com.yizhuan.xchat_android_library.utils.TimeUtils;
|
||||
import com.yizhuan.xchat_android_library.utils.ZipUtils;
|
||||
import com.yizhuan.xchat_android_library.utils.config.BasicConfig;
|
||||
import com.yizhuan.xchat_android_library.utils.file.StorageUtils;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.Arrays;
|
||||
import java.util.Comparator;
|
||||
|
||||
/**
|
||||
* <p>日志文件操作 </p>
|
||||
*
|
||||
* @author jiahui
|
||||
* date 2018/3/2
|
||||
*/
|
||||
@Keep
|
||||
final class LogFile {
|
||||
private static final int MAX_LOG_FILE = 7;
|
||||
private static final String PREFIXION = "erban-";
|
||||
private static final String SUFFIX = ".log";
|
||||
private static final String SUFFIX_ZIP = ".zip";
|
||||
private static final String ZIP_PREFIXION = "erban-android-log";
|
||||
|
||||
private static String getLogStrFile() {
|
||||
return PREFIXION + TimeUtils.getCurrentDateStr() + SUFFIX;
|
||||
}
|
||||
|
||||
private static String getLogZipStrFile() {
|
||||
return ZIP_PREFIXION + TimeUtils.getCurrentDateStr() + SUFFIX_ZIP;
|
||||
}
|
||||
|
||||
private static File getLogFile() throws IOException {
|
||||
File logFile = new File(BasicConfig.INSTANCE.getAppLogDir(), getLogStrFile());
|
||||
if (!logFile.exists()) {
|
||||
boolean newFile = logFile.createNewFile();
|
||||
Logger.d("创建日志文件:" + logFile.getAbsolutePath() + (newFile ? "成功" : "失败"));
|
||||
}
|
||||
|
||||
return logFile;
|
||||
}
|
||||
|
||||
static void writeLog(String logContent) throws IOException {
|
||||
FileUtils.write(getLogFile(), logContent);
|
||||
}
|
||||
|
||||
/**
|
||||
* 对日志文件进行最后修改时间排序
|
||||
*
|
||||
* @return 排序后的文件
|
||||
*/
|
||||
static File[] sortLogFileByLastModified() {
|
||||
File dir = BasicConfig.INSTANCE.getAppLogDir();
|
||||
if (dir == null || !dir.isDirectory() || !dir.exists()) return null;
|
||||
File[] listFiles = dir.listFiles();
|
||||
Arrays.sort(listFiles, new LogFileComparator());
|
||||
return listFiles;
|
||||
}
|
||||
|
||||
/***
|
||||
* 删除多余7个日志文件
|
||||
*/
|
||||
static boolean deleteLogFiles() {
|
||||
File[] listFiles = sortLogFileByLastModified();
|
||||
if (listFiles != null && listFiles.length > MAX_LOG_FILE) {
|
||||
File deleteFile;
|
||||
for (int i = 0; i < listFiles.length; i++) {
|
||||
if (i > 6) {
|
||||
deleteFile = listFiles[i];
|
||||
if (deleteFile.exists()) {
|
||||
boolean delete = deleteFile.delete();
|
||||
if (delete)
|
||||
Logger.d("删除多余7个日志记录文件成功:" + deleteFile.getAbsolutePath());
|
||||
return delete;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* 压缩logs日志下的文件
|
||||
*
|
||||
* @return 最终压缩路径
|
||||
*/
|
||||
static String zipLogFiles() {
|
||||
deleteLogFiles();
|
||||
File logZipFile = StorageUtils.getCacheDirectory(BasicConfig.INSTANCE.getAppContext(), getLogZipStrFile());
|
||||
return ZipUtils.zipFolder(BasicConfig.INSTANCE.getAppLogDir().getAbsolutePath(), logZipFile.getAbsolutePath());
|
||||
}
|
||||
|
||||
private static class LogFileComparator implements Comparator<File> {
|
||||
|
||||
@Override
|
||||
public int compare(File o1, File o2) {
|
||||
if (o1.lastModified() > o2.lastModified()) return -1;
|
||||
else if (o1.lastModified() < o2.lastModified()) return 1;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@@ -1,263 +0,0 @@
|
||||
package com.yizhuan.xchat_android_core.statistic;
|
||||
|
||||
import android.os.Build;
|
||||
import android.os.Handler;
|
||||
import android.os.Message;
|
||||
import android.text.TextUtils;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.aliyun.sls.android.sdk.ClientConfiguration;
|
||||
import com.aliyun.sls.android.sdk.LOGClient;
|
||||
import com.aliyun.sls.android.sdk.LogException;
|
||||
import com.aliyun.sls.android.sdk.SLSLog;
|
||||
import com.aliyun.sls.android.sdk.core.auth.StsTokenCredentialProvider;
|
||||
import com.aliyun.sls.android.sdk.core.callback.CompletedCallback;
|
||||
import com.aliyun.sls.android.sdk.model.LogGroup;
|
||||
import com.aliyun.sls.android.sdk.request.PostLogRequest;
|
||||
import com.aliyun.sls.android.sdk.result.PostLogResult;
|
||||
import com.aliyun.sls.android.sdk.utils.IPService;
|
||||
import com.orhanobut.logger.Logger;
|
||||
import com.yizhuan.xchat_android_constants.XChatConstants;
|
||||
import com.yizhuan.xchat_android_core.bean.response.ServiceResult;
|
||||
import com.yizhuan.xchat_android_core.room.model.AvRoomModel;
|
||||
import com.yizhuan.xchat_android_core.statistic.protocol.LogProtocol;
|
||||
import com.yizhuan.xchat_android_library.BuildConfig;
|
||||
import com.yizhuan.xchat_android_library.net.rxnet.RxNet;
|
||||
import com.yizhuan.xchat_android_library.utils.DeviceUuidFactory;
|
||||
import com.yizhuan.xchat_android_library.utils.SystemUtils;
|
||||
import com.yizhuan.xchat_android_library.utils.VersionUtil;
|
||||
import com.yizhuan.xchat_android_library.utils.config.BasicConfig;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.lang.ref.WeakReference;
|
||||
import java.util.Map;
|
||||
|
||||
import io.reactivex.Single;
|
||||
import io.reactivex.SingleOnSubscribe;
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||
import io.reactivex.schedulers.Schedulers;
|
||||
import retrofit2.http.GET;
|
||||
|
||||
/**
|
||||
* @author jiajie
|
||||
* @Description
|
||||
* @Date 2018/4/12
|
||||
*/
|
||||
|
||||
class LogModel {
|
||||
private final String endpoint = "https://cn-qingdao.log.aliyuncs.com";
|
||||
private final String project = XChatConstants.ALIYUN_LOG_NAME;
|
||||
private final String logStore = XChatConstants.ALIYUN_LOG_STORE;
|
||||
|
||||
private static final String SERVICE_ERROR = "服务器异常";
|
||||
|
||||
private AliyunLogToken mAliyunLogToken;
|
||||
|
||||
private String sourceIP;
|
||||
|
||||
|
||||
private static class IPHandler extends Handler {
|
||||
private WeakReference<LogModel> mWeakReference;
|
||||
|
||||
private IPHandler(LogModel logModel) {
|
||||
mWeakReference = new WeakReference<>(logModel);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleMessage(Message msg) {
|
||||
super.handleMessage(msg);
|
||||
switch (msg.what) {
|
||||
case IPService.HANDLER_MESSAGE_GETIP_CODE:
|
||||
LogModel logModel = mWeakReference.get();
|
||||
if (logModel != null){
|
||||
logModel.sourceIP = (String) msg.obj;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
LogModel() {
|
||||
IPHandler handler = new IPHandler(this);
|
||||
IPService.getInstance().asyncGetIp(IPService.DEFAULT_URL, handler);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 发送到阿里日志
|
||||
* @param log
|
||||
*/
|
||||
void sendAliyunLog(LogWrapper log) {
|
||||
//尝试注释掉阿里上传的代码
|
||||
// if (mAliyunLogToken != null) {
|
||||
// asyncUploadAliyunLog(mAliyunLogToken, log);
|
||||
// } else
|
||||
// RxNet.create(Api.class)
|
||||
// .getAliyunToken()
|
||||
// .subscribeOn(Schedulers.io())
|
||||
// .map(ServiceResult::getData)
|
||||
// .filter(aliyunLogToken -> aliyunLogToken != null)
|
||||
// .observeOn(AndroidSchedulers.mainThread())
|
||||
// .subscribe(aliyunLogToken -> asyncUploadAliyunLog(aliyunLogToken, log));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 异步上传日志
|
||||
* @param aliyunLogToken
|
||||
* @param log
|
||||
*/
|
||||
private void asyncUploadAliyunLog(AliyunLogToken aliyunLogToken, LogWrapper log) {
|
||||
mAliyunLogToken = aliyunLogToken;
|
||||
|
||||
String sts_ak = aliyunLogToken.getAccessKeyId();
|
||||
String sts_sk = aliyunLogToken.getAccessKeySecret();
|
||||
String sts_token = aliyunLogToken.getSecurityToken();
|
||||
StsTokenCredentialProvider credentialProvider =
|
||||
new StsTokenCredentialProvider(sts_ak, sts_sk, sts_token);
|
||||
ClientConfiguration conf = new ClientConfiguration();
|
||||
// 连接超时,默认15秒
|
||||
conf.setConnectionTimeout(15 * 1000);
|
||||
// socket超时,默认15秒
|
||||
conf.setSocketTimeout(15 * 1000);
|
||||
// 最大并发请求书,默认5个
|
||||
conf.setMaxConcurrentRequest(5);
|
||||
// 失败后最大重试次数,默认2次
|
||||
conf.setMaxErrorRetry(2);
|
||||
|
||||
if (BuildConfig.DEBUG) {
|
||||
// log打印在控制台
|
||||
SLSLog.enableLog();
|
||||
}
|
||||
|
||||
LOGClient logClient = new LOGClient(endpoint, credentialProvider, conf);
|
||||
LogGroup logGroup = new LogGroup(log.GetContent().get(LogProtocol.CommonKey.KEY_TOPIC.getName()).toString(),
|
||||
TextUtils.isEmpty(sourceIP) ? "no ip" : sourceIP);
|
||||
log.GetContent().remove(LogProtocol.CommonKey.KEY_TOPIC.getName());
|
||||
log.PutContent(LogProtocol.CommonKey.KEY_APP_VERSION.getName(), VersionUtil.getLocalName(BasicConfig.INSTANCE.getAppContext()));
|
||||
log.PutContent(LogProtocol.CommonKey.KEY_OS.getName(), "android");
|
||||
log.PutContent(LogProtocol.CommonKey.KEY_OS_VERSION.getName(), Build.VERSION.RELEASE);
|
||||
log.PutContent(LogProtocol.CommonKey.KEY_DEVICE_ID.getName(), DeviceUuidFactory.getDeviceId(BasicConfig.INSTANCE.getAppContext()));
|
||||
log.PutContent(LogProtocol.CommonKey.KEY_PHONE_MODEL.getName(), SystemUtils.getPhoneModel());
|
||||
log.PutContent(LogProtocol.CommonKey.KEY_IP.getName(), TextUtils.isEmpty(sourceIP) ? "no ip" : sourceIP);
|
||||
|
||||
logGroup.PutLog(log);
|
||||
try {
|
||||
PostLogRequest request = new PostLogRequest(project, logStore, logGroup);
|
||||
logClient.asyncPostLog(request, new CompletedCallback<PostLogRequest, PostLogResult>() {
|
||||
@Override
|
||||
public void onSuccess(PostLogRequest request, PostLogResult result) {
|
||||
if (result.getStatusCode() == 200)
|
||||
Logger.i("发送阿里云日志成功:" + result);
|
||||
// else asyncUploadAliyunLog(aliyunLogToken, log, sourceIp, topic);
|
||||
// todo token失效处理
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(PostLogRequest request, LogException exception) {
|
||||
Logger.i("发送阿里云日志失败:" + exception);
|
||||
exception.printStackTrace();
|
||||
}
|
||||
});
|
||||
} catch (LogException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Sts方式上传
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
private Single<Boolean> uploadAliyunLog(AliyunLogToken aliyunLogToken, LogWrapper log, String sourceIp) {
|
||||
return Single.create(e -> {
|
||||
String sts_ak = aliyunLogToken.getAccessKeyId();
|
||||
String sts_sk = aliyunLogToken.getAccessKeySecret();
|
||||
String STS_TOKEN = aliyunLogToken.getSecurityToken();
|
||||
StsTokenCredentialProvider credentialProvider =
|
||||
new StsTokenCredentialProvider(sts_ak, sts_sk, STS_TOKEN);
|
||||
ClientConfiguration conf = new ClientConfiguration();
|
||||
// 连接超时,默认15秒
|
||||
conf.setConnectionTimeout(15 * 1000);
|
||||
// socket超时,默认15秒
|
||||
conf.setSocketTimeout(15 * 1000);
|
||||
// 最大并发请求书,默认5个
|
||||
conf.setMaxConcurrentRequest(5);
|
||||
// 失败后最大重试次数,默认2次
|
||||
conf.setMaxErrorRetry(2);
|
||||
// log打印在控制台
|
||||
SLSLog.enableLog();
|
||||
LOGClient logClient = new LOGClient(endpoint, sts_ak, sts_sk, project);
|
||||
/* 创建logGroup */
|
||||
LogGroup logGroup = new LogGroup("enban_log", TextUtils.isEmpty(sourceIp) ? "no ip" : sourceIp);
|
||||
logGroup.PutLog(log);
|
||||
try {
|
||||
logClient.PostLog(logGroup, logStore);
|
||||
e.onSuccess(true);
|
||||
} catch (Exception ex) {
|
||||
e.onError(ex);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 写本地日志
|
||||
* @param log
|
||||
*/
|
||||
void logToLocalFile(LogWrapper log) {
|
||||
if (log == null || log.GetContent().size() < 1) return;
|
||||
logToLocalFile(JSON.toJSONString(log));
|
||||
}
|
||||
|
||||
void logToLocalFile(final String logContent) {
|
||||
Single.create((SingleOnSubscribe<Boolean>) e -> {
|
||||
try {
|
||||
LogFile.writeLog(logContent);
|
||||
Logger.d("写入日志成功:" + logContent);
|
||||
} catch (IOException ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
}).subscribeOn(Schedulers.io()).subscribe();
|
||||
}
|
||||
|
||||
/**
|
||||
* 本地日志按 最后修改排序
|
||||
*/
|
||||
void sortLogFileByLastModified() {
|
||||
Single.create((SingleOnSubscribe<Boolean>) e -> LogFile.sortLogFileByLastModified())
|
||||
.subscribeOn(Schedulers.io()).subscribe();
|
||||
}
|
||||
/**
|
||||
* 压缩本地日志文件
|
||||
*
|
||||
* @return 订阅对象
|
||||
*/
|
||||
Single<String> zipLogFiles() {
|
||||
return Single.create((SingleOnSubscribe<String>) e -> {
|
||||
String logFiles = LogFile.zipLogFiles();
|
||||
e.onSuccess(logFiles);
|
||||
}).subscribeOn(Schedulers.io());
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除本地日志
|
||||
* @return
|
||||
*/
|
||||
Single<Boolean> deleteLogFiles() {
|
||||
return Single.create((SingleOnSubscribe<Boolean>) e ->
|
||||
e.onSuccess(LogFile.deleteLogFiles())).subscribeOn(Schedulers.io());
|
||||
}
|
||||
|
||||
interface Api {
|
||||
/**
|
||||
* 获取阿里token
|
||||
* @return
|
||||
*/
|
||||
@GET("aliyun/log/gettoken")
|
||||
Single<ServiceResult<AliyunLogToken>> getAliyunToken();
|
||||
}
|
||||
}
|
@@ -1,21 +0,0 @@
|
||||
package com.yizhuan.xchat_android_core.statistic;
|
||||
|
||||
import com.aliyun.sls.android.sdk.model.Log;
|
||||
|
||||
/**
|
||||
* @author jiajie
|
||||
* @Description
|
||||
* @Date 2018/4/12
|
||||
*/
|
||||
|
||||
public class LogWrapper extends Log {
|
||||
|
||||
LogWrapper() {
|
||||
super();
|
||||
}
|
||||
|
||||
public LogWrapper append(String key, String value){
|
||||
super.PutContent(key,value);
|
||||
return this;
|
||||
}
|
||||
}
|
@@ -1,23 +1,14 @@
|
||||
package com.yizhuan.xchat_android_core.statistic;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.Context;
|
||||
|
||||
import androidx.annotation.Keep;
|
||||
import android.text.TextUtils;
|
||||
|
||||
import com.netease.nim.uikit.common.util.log.LogUtil;
|
||||
import com.orhanobut.logger.Logger;
|
||||
import com.yizhuan.xchat_android_core.file.FileModel;
|
||||
import com.yizhuan.xchat_android_core.statistic.protocol.LogProtocol;
|
||||
import com.yizhuan.xchat_android_core.statistic.protocol.StatisticsProtocol;
|
||||
import com.yizhuan.xchat_android_library.BuildConfig;
|
||||
import com.yizhuan.xchat_android_library.utils.config.BasicConfig;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.Map;
|
||||
|
||||
import io.reactivex.Single;
|
||||
|
||||
/**
|
||||
* <p> 统计接口管理 </p>
|
||||
*
|
||||
@@ -31,12 +22,10 @@ public class StatisticManager {
|
||||
private volatile static StatisticManager mInstance;
|
||||
|
||||
private final StatisticModel mStatisticModel;
|
||||
private final LogModel mLogModel;
|
||||
|
||||
|
||||
private StatisticManager() {
|
||||
mStatisticModel = new StatisticModel();
|
||||
mLogModel = new LogModel();
|
||||
}
|
||||
|
||||
public static StatisticManager Instance() {
|
||||
@@ -103,60 +92,4 @@ public class StatisticManager {
|
||||
|
||||
/*********************************************统计方法 end *********************************************/
|
||||
|
||||
|
||||
/*********************************************日志方法 begin *********************************************/
|
||||
|
||||
/**
|
||||
* 向阿里云发送日志
|
||||
* @param log
|
||||
*
|
||||
*/
|
||||
public void sendAliyunLog(LogWrapper log) {
|
||||
if (BuildConfig.DEBUG){
|
||||
Logger.d("log info:{ topic=%1$s,log= %2$s} ", log.GetContent().get(LogProtocol.CommonKey.KEY_TOPIC.getName()),
|
||||
log.GetContent().toString());
|
||||
} else{
|
||||
mLogModel.sendAliyunLog(log);
|
||||
}
|
||||
}
|
||||
|
||||
public void logToLocalFile(String logContent) {
|
||||
mLogModel.logToLocalFile(logContent);
|
||||
}
|
||||
|
||||
public void logToLocalFileAndSendAliyun(LogWrapper log) {
|
||||
mLogModel.logToLocalFile(log);
|
||||
sendAliyunLog(log);
|
||||
}
|
||||
|
||||
/**
|
||||
* 日志按最后修改时间降序排序
|
||||
*/
|
||||
public void sortLogFileByLastModified() {
|
||||
mLogModel.sortLogFileByLastModified();
|
||||
}
|
||||
|
||||
@SuppressLint("CheckResult")
|
||||
public void uploadLog2QiNiu() {
|
||||
mLogModel.zipLogFiles()
|
||||
.filter(s -> !TextUtils.isEmpty(s) && new File(s).exists())
|
||||
.toSingle()
|
||||
.flatMap(s -> FileModel.get().uploadFile(s))
|
||||
.subscribe(s -> {
|
||||
Logger.i("上传七牛日志成功回调:" + s);
|
||||
File file = new File(s);
|
||||
if (file.exists()) {
|
||||
boolean delete = file.delete();
|
||||
if (delete) Logger.e("删除上传日志本地文件成功!");
|
||||
}
|
||||
},
|
||||
Throwable::printStackTrace);
|
||||
}
|
||||
|
||||
public Single<Boolean> deleteLogFiles() {
|
||||
return mLogModel.deleteLogFiles();
|
||||
}
|
||||
|
||||
|
||||
/*********************************************日志方法 begin *********************************************/
|
||||
}
|
||||
|
@@ -1,148 +0,0 @@
|
||||
package com.yizhuan.xchat_android_core.statistic.protocol;
|
||||
|
||||
/**
|
||||
* @author jiajie
|
||||
* @Description
|
||||
* @Date 2018/4/12
|
||||
*/
|
||||
|
||||
public class LogProtocol {
|
||||
|
||||
/**
|
||||
* 日志级别
|
||||
*/
|
||||
public enum LogLevel{
|
||||
LEVEL_VERBOSE(1),
|
||||
LEVEL_DEBUG(2),
|
||||
LEVEL_INFO(3),
|
||||
LEVEL_WARN(4),
|
||||
LEVEL_ERROR(5);
|
||||
|
||||
private int level;
|
||||
|
||||
LogLevel(int level) {
|
||||
this.level = level;
|
||||
}
|
||||
|
||||
public int getLevel() {
|
||||
return level;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 话题枚举
|
||||
*/
|
||||
public enum Topic {
|
||||
TOPIC_SYSTEM_LOG("SystemLog"),
|
||||
TOPIC_IM_LOG("IMLog"),
|
||||
TOPIC_AUDIO_LOG("AudioLog"),
|
||||
TOPIC_SOCIALIZATION_LOG("SocializationLog"),
|
||||
TOPIC_OTHER_SDK_LOG("OtherSDKLog"),
|
||||
TOPIC_BUSINESS_LOG("BusinessLog"),
|
||||
TOPIC_MONSTER_LOG("MonsterLog");
|
||||
|
||||
private String name;
|
||||
|
||||
Topic(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 事件枚举
|
||||
*/
|
||||
public enum Event {
|
||||
//1.系统 ->(SystemLog)
|
||||
EVENT_APNS("APNs"), //远程离线推送 text(内容)
|
||||
EVENT_LINK_ME("LinkMe"),//深度链接(必要) shareUid(分享的uid),channel
|
||||
EVENT_MEMORY_WARNING("MemoryWarning"),// 内存警告 uid,model(设备型号)
|
||||
EVENT_NULL_CRASH("NullCrash"),//空指针崩溃 data(Json)
|
||||
|
||||
//2.IM(目前是云信)->(IMLog)
|
||||
EVENT_IM_LOGIN("ImLogin"),//IM登录---uid
|
||||
EVENT_IM_FRIEND("ImFriend"), //IM好友关系 ---uid/frienduid
|
||||
EVENT_IM_MESSAGE("ImMessage"), //IM消息(当前只记录礼物与表情的自定义消息发送与接收)-----text/first/second
|
||||
EVENT_IM_CHANNEL("ImChannel"), //IM聊天室(必要)---roomUid(房主uid) / uid/type(1:进频道 2:出频道 3:重连)
|
||||
EVENT_IM_KICK("ImKick"), //聊天室主动踢人(必要)---handleUid(操作者uid)/uid(被踢的uid) room_id
|
||||
EVENT_IM_KICKED("ImKicked"), //聊天室接收到踢人消息(被动)(必要)---handleUid(操作者uid)/uid(被踢的uid) room_id
|
||||
|
||||
//3.音频(目前是声网) ->(AudioLog)
|
||||
EVENT_AUDIO_SDK("AudioSDK"), //音频SDK问题(声网) error(错误描述)
|
||||
EVENT_AUDIO_CHANNEL("AudioChannel"),//音频频道(声网)(必要) uid (用户uid)/type(1:进频道 2:出频道3:重连)/room_id (频道名)
|
||||
|
||||
//4.社会化分享(目前是ShareSDK) ->(SocializationLog)
|
||||
EVENT_SHARE("Share"),//分享(必要) type(微信=1 QQ=2)uid(分享出去的uid)
|
||||
|
||||
//5.其他SDK ->(OtherSDKLog)
|
||||
EVENT_REALM("Realm"),//Realm数据库 error(错误描述)
|
||||
EVENT_WCDB("WCDB"),//WCDB数据库 error(错误描述)
|
||||
|
||||
|
||||
//6.业务(事件)->(BussinessLog)
|
||||
EVENT_GIFT_P2P("Gift_P2P"),//单聊送礼物 senderUid(发送者的uid)/receiveUid(接收者的uid)
|
||||
EVENT_GIFT_CHANNEL("Gift_channel"), //聊天室送礼物 senderUid(发送者的uid)/receiveUid(接收者的uid),room_id,number,result(发送结果):true or false,send_time(客户端发送时间)
|
||||
EVENT_PURSE("Purse"),//钱包(必要) uid
|
||||
EVENT_NOBLE("Noble"),//贵族 type(购买=1 续费=2)/uid
|
||||
EVENT_REGISTER("Register"),//注册(必要) uid
|
||||
EVENT_LOGIN("Login"),//用户登录(必要) uid
|
||||
EVENT_VERIFY_CODE("VerifyCode"),//收到的手机验证码(必要) verifyCode(收到的手机验证码)
|
||||
EVENT_FILL_USER_DATA("FillUserData"), //补全资料 text(补全资料传参的json)
|
||||
EVENT_MONSTER_WILL_APPEAR("Monster_willAppear"), // 打怪兽-怪兽即将出现
|
||||
EVENT_MONSTER_GAME_RESULT("Monster_gameResult"), // 打怪兽-怪兽结果
|
||||
EVENT_MONSTER_ONGOING_MONSTER("Monster_onGoingMonster"), // 打怪兽正在攻击中的怪兽信息
|
||||
EVENT_ROOM_GET("room_get") //获取房间信息失败 targetUid, uid, error
|
||||
;
|
||||
|
||||
private String name;
|
||||
|
||||
Event(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 固定通用的key名称
|
||||
*/
|
||||
public enum CommonKey{
|
||||
KEY_LOG_LEVEL("LogLevel"),
|
||||
KEY_IP("ip"),
|
||||
KEY_DEVICE_ID("device_id"),
|
||||
KEY_PHONE_MODEL("model"),
|
||||
KEY_OS("OS"),
|
||||
KEY_OS_VERSION("OSVersion"),
|
||||
KEY_APP_VERSION("AppVersion"),
|
||||
KEY_TOPIC("__topic__"),
|
||||
KEY_EVENT_ID("event_id"),
|
||||
|
||||
KEY_ERROR("error"),
|
||||
KEY_SUCCESS("success"),
|
||||
|
||||
|
||||
KEY_UID("uid"),
|
||||
KEY_ROOM_ID("room_id"),
|
||||
KEY_HANDLE_UID("handleUid"),
|
||||
|
||||
;
|
||||
|
||||
private String name;
|
||||
|
||||
CommonKey(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user