Commit 87a829ff by YKai

feat:m-user组件升级,强绑手机号

parent dd01e2b0
...@@ -8,7 +8,7 @@ ext { ...@@ -8,7 +8,7 @@ ext {
"m-confide" : "0.0.48.92", "m-confide" : "0.0.48.92",
"m-consultant" : "0.0.59.65", "m-consultant" : "0.0.59.65",
"m-fm" : "0.0.30.01", "m-fm" : "0.0.30.01",
"m-user" : "0.0.61.11", "m-user" : "0.0.61.14",
"m-home" : "0.0.22.53", "m-home" : "0.0.22.53",
"m-im" : "0.0.18.39", "m-im" : "0.0.18.39",
"m-dynamic" : "0.0.7.19", "m-dynamic" : "0.0.7.19",
......
...@@ -2,6 +2,7 @@ package com.yidianling.user.http ...@@ -2,6 +2,7 @@ package com.yidianling.user.http
import com.google.gson.Gson import com.google.gson.Gson
import com.ydl.ydlcommon.base.config.HttpConfig import com.ydl.ydlcommon.base.config.HttpConfig
import com.ydl.ydlcommon.data.http.BaseAPIResponse
import com.ydl.ydlcommon.data.http.BaseResponse import com.ydl.ydlcommon.data.http.BaseResponse
import com.ydl.ydlnet.YDLHttpUtils import com.ydl.ydlnet.YDLHttpUtils
import com.yidianling.user.api.bean.UserResponseBean import com.yidianling.user.api.bean.UserResponseBean
...@@ -113,5 +114,12 @@ class LoginApiRequestUtil { ...@@ -113,5 +114,12 @@ class LoginApiRequestUtil {
val body = RequestBody.create(MediaType.parse("application/json; charset=utf-8"), str) val body = RequestBody.create(MediaType.parse("application/json; charset=utf-8"), str)
return getUserApi().bindPhone(body) return getUserApi().bindPhone(body)
} }
/**
* 是否需要强绑手机号
*/
fun isNeedForceBindPhone(map:Map<String,String>): Observable<BaseAPIResponse<Boolean>>{
return getUserApi().isNeedForceBindPhone(map)
}
} }
} }
\ No newline at end of file
...@@ -228,9 +228,19 @@ interface UserApi { ...@@ -228,9 +228,19 @@ interface UserApi {
@POST("login/v2/unbind_wechat_qq") @POST("login/v2/unbind_wechat_qq")
@Headers( YDL_DOMAIN+ YDL_DOMAIN_LOGIN_BASE_URL,LOGIN_USER_PORT) @Headers( YDL_DOMAIN+ YDL_DOMAIN_LOGIN_BASE_URL,LOGIN_USER_PORT)
fun unBindThirdLogin(@Body body: RequestBody): Observable<BaseResponse<Any>> fun unBindThirdLogin(@Body body: RequestBody): Observable<BaseResponse<Any>>
//用户注销账号
/**
* 用户注销账号
*/
@FormUrlEncoded @FormUrlEncoded
@POST("user/forbid_login") @POST("user/forbid_login")
@Headers( YDL_DOMAIN+ YDL_DOMAIN_JAVA) @Headers( YDL_DOMAIN+ YDL_DOMAIN_JAVA)
fun userForbidLogin(@FieldMap params: Map<String, String>): Observable<BaseAPIResponse<Boolean>> fun userForbidLogin(@FieldMap params: Map<String, String>): Observable<BaseAPIResponse<Boolean>>
/**
* 是否需要强绑定手机号
*/
@POST("login/v2/is_need_strong_bind")
@Headers( YDL_DOMAIN+ YDL_DOMAIN_LOGIN_BASE_URL, LOGIN_USER_PORT)
fun isNeedForceBindPhone(@Body map: Map<String,String>): Observable<BaseAPIResponse<Boolean>>
} }
\ No newline at end of file
...@@ -35,13 +35,16 @@ class BindPhoneActivity : BaseActivity() { ...@@ -35,13 +35,16 @@ class BindPhoneActivity : BaseActivity() {
private var countryCode: String = "0086"//国家或地区手机区号 private var countryCode: String = "0086"//国家或地区手机区号
private var msgCodeDispoable: Disposable? = null private var msgCodeDispoable: Disposable? = null
private var mKeFuDialog: ZDialog? = null private var mKeFuDialog: ZDialog? = null
private var isForceBindPhone:Boolean=false // 是否强绑手机号
private lateinit var loginType:String // 第三方登录方式 qq/微信
companion object { companion object {
/** /**
* 启动BindPhoneActivity * 启动BindPhoneActivity
*/ */
fun startActivity(context: Context) { fun startActivity(context: Context,loginType:String) {
val intent = Intent(context, BindPhoneActivity::class.java) val intent = Intent(context, BindPhoneActivity::class.java)
intent.putExtra("login_type",loginType)
context.startActivity(intent) context.startActivity(intent)
} }
} }
...@@ -53,10 +56,15 @@ class BindPhoneActivity : BaseActivity() { ...@@ -53,10 +56,15 @@ class BindPhoneActivity : BaseActivity() {
override fun initDataAndEvent() { override fun initDataAndEvent() {
setWindowStatusBarColor() setWindowStatusBarColor()
loginType = intent.getStringExtra("login_type")
iv_back.setOnClickListener { iv_back.setOnClickListener {
LoginUtils.logout() if (isForceBindPhone){
finish() LoginUtils.logout()
finish()
}else{
LoginUtils.loginSuccessOperate(this)
}
} }
tv_country_code.setOnClickListener { tv_country_code.setOnClickListener {
val intent = Intent(this, CountryListActivity::class.java) val intent = Intent(this, CountryListActivity::class.java)
...@@ -128,10 +136,33 @@ class BindPhoneActivity : BaseActivity() { ...@@ -128,10 +136,33 @@ class BindPhoneActivity : BaseActivity() {
override fun onTextChanged(p0: CharSequence?, p1: Int, p2: Int, p3: Int) { override fun onTextChanged(p0: CharSequence?, p1: Int, p2: Int, p3: Int) {
} }
}) })
getIsNeedForceBindPhone()
setTvGetCodeStatus() setTvGetCodeStatus()
} }
/** /**
* 获取用户是否需要强绑定手机号
*/
@SuppressLint("CheckResult")
private fun getIsNeedForceBindPhone(){
val userInfo = UserHelper.getUserInfo()?.userInfo
val map = HashMap<String,String>()
map["login_type"] = loginType
map["openid"] = userInfo?.open_id_qqapp?:""
map["unionid"] = userInfo?.union_id?:""
LoginApiRequestUtil.isNeedForceBindPhone(map)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe({
if (it.code=="200"){
isForceBindPhone = it.data
}
},{
ToastUtil.toastShort(it.message)
})
}
/**
* 检查手机号是否是用户版号码、是否有设置密码、是否被绑定 * 检查手机号是否是用户版号码、是否有设置密码、是否被绑定
*/ */
@SuppressLint("CheckResult") @SuppressLint("CheckResult")
...@@ -178,8 +209,6 @@ class BindPhoneActivity : BaseActivity() { ...@@ -178,8 +209,6 @@ class BindPhoneActivity : BaseActivity() {
/** /**
* 绑定手机号 * 绑定手机号
* @param phone
* @param code
*/ */
@SuppressLint("CheckResult") @SuppressLint("CheckResult")
private fun bindPhone() { private fun bindPhone() {
......
...@@ -531,9 +531,9 @@ class RegisterAndLoginActivity : BaseMvpActivity<ILoginContract.View, ILoginCont ...@@ -531,9 +531,9 @@ class RegisterAndLoginActivity : BaseMvpActivity<ILoginContract.View, ILoginCont
/** /**
*三方登录成功 *三方登录成功
*/ */
override fun thirdLoginSuccess(userInfo: UserResponseBean.UserInfo) { override fun thirdLoginSuccess(userInfo: UserResponseBean.UserInfo,thirdLoginPlatform:String) {
if (userInfo.bind_phone != 1) { if (userInfo.bind_phone != 1) {
BindPhoneActivity.startActivity(this) BindPhoneActivity.startActivity(this,thirdLoginPlatform)
finish() finish()
} else { } else {
when { when {
......
...@@ -44,7 +44,7 @@ interface ILoginContract { ...@@ -44,7 +44,7 @@ interface ILoginContract {
/** /**
* 三方登录成功 * 三方登录成功
*/ */
fun thirdLoginSuccess(userInfo: UserResponseBean.UserInfo) fun thirdLoginSuccess(userInfo: UserResponseBean.UserInfo,thirdLoginPlatform:String)
/** /**
* 弹窗 * 弹窗
......
...@@ -192,9 +192,9 @@ class LoginPresenterImpl(view: ILoginContract.View) : BasePresenter<ILoginContra ...@@ -192,9 +192,9 @@ class LoginPresenterImpl(view: ILoginContract.View) : BasePresenter<ILoginContra
ToastUtil.toastShort(it.msg) ToastUtil.toastShort(it.msg)
return@subscribe return@subscribe
} }
if (media == SHARE_MEDIA.QQ) { if (it.data.firstLogin == 1) {//第一次登录:是注册
if (it.data.firstLogin == 1) {//第一次登录:是注册 StatusUtils.isFirstLogin = true
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( ActionCountUtils.baiduCount(
it.data.uid, it.data.uid,
...@@ -205,14 +205,7 @@ class LoginPresenterImpl(view: ILoginContract.View) : BasePresenter<ILoginContra ...@@ -205,14 +205,7 @@ class LoginPresenterImpl(view: ILoginContract.View) : BasePresenter<ILoginContra
25, 25,
OneKeyLoginHelp.openInstallKey OneKeyLoginHelp.openInstallKey
) )
// 用户注册成功后调用 }else{
OpenInstall.reportRegister();
} else {
ActionCountUtils.countUid(UserBIConstants.POSITION_LOGIN_SUCCESS_CLICK, it.data.uid!!,sign1)
}
} else {
if (it.data.firstLogin == 1) {//第一次登录:是注册
StatusUtils.isFirstLogin = true
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,
...@@ -223,14 +216,15 @@ class LoginPresenterImpl(view: ILoginContract.View) : BasePresenter<ILoginContra ...@@ -223,14 +216,15 @@ class LoginPresenterImpl(view: ILoginContract.View) : BasePresenter<ILoginContra
25, 25,
OneKeyLoginHelp.openInstallKey OneKeyLoginHelp.openInstallKey
) )
// 用户注册成功后调用
OpenInstall.reportRegister();
} else {
ActionCountUtils.countUid(UserBIConstants.POSITION_LOGIN_SUCCESS_CLICK, it.data.uid!!,sign1)
} }
// 用户注册成功后调用
OpenInstall.reportRegister()
}else{
ActionCountUtils.countUid(UserBIConstants.POSITION_LOGIN_SUCCESS_CLICK, it.data.uid!!,sign1)
} }
LoginUtils.onLogin(it.data) LoginUtils.onLogin(it.data)
mView.thirdLoginSuccess(it.data.userInfo!!) mView.thirdLoginSuccess(it.data.userInfo!!,if (media == SHARE_MEDIA.QQ) "qq" else "weixin")
LogHelper.getInstance().writeLogSync(media.getName() + "登录成功") LogHelper.getInstance().writeLogSync(media.getName() + "登录成功")
}, { }, {
mView.dismissProgressView() mView.dismissProgressView()
......
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
tools:context=".ui.login.BindPhoneActivity" tools:context=".ui.login.BindPhoneActivity"
android:background="@color/white"
tools:ignore="ResourceName"> tools:ignore="ResourceName">
<ImageView <ImageView
......
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