Commit a9ff09f1 by 刘鹏

feat: 登录模块日志

parent 68c46651
......@@ -8,7 +8,7 @@ ext {
"m-confide" : "0.0.49.02",
"m-consultant" : "0.0.59.66",
"m-fm" : "0.0.30.01",
"m-user" : "0.0.61.18",
"m-user" : "0.0.61.23",
"m-home" : "0.0.22.55",
"m-im" : "0.0.18.45",
"m-dynamic" : "0.0.7.19",
......@@ -91,7 +91,7 @@ ext {
"m-confide" : "0.0.49.02",
"m-consultant" : "0.0.59.66",
"m-fm" : "0.0.30.01",
"m-user" : "0.0.61.18",
"m-user" : "0.0.61.23",
"m-home" : "0.0.22.54",
"m-im" : "0.0.18.45",
"m-dynamic" : "0.0.7.19",
......
......@@ -6,6 +6,8 @@ import com.tencent.bugly.crashreport.CrashReport
import com.ydl.ydlcommon.data.http.RxUtils
import com.ydl.ydlcommon.utils.ActivityManager
import com.ydl.ydlcommon.utils.BuryPointUtils
import com.ydl.ydlnet.utils.log.AliYunLogConfig
import com.ydl.ydlnet.utils.log.AliYunLogHelper
import com.yidianling.common.tools.LogUtil
import com.yidianling.im.api.bean.IMLoginInfo
import com.yidianling.im.api.bean.IMRequestCallback
......@@ -57,16 +59,22 @@ object LoginUtils {
val info = IMLoginInfo(userInfo?.uid ?: "", userInfo?.hxpwd ?: "")
val callback = object : IMRequestCallback<IMLoginInfo> {
override fun onSuccess(t: IMLoginInfo?) {
LogUtil.e("IM登录成功:"+"info.account:"+info.account+"info.passWord"+info.passWord)
LogUtil.e("IM登录成功:" + "info.account:" + info.account + "info.passWord" + info.passWord)
UserIn.imSetAccount(userInfo?.uid ?: "")
AliYunLogHelper.getInstance().sendLog(AliYunLogConfig.LOGIN, "IM登录成功")
}
override fun onFailed(i: Int) {
LogUtil.e("IM登录失败:$i"+"info.account:"+info.account+"info.passWord"+info.passWord)
LogUtil.e("IM登录失败:$i" + "info.account:" + info.account + "info.passWord" + info.passWord)
AliYunLogHelper.getInstance().sendLog(AliYunLogConfig.LOGIN, "IM登录失败")
}
override fun onException(throwable: Throwable?) {
LogUtil.e("IM登录onException:${throwable?.message}")
AliYunLogHelper.getInstance()
.sendLog(AliYunLogConfig.LOGIN, "IM登录onException:${throwable?.message}")
}
}
......@@ -90,6 +98,7 @@ object LoginUtils {
@JvmStatic
fun logoutClearLocal() {
AliYunLogHelper.getInstance().sendLog(AliYunLogConfig.LOGIN, "退出登录")
UserIn.imLogout()
UserIn.closePlayer()
UserIn.clearImData()
......@@ -105,7 +114,7 @@ object LoginUtils {
ActivityManager.finishAll()
if (StatusUtils.isFirstLogin && StatusUtils.isFirstStartApp) {
activity.startActivity(Intent(activity, CollectSexAndBirthActivity::class.java))
}else {
} else {
UserIn.mainIntent(activity)
}
} else {//需要判断stack中是否有MainActivity
......
......@@ -15,6 +15,8 @@ import com.ydl.ydlcommon.utils.ActivityManager
import com.ydl.ydlcommon.utils.UserInfoCache
import com.ydl.ydlcommon.utils.actionutil.ActionCountUtils
import com.ydl.ydlcommon.utils.remind.ToastHelper
import com.ydl.ydlnet.utils.log.AliYunLogConfig
import com.ydl.ydlnet.utils.log.AliYunLogHelper
import com.yidianling.im.api.bean.IMLoginInfo
import com.yidianling.im.api.bean.IMRequestCallback
import com.yidianling.user.LoginUtils
......@@ -136,7 +138,10 @@ class SmsLoginActivity : BaseActivity() {
return
}
ActionCountUtils.count(UserBIConstants.POSITION_LOGIN_CLICK, UserBIConstants.ACTION_TYPE_CODE_LOGIN)
ActionCountUtils.count(
UserBIConstants.POSITION_LOGIN_CLICK,
UserBIConstants.ACTION_TYPE_CODE_LOGIN
)
Log.e("短信验证码:", code + " - " + phoneNum + " - " + et_code.text.toString());
loginSub = userHttp.login(LoginParam(code, phoneNum, null, 2, et_code.text.toString()))
......@@ -152,8 +157,12 @@ class SmsLoginActivity : BaseActivity() {
if (it.firstLogin == 1) {
StatusUtils.isFirstLogin = true
baiduActionBury()
}else {
ActionCountUtils.countUid(UserBIConstants.POSITION_LOGIN_SUCCESS_CLICK,it.uid!!,UserBIConstants.ACTION_TYPE_CODE_LOGIN)
} else {
ActionCountUtils.countUid(
UserBIConstants.POSITION_LOGIN_SUCCESS_CLICK,
it.uid!!,
UserBIConstants.ACTION_TYPE_CODE_LOGIN
)
}
// ActivityManager.finishActivity(LoginActivity::class.java)
// if (ActivityManager.getActivitySize() <= 1) {
......@@ -161,10 +170,15 @@ class SmsLoginActivity : BaseActivity() {
// }
// finish()
LoginUtils.loginSuccessOperate(this)
AliYunLogHelper.getInstance()
.sendLog(AliYunLogConfig.LOGIN, "短信验证码 成功")
}, object : ThrowableConsumer() {
override fun accept(msg: String) {
dismissProgressDialog()
YdlCommonOut.showToast(msg)
AliYunLogHelper.getInstance()
.sendLog(AliYunLogConfig.LOGIN, "短信验证码 失败 msg:$msg ")
}
})
}
......@@ -224,9 +238,11 @@ class SmsLoginActivity : BaseActivity() {
try {
if (userInfo != null) {
UserIn.imSetAccount(userInfo.uid.toString())
UserInfoCache.getInstance().saveYDLUser(userInfo.uid.toString(),
UserInfoCache.getInstance().saveYDLUser(
userInfo.uid.toString(),
userInfo.nick_name,
userInfo.head)
userInfo.head
)
}
} catch (e: Exception) {
e.printStackTrace()
......
......@@ -7,7 +7,6 @@ import android.content.Context
import android.content.pm.ActivityInfo
import android.graphics.Color
import android.text.TextUtils
import android.util.Log
import android.util.TypedValue
import android.view.Gravity
import android.view.View
......@@ -17,7 +16,6 @@ import android.widget.TextView
import com.fm.openinstall.OpenInstall
import com.fm.openinstall.listener.AppInstallAdapter
import com.fm.openinstall.model.AppData
import com.fm.openinstall.model.Error
import com.meituan.android.walle.WalleChannelReader
import com.mobile.auth.gatewayauth.*
import com.mobile.auth.gatewayauth.model.TokenRet
......@@ -29,6 +27,8 @@ import com.ydl.ydlcommon.utils.LogUtil
import com.ydl.ydlcommon.utils.YDLCacheUtils
import com.ydl.ydlcommon.utils.actionutil.ActionCountUtils
import com.ydl.ydlcommon.utils.log.LogHelper
import com.ydl.ydlnet.utils.log.AliYunLogConfig
import com.ydl.ydlnet.utils.log.AliYunLogHelper
import com.yidianling.common.tools.RxAppTool
import com.yidianling.common.tools.RxDeviceTool
import com.yidianling.common.tools.RxImageTool
......@@ -430,6 +430,7 @@ object OneKeyLoginHelp {
.observeOn(AndroidSchedulers.mainThread())
.subscribe({
if (it.code == 200) {
AliYunLogHelper.getInstance().sendLog(AliYunLogConfig.LOGIN,"一键登录成功")
ToastUtil.toastShort("登录成功")
saveUserData(it.data)
if (it.data.firstLogin == 1) {//第一次登录:是注册
......@@ -463,10 +464,12 @@ object OneKeyLoginHelp {
LoginUtils.loginSuccessOperate(mActivity)
}
} else {
AliYunLogHelper.getInstance().sendLog(AliYunLogConfig.LOGIN,"一键登录失败 msg:${it.msg}")
ToastUtil.toastShort(it.msg)
mPhoneNumberAuthHelper?.hideLoginLoading()
}
}, {
AliYunLogHelper.getInstance().sendLog(AliYunLogConfig.LOGIN,"一键登录Error msg:${it.message}")
ToastUtil.toastShort(it.message)
mPhoneNumberAuthHelper?.hideLoginLoading()
})
......@@ -580,6 +583,7 @@ object OneKeyLoginHelp {
* */
@SuppressLint("CheckResult")
fun startLogin(context: Activity, isOpenDialog: Boolean) {
try {
RxPermissions(context)
.request(Manifest.permission.READ_PHONE_STATE)
.subscribe { hasPermission: Boolean? ->
......@@ -598,5 +602,11 @@ object OneKeyLoginHelp {
}
}
}
} catch (e: Exception) {
e.printStackTrace()
} finally {
RegisterAndLoginActivity.start(context)
}
}
}
......@@ -34,6 +34,8 @@ import com.ydl.ydlcommon.utils.StatusBarUtils
import com.ydl.ydlcommon.utils.YDLCacheUtils
import com.ydl.ydlcommon.utils.actionutil.ActionCountUtils
import com.ydl.ydlcommon.view.dialog.CommonDialog
import com.ydl.ydlnet.utils.log.AliYunLogConfig
import com.ydl.ydlnet.utils.log.AliYunLogHelper
import com.yidianling.common.tools.LogUtil
import com.yidianling.common.tools.RxAppTool
import com.yidianling.common.tools.RxKeyboardTool
......@@ -590,6 +592,7 @@ class RegisterAndLoginActivity : BaseMvpActivity<ILoginContract.View, ILoginCont
runOnUiThread {
showLoading(false)
}
if (chcekPhoneResponeBean != null && chcekPhoneResponeBean?.hasPwd == 1) {//用户码有设置密码:跳转到密登录
InputPassWordActivity.start(
this,
......
......@@ -8,6 +8,8 @@ import com.ydl.ydlcommon.utils.StringUtils
import com.ydl.ydlcommon.utils.YDLCacheUtils
import com.ydl.ydlcommon.utils.actionutil.ActionCountUtils
import com.ydl.ydlcommon.utils.log.LogHelper
import com.ydl.ydlnet.utils.log.AliYunLogConfig
import com.ydl.ydlnet.utils.log.AliYunLogHelper
import com.yidianling.common.tools.ToastUtil
import com.yidianling.user.LoginUtils
import com.yidianling.user.StatusUtils
......@@ -28,7 +30,9 @@ import java.math.BigDecimal
* @Company 壹点灵
* @date 2018/12/2
*/
class InputPassWordPresenterImpl : BasePresenter<IInputPassWordContract.View, IInputPassWordContract.Model>(), IInputPassWordContract.Presenter {
class InputPassWordPresenterImpl :
BasePresenter<IInputPassWordContract.View, IInputPassWordContract.Model>(),
IInputPassWordContract.Presenter {
override fun createModel(): IInputPassWordContract.Model {
return InputPassWordModelImpl()
......@@ -37,11 +41,20 @@ class InputPassWordPresenterImpl : BasePresenter<IInputPassWordContract.View, II
/**
* 重新设置密码
*/
override fun resetPwd(newPassword: String, phone: String, msgCode: String, phoneCountryCode: String) {
override fun resetPwd(
newPassword: String,
phone: String,
msgCode: String,
phoneCountryCode: String
) {
ActionCountUtils.count(UserBIConstants.POSITION_LOGIN_CLICK, UserBIConstants.ACTION_TYPE_RESET_PWD)
ActionCountUtils.count(
UserBIConstants.POSITION_LOGIN_CLICK,
UserBIConstants.ACTION_TYPE_RESET_PWD
)
var param = PhoneResetPwdParam(StringUtils.md5(newPassword), phoneCountryCode, msgCode, phone)
var param =
PhoneResetPwdParam(StringUtils.md5(newPassword), phoneCountryCode, msgCode, phone)
mModel.resetPwd(param)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
......@@ -56,7 +69,11 @@ class InputPassWordPresenterImpl : BasePresenter<IInputPassWordContract.View, II
} else {
ToastUtil.toastShort("修改密码成功")
saveUserData(it.data)
ActionCountUtils.countUid(UserBIConstants.POSITION_LOGIN_SUCCESS_CLICK,it.data.uid!!,UserBIConstants.ACTION_TYPE_RESET_PWD)
ActionCountUtils.countUid(
UserBIConstants.POSITION_LOGIN_SUCCESS_CLICK,
it.data.uid!!,
UserBIConstants.ACTION_TYPE_RESET_PWD
)
if (it.data.firstLogin == 1) {//第一次登录:是注册
StatusUtils.isFirstLogin = true
// 重设密码登录已经不可能是首次登录,所以不进行百度埋点
......@@ -76,8 +93,15 @@ class InputPassWordPresenterImpl : BasePresenter<IInputPassWordContract.View, II
* 手机号密码登录
*/
@SuppressLint("CheckResult")
override fun userLoginByPassword(inputPassword: String, phone: String, phoneCountryCode: String) {
ActionCountUtils.count( UserBIConstants.POSITION_LOGIN_CLICK,UserBIConstants.ACTION_TYPE_PWD_LOGIN)
override fun userLoginByPassword(
inputPassword: String,
phone: String,
phoneCountryCode: String
) {
ActionCountUtils.count(
UserBIConstants.POSITION_LOGIN_CLICK,
UserBIConstants.ACTION_TYPE_PWD_LOGIN
)
var param = PhoneLoginPwdParam(StringUtils.md5(inputPassword), phoneCountryCode, phone)
mModel.userLoginByPassword(param)
......@@ -87,6 +111,8 @@ class InputPassWordPresenterImpl : BasePresenter<IInputPassWordContract.View, II
.doAfterTerminate { mView.showLoading(false) }
.subscribe({
if (it?.data == null) {
AliYunLogHelper.getInstance()
.sendLog(AliYunLogConfig.LOGIN, "手机号密码 登录失败 msg: ${it.msg}")
ToastUtil.toastShort(it.msg)
mView.startAnim()
} else {
......@@ -98,13 +124,22 @@ class InputPassWordPresenterImpl : BasePresenter<IInputPassWordContract.View, II
StatusUtils.isFirstLogin = true
mView.baiduActionBury()
} else {
ActionCountUtils.countUid(UserBIConstants.POSITION_LOGIN_SUCCESS_CLICK,it.data.uid!!,UserBIConstants.ACTION_TYPE_PWD_LOGIN)
ActionCountUtils.countUid(
UserBIConstants.POSITION_LOGIN_SUCCESS_CLICK,
it.data.uid!!,
UserBIConstants.ACTION_TYPE_PWD_LOGIN
)
}
mView.closeActivity()
}
AliYunLogHelper.getInstance().sendLog(AliYunLogConfig.LOGIN, "手机号密码 登录成功")
}
}, {
YdlCommonOut.showToast(it.message!!)
AliYunLogHelper.getInstance()
.sendLog(AliYunLogConfig.LOGIN, "手机号密码 Error msg: ${it.message}")
})
}
......
......@@ -10,6 +10,8 @@ import com.ydl.ydlcommon.router.YdlCommonOut
import com.ydl.ydlcommon.utils.YDLCacheUtils
import com.ydl.ydlcommon.utils.actionutil.ActionCountUtils
import com.ydl.ydlcommon.utils.log.LogHelper
import com.ydl.ydlnet.utils.log.AliYunLogConfig
import com.ydl.ydlnet.utils.log.AliYunLogHelper
import com.yidianling.common.tools.ToastUtil
import com.yidianling.user.LoginUtils
import com.yidianling.user.StatusUtils
......@@ -33,7 +35,8 @@ import java.math.BigDecimal
* @Company 壹点灵
* @date 2018/11/29
*/
class LoginPresenterImpl(view: ILoginContract.View) : BasePresenter<ILoginContract.View, ILoginContract.Model>(), ILoginContract.Presenter {
class LoginPresenterImpl(view: ILoginContract.View) :
BasePresenter<ILoginContract.View, ILoginContract.Model>(), ILoginContract.Presenter {
@SuppressLint("CheckResult")
override fun bindPhone(param: BindPhoneJavaParam) {
mModel.bindPhone(param)
......@@ -60,7 +63,10 @@ class LoginPresenterImpl(view: ILoginContract.View) : BasePresenter<ILoginContra
@SuppressLint("CheckResult")
override fun autoLogin(bean: PhoneLoginAutoParam) {
ActionCountUtils.count( UserBIConstants.POSITION_LOGIN_CLICK,UserBIConstants.ACTION_TYPE_DIRECT_LOGIN)
ActionCountUtils.count(
UserBIConstants.POSITION_LOGIN_CLICK,
UserBIConstants.ACTION_TYPE_DIRECT_LOGIN
)
mModel.autoLogin(bean)
.subscribeOn(Schedulers.io())
......@@ -73,18 +79,33 @@ class LoginPresenterImpl(view: ILoginContract.View) : BasePresenter<ILoginContra
saveUserData(it.data)
if (it.data.firstLogin == 1) {//第一次登录:是注册
StatusUtils.isFirstLogin = true
mView.baiduActionBury(it.data.uid, UserBIConstants.POSITION_ALIYUN_REGISTER_CLICK)
mView.baiduActionBury(
it.data.uid,
UserBIConstants.POSITION_ALIYUN_REGISTER_CLICK
)
} else {
ActionCountUtils.countUid(UserBIConstants.POSITION_LOGIN_SUCCESS_CLICK,it.data.uid!!,UserBIConstants.ACTION_TYPE_DIRECT_LOGIN)
ActionCountUtils.countUid(
UserBIConstants.POSITION_LOGIN_SUCCESS_CLICK,
it.data.uid!!,
UserBIConstants.ACTION_TYPE_DIRECT_LOGIN
)
}
mView.autoLoginSuccess()
AliYunLogHelper.getInstance()
.sendLog(AliYunLogConfig.LOGIN, "通过一键认证服务登录成功")
} else {
// ToastUtil.toastShort(it.msg)
mView.aliAuthFailed()
AliYunLogHelper.getInstance()
.sendLog(AliYunLogConfig.LOGIN, "通过一键认证服务登陆 失败 msg: ${it.msg}")
}
}, {
//走验证码、密码登录
mView.aliAuthFailed()
AliYunLogHelper.getInstance()
.sendLog(AliYunLogConfig.LOGIN, "通过一键认证服务登陆 Error msg: ${it.message}")
})
}
......@@ -161,7 +182,7 @@ class LoginPresenterImpl(view: ILoginContract.View) : BasePresenter<ILoginContra
}
}, {
mView.showLoading(false)
if (null != it && !TextUtils.isEmpty(it.message)){
if (null != it && !TextUtils.isEmpty(it.message)) {
YdlCommonOut.showToast(it.message!!)
}
})
......@@ -173,7 +194,8 @@ class LoginPresenterImpl(view: ILoginContract.View) : BasePresenter<ILoginContra
@SuppressLint("CheckResult")
override fun loginByThird(activity: Activity, media: SHARE_MEDIA) {
val sign1 = if (media == SHARE_MEDIA.QQ) UserBIConstants.ACTION_TYPE_QQ_THIRD_LOGIN else UserBIConstants.ACTION_TYPE_WX_THIRD_LOGIN
val sign1 =
if (media == SHARE_MEDIA.QQ) UserBIConstants.ACTION_TYPE_QQ_THIRD_LOGIN else UserBIConstants.ACTION_TYPE_WX_THIRD_LOGIN
ActionCountUtils.count(UserBIConstants.POSITION_LOGIN_CLICK, sign1)
UserHttpImpl.getInstance()
......@@ -183,7 +205,9 @@ class LoginPresenterImpl(view: ILoginContract.View) : BasePresenter<ILoginContra
mView.dismissProgressView()
}
.observeOn(Schedulers.io())
.flatMap { thirdLoginParam -> UserHttpImpl.getInstance().thirdPartJavaLogin(thirdLoginParam) }
.flatMap { thirdLoginParam ->
UserHttpImpl.getInstance().thirdPartJavaLogin(thirdLoginParam)
}
.doOnNext { LoginUtils.saveData(it.data) }
.observeOn(AndroidSchedulers.mainThread())
.subscribe({
......@@ -195,7 +219,10 @@ class LoginPresenterImpl(view: ILoginContract.View) : BasePresenter<ILoginContra
if (it.data.firstLogin == 1) {//第一次登录:是注册
StatusUtils.isFirstLogin = true
if (media == SHARE_MEDIA.QQ) {
mView.baiduActionBury(it.data.uid,UserBIConstants.POSITION_QQ_REGISTER_CLICK)
mView.baiduActionBury(
it.data.uid,
UserBIConstants.POSITION_QQ_REGISTER_CLICK
)
ActionCountUtils.baiduCount(
it.data.uid,
UserBIConstants.APP_REGISTER_PAGE,
......@@ -205,8 +232,11 @@ class LoginPresenterImpl(view: ILoginContract.View) : BasePresenter<ILoginContra
25,
OneKeyLoginHelp.openInstallKey
)
}else{
mView.baiduActionBury(it.data.uid,UserBIConstants.POSITION_WX_REGISTER_CLICK)
} else {
mView.baiduActionBury(
it.data.uid,
UserBIConstants.POSITION_WX_REGISTER_CLICK
)
ActionCountUtils.baiduCount(
it.data.uid,
UserBIConstants.APP_REGISTER_PAGE,
......@@ -219,16 +249,29 @@ class LoginPresenterImpl(view: ILoginContract.View) : BasePresenter<ILoginContra
}
// 用户注册成功后调用
OpenInstall.reportRegister()
}else{
ActionCountUtils.countUid(UserBIConstants.POSITION_LOGIN_SUCCESS_CLICK, it.data.uid!!,sign1)
} else {
ActionCountUtils.countUid(
UserBIConstants.POSITION_LOGIN_SUCCESS_CLICK,
it.data.uid!!,
sign1
)
}
LoginUtils.onLogin(it.data)
mView.thirdLoginSuccess(it.data.userInfo!!,if (media == SHARE_MEDIA.QQ) "qq" else "weixin")
mView.thirdLoginSuccess(
it.data.userInfo!!,
if (media == SHARE_MEDIA.QQ) "qq" else "weixin"
)
LogHelper.getInstance().writeLogSync(media.getName() + "登录成功")
AliYunLogHelper.getInstance()
.sendLog(AliYunLogConfig.LOGIN, media.getName() + "登录成功")
}, {
mView.dismissProgressView()
YdlCommonOut.showToast(it.message!!)
AliYunLogHelper.getInstance()
.sendLog(AliYunLogConfig.LOGIN, media.getName() + "登录失败")
})
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment