Commit a9ff09f1 by 刘鹏

feat: 登录模块日志

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