Commit 1e567709 by 刘鹏

Merge branch '4.1.69(强绑手机号)' into 4.1.69_log

# Conflicts:
#	config.gradle
parents a9ff09f1 9430b62e
...@@ -6,10 +6,10 @@ ext { ...@@ -6,10 +6,10 @@ ext {
// -------------- 业务模块 -------------- // -------------- 业务模块 --------------
//第三步 若干 //第三步 若干
"m-confide" : "0.0.49.02", "m-confide" : "0.0.49.02",
"m-consultant" : "0.0.59.66", "m-consultant" : "0.0.59.68",
"m-fm" : "0.0.30.01", "m-fm" : "0.0.30.01",
"m-user" : "0.0.61.23", "m-user" : "0.0.61.23",
"m-home" : "0.0.22.55", "m-home" : "0.0.22.59",
"m-im" : "0.0.18.45", "m-im" : "0.0.18.45",
"m-dynamic" : "0.0.7.19", "m-dynamic" : "0.0.7.19",
"m-article" : "0.0.0.6", "m-article" : "0.0.0.6",
...@@ -89,10 +89,10 @@ ext { ...@@ -89,10 +89,10 @@ ext {
//第三步 若干 //第三步 若干
"m-confide" : "0.0.49.02", "m-confide" : "0.0.49.02",
"m-consultant" : "0.0.59.66", "m-consultant" : "0.0.59.68",
"m-fm" : "0.0.30.01", "m-fm" : "0.0.30.01",
"m-user" : "0.0.61.23", "m-user" : "0.0.61.23",
"m-home" : "0.0.22.54", "m-home" : "0.0.22.59",
"m-im" : "0.0.18.45", "m-im" : "0.0.18.45",
"m-dynamic" : "0.0.7.19", "m-dynamic" : "0.0.7.19",
"m-article" : "0.0.0.6", "m-article" : "0.0.0.6",
......
...@@ -175,9 +175,7 @@ ...@@ -175,9 +175,7 @@
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center_vertical" android:layout_gravity="center_vertical"
android:orientation="horizontal"> android:orientation="horizontal" />
</LinearLayout>
<!--61234人点评--> <!--61234人点评-->
<TextView <TextView
android:id="@+id/tv_zixunOrderNum" android:id="@+id/tv_zixunOrderNum"
......
...@@ -30,7 +30,7 @@ ...@@ -30,7 +30,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:textColor="@color/platform_color_FFFFFF" android:textColor="@color/platform_color_FFFFFF"
android:textSize="@dimen/platform_dp_12" android:textSize="@dimen/platform_dp_12"
android:text="2.2W+师资"/> android:text="3W+师资"/>
</RelativeLayout> </RelativeLayout>
<RelativeLayout <RelativeLayout
......
...@@ -205,9 +205,6 @@ public class P2PCustomActionHandlerImpl implements IP2PCustomActionHandler { ...@@ -205,9 +205,6 @@ public class P2PCustomActionHandlerImpl implements IP2PCustomActionHandler {
*/ */
@Override @Override
public void sendRedPacket(Activity activity) { public void sendRedPacket(Activity activity) {
// Bundle bundle = new Bundle();
// bundle.putString("to_uid",toChatUsername);
// ImIn.INSTANCE.SendRedPacketActivity(activity,bundle,44);
ImIn.INSTANCE.sendRedPacketIntent(activity, toChatUsername, 44); ImIn.INSTANCE.sendRedPacketIntent(activity, toChatUsername, 44);
} }
......
...@@ -13,5 +13,6 @@ data class BindPhoneJavaParam( ...@@ -13,5 +13,6 @@ data class BindPhoneJavaParam(
var phoneNumber: String,//手机号 var phoneNumber: String,//手机号
var verifyCode: String,// 验证码 var verifyCode: String,// 验证码
var uid: String, var uid: String,
var type: Int = 2//2:Android var type: Int = 2, //2:Android
var transferFlag:Int = 0 // 默认为0,1表示需要转换x账号到y账号触发 1800010011 code提醒触发重新登录标记
) )
\ No newline at end of file
...@@ -12,6 +12,7 @@ import android.view.View ...@@ -12,6 +12,7 @@ import android.view.View
import com.ydl.ydlcommon.base.BaseActivity import com.ydl.ydlcommon.base.BaseActivity
import com.ydl.ydlcommon.router.YdlCommonOut import com.ydl.ydlcommon.router.YdlCommonOut
import com.ydl.ydlcommon.utils.StatusBarUtils import com.ydl.ydlcommon.utils.StatusBarUtils
import com.yidianling.common.tools.LogUtil
import com.yidianling.common.tools.RxKeyboardTool import com.yidianling.common.tools.RxKeyboardTool
import com.yidianling.common.tools.ToastUtil import com.yidianling.common.tools.ToastUtil
import com.yidianling.user.LoginUtils import com.yidianling.user.LoginUtils
...@@ -31,6 +32,8 @@ import io.reactivex.android.schedulers.AndroidSchedulers ...@@ -31,6 +32,8 @@ import io.reactivex.android.schedulers.AndroidSchedulers
import io.reactivex.disposables.Disposable import io.reactivex.disposables.Disposable
import io.reactivex.schedulers.Schedulers import io.reactivex.schedulers.Schedulers
import kotlinx.android.synthetic.main.activity_bind_phone.* import kotlinx.android.synthetic.main.activity_bind_phone.*
import kotlinx.android.synthetic.main.activity_bind_phone.et_phone_number
import kotlinx.android.synthetic.main.activity_bind_phone.iv_del
import java.util.concurrent.TimeUnit import java.util.concurrent.TimeUnit
class BindPhoneActivity : BaseActivity() { class BindPhoneActivity : BaseActivity() {
...@@ -39,16 +42,17 @@ class BindPhoneActivity : BaseActivity() { ...@@ -39,16 +42,17 @@ class BindPhoneActivity : BaseActivity() {
private var countryName: String = "中国" private var countryName: String = "中国"
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 var mIsForceBindPhone: Boolean = false // 是否强绑手机号
private lateinit var loginType: String // 第三方登录方式 qq/微信 private var mIsFromGuide: Boolean = false // 是否来自启动页
companion object { companion object {
/** /**
* 启动BindPhoneActivity * 启动BindPhoneActivity
*/ */
fun startActivity(context: Context, loginType: String) { fun startActivity(context: Context, isForceBindPhone: Boolean, isFromGuide: Boolean) {
val intent = Intent(context, BindPhoneActivity::class.java) val intent = Intent(context, BindPhoneActivity::class.java)
intent.putExtra("login_type", loginType) intent.putExtra("is_force_bind_phone", isForceBindPhone)
intent.putExtra("is_from_guide", isFromGuide)
context.startActivity(intent) context.startActivity(intent)
} }
} }
...@@ -60,19 +64,10 @@ class BindPhoneActivity : BaseActivity() { ...@@ -60,19 +64,10 @@ class BindPhoneActivity : BaseActivity() {
override fun initDataAndEvent() { override fun initDataAndEvent() {
setWindowStatusBarColor() setWindowStatusBarColor()
loginType = intent.getStringExtra("login_type") mIsForceBindPhone = intent.getBooleanExtra("is_force_bind_phone",false)
mIsFromGuide = intent.getBooleanExtra("is_from_guide", false)
iv_back.setOnClickListener { iv_back.setOnClickListener {
if (isForceBindPhone) { onBackPressed()
//清除UserInfo
setUserinfo(null)
clearImData()
logout()
EventBus.getDefault().post(RefreshRecentContactListEvent())
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)
...@@ -86,8 +81,10 @@ class BindPhoneActivity : BaseActivity() { ...@@ -86,8 +81,10 @@ class BindPhoneActivity : BaseActivity() {
} }
// 获取验证码按钮 // 获取验证码按钮
tv_get_code.setOnClickListener { tv_get_code.setOnClickListener {
if (checkPhone()) {
checkPhoneStatus() checkPhoneStatus()
} }
}
// 收不到验证码 // 收不到验证码
tv_no_get_code.setOnClickListener { tv_no_get_code.setOnClickListener {
showKeFuDialog() showKeFuDialog()
...@@ -144,31 +141,31 @@ class BindPhoneActivity : BaseActivity() { ...@@ -144,31 +141,31 @@ 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() // getIsNeedForceBindPhone()
setTvGetCodeStatus() setTvGetCodeStatus()
} }
/** // /**
* 获取用户是否需要强绑定手机号 // * 获取用户是否需要强绑定手机号
*/ // */
@SuppressLint("CheckResult") // @SuppressLint("CheckResult")
private fun getIsNeedForceBindPhone() { // private fun getIsNeedForceBindPhone() {
val userInfo = UserHelper.getUserInfo()?.userInfo // val userInfo = UserHelper.getUserInfo()?.userInfo
val map = HashMap<String, String>() // val map = HashMap<String, String>()
map["login_type"] = loginType // map["login_type"] = loginType
map["openid"] = userInfo?.open_id_qqapp ?: "" // map["openid"] = userInfo?.open_id_qqapp ?: ""
map["unionid"] = userInfo?.union_id ?: "" // map["unionid"] = userInfo?.union_id ?: ""
LoginApiRequestUtil.isNeedForceBindPhone(map) // LoginApiRequestUtil.isNeedForceBindPhone(map)
.subscribeOn(Schedulers.io()) // .subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread()) // .observeOn(AndroidSchedulers.mainThread())
.subscribe({ // .subscribe({
if (it.code == "200") { // if (it.code == "200") {
isForceBindPhone = it.data // isForceBindPhone = it.data
} // }
}, { // }, {
ToastUtil.toastShort(it.message) // ToastUtil.toastShort(it.message)
}) // })
} // }
/** /**
* 检查手机号是否是用户版号码、是否有设置密码、是否被绑定 * 检查手机号是否是用户版号码、是否有设置密码、是否被绑定
...@@ -223,20 +220,34 @@ class BindPhoneActivity : BaseActivity() { ...@@ -223,20 +220,34 @@ class BindPhoneActivity : BaseActivity() {
val phone = et_phone_number.text.toString().replace(" ", "") val phone = et_phone_number.text.toString().replace(" ", "")
val code = et_code.text.toString() val code = et_code.text.toString()
val bindPhoneParams = val bindPhoneParams =
BindPhoneJavaParam("", countryCode, phone, code, UserHelper.getUserInfo()!!.uid!!) BindPhoneJavaParam("", countryCode, phone, code, UserHelper.getUserInfo()!!.uid!!,transferFlag=1)
LoginApiRequestUtil.bindPhone(bindPhoneParams) LoginApiRequestUtil.bindPhone(bindPhoneParams)
.subscribeOn(Schedulers.io()) .subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread()) .observeOn(AndroidSchedulers.mainThread())
.doOnSubscribe { showProgressDialog() } .doOnSubscribe { showProgressDialog() }
.doAfterTerminate { dismissProgressDialog() } .doAfterTerminate { dismissProgressDialog() }
.subscribe({ .subscribe({
if (it.data != null && it.code == 200) { RxKeyboardTool.hideSoftInput(this)
ToastUtil.toastShort("手机号绑定成功") if (it.code == 200) {
ToastUtil.toastShort("绑定成功")
UserHelper.getUserInfo()!!.userInfo!!.bind_phone = 1 UserHelper.getUserInfo()!!.userInfo!!.bind_phone = 1
UserHelper.getUserInfo()!!.userInfo!!.phone = phone UserHelper.getUserInfo()!!.userInfo!!.phone = phone
RxKeyboardTool.hideSoftInput(this) if (mIsFromGuide) {
LoginUtils.loginSuccessOperate(this) LoginUtils.loginSuccessOperate(this)
} else { } else {
finish()
}
} else if (it.code == 1300000004) { // 如果不是10分钟内注册,提示“绑定失败,此手机号已注册”,并标记此账号为无需强绑
ToastUtil.toastShort(it.msg)
if (mIsFromGuide) {
LoginUtils.loginSuccessOperate(this)
} else {
finish()
}
}else if(it.code==1800010011){
RegisterAndLoginActivity.startFromGuide(this,false,mIsFromGuide)
finish()
} else {
ToastUtil.toastShort(it.msg)//服务端返回{验证码错误&异常}信息 ToastUtil.toastShort(it.msg)//服务端返回{验证码错误&异常}信息
} }
}, { }, {
...@@ -244,6 +255,19 @@ class BindPhoneActivity : BaseActivity() { ...@@ -244,6 +255,19 @@ class BindPhoneActivity : BaseActivity() {
}) })
} }
override fun onBackPressed() {
if (mIsForceBindPhone) {
//清除UserInfo
setUserinfo(null)
clearImData()
logout()
EventBus.getDefault().post(RefreshRecentContactListEvent())
finish()
} else {
LoginUtils.loginSuccessOperate(this)
}
}
/** /**
* 开始倒计时 * 开始倒计时
...@@ -334,6 +358,36 @@ class BindPhoneActivity : BaseActivity() { ...@@ -334,6 +358,36 @@ class BindPhoneActivity : BaseActivity() {
} }
} }
/**
* 检查手机号规范
*/
private fun checkPhone(): Boolean {
val editPhone = et_phone_number.textContent
if (TextUtils.isEmpty(editPhone)) {
ToastUtil.toastShort("请输入手机号")
return false
}
LogUtil.e("本地userPhoneNumber赋值操作2:$editPhone")
//手机号码验证 国外手机号码不做限制
if (!TextUtils.equals("0086", countryCode)) {
return !TextUtils.isEmpty(editPhone)
}
return if (editPhone.length == 11 && editPhone.startsWith("1") && checkRegex(
editPhone.toString().trim()
)
) {
true
} else {
ToastUtil.toastShort("不是正确的手机号")
false
}
}
private fun checkRegex(phone: String): Boolean {
val regex = "^1+[23456789]+\\d{9}"
return phone.matches(regex.toRegex())
}
override fun onDestroy() { override fun onDestroy() {
super.onDestroy() super.onDestroy()
if (msgCodeDispoable != null) { if (msgCodeDispoable != null) {
......
...@@ -46,6 +46,7 @@ import com.yidianling.user.UserHelper ...@@ -46,6 +46,7 @@ import com.yidianling.user.UserHelper
import com.yidianling.user.UserHelper.isLogin import com.yidianling.user.UserHelper.isLogin
import com.yidianling.user.api.bean.UserResponseBean import com.yidianling.user.api.bean.UserResponseBean
import com.yidianling.user.constants.UserBIConstants import com.yidianling.user.constants.UserBIConstants
import com.yidianling.user.http.LoginApiRequestUtil
import com.yidianling.user.http.request.BindPhoneJavaParam import com.yidianling.user.http.request.BindPhoneJavaParam
import com.yidianling.user.http.request.PhoneLoginAutoParam import com.yidianling.user.http.request.PhoneLoginAutoParam
import com.yidianling.user.http.response.ChcekPhoneResponeBean import com.yidianling.user.http.response.ChcekPhoneResponeBean
...@@ -56,6 +57,8 @@ import com.yidianling.user.safePrivate.HandUnlockCheckActivity ...@@ -56,6 +57,8 @@ import com.yidianling.user.safePrivate.HandUnlockCheckActivity
import com.yidianling.user.ui.CountryListActivity import com.yidianling.user.ui.CountryListActivity
import com.yidianling.user.ui.login.contract.ILoginContract import com.yidianling.user.ui.login.contract.ILoginContract
import com.yidianling.user.ui.login.presenter.LoginPresenterImpl import com.yidianling.user.ui.login.presenter.LoginPresenterImpl
import io.reactivex.android.schedulers.AndroidSchedulers
import io.reactivex.schedulers.Schedulers
import kotlinx.android.synthetic.main.user_activity_register_and_login_bottom.* import kotlinx.android.synthetic.main.user_activity_register_and_login_bottom.*
import kotlinx.android.synthetic.main.user_activity_register_and_login_new.* import kotlinx.android.synthetic.main.user_activity_register_and_login_new.*
...@@ -533,9 +536,24 @@ class RegisterAndLoginActivity : BaseMvpActivity<ILoginContract.View, ILoginCont ...@@ -533,9 +536,24 @@ class RegisterAndLoginActivity : BaseMvpActivity<ILoginContract.View, ILoginCont
/** /**
*三方登录成功 *三方登录成功
*/ */
override fun thirdLoginSuccess(userInfo: UserResponseBean.UserInfo,thirdLoginPlatform:String) { @SuppressLint("CheckResult")
if (userInfo.bind_phone != 1) { override fun thirdLoginSuccess(
BindPhoneActivity.startActivity(this,thirdLoginPlatform) userInfo: UserResponseBean.UserInfo,
thirdLoginPlatform: String
) {
val userInfo = UserHelper.getUserInfo()?.userInfo
val map = HashMap<String, String>()
map["login_type"] = thirdLoginPlatform
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") {
if (it.data) {
BindPhoneActivity.startActivity(this, it.data, isFromGuide)
finish() finish()
} else { } else {
when { when {
...@@ -556,6 +574,10 @@ class RegisterAndLoginActivity : BaseMvpActivity<ILoginContract.View, ILoginCont ...@@ -556,6 +574,10 @@ class RegisterAndLoginActivity : BaseMvpActivity<ILoginContract.View, ILoginCont
} }
} }
} }
}, {
ToastUtil.toastShort(it.message)
})
}
/** /**
* 校验手机号(是否是用户版号码、是否有设置密码、是否被绑定)成功 * 校验手机号(是否是用户版号码、是否有设置密码、是否被绑定)成功
......
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