完善微信登录不同情况的逻辑
This commit is contained in:
@@ -461,7 +461,7 @@ abstract class BaseActivity<T : ViewBinding>(val inflater: (inflater: LayoutInfl
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun showNoCancelableLoading(show: Boolean, message: String = getString(R.string.txt_loading)) {
|
fun showNoCancelableLoading(show: Boolean, message: String = getString(R.string.txt_loading)) {
|
||||||
if (!isFrontRunning) {
|
if (!isFrontRunning && show) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if (show) {
|
if (show) {
|
||||||
@@ -601,8 +601,11 @@ abstract class BaseActivity<T : ViewBinding>(val inflater: (inflater: LayoutInfl
|
|||||||
getResultCallback.onRequestError(exceptionCode)
|
getResultCallback.onRequestError(exceptionCode)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
//处理注册用户已存在的情况
|
//拦截错误吐司不显示
|
||||||
else if (exceptionCode == ErrorCode.USER_HAS_EXIST.toString()) {
|
//处理注册用户已存在的情况,微信没有注册用户,微信绑定的手机号没有注册用户
|
||||||
|
else if (exceptionCode == ErrorCode.USER_HAS_EXIST.toString() || exceptionCode == ErrorCode.WX_NO_EXIST.toString() ||
|
||||||
|
exceptionCode == ErrorCode.PHONE_NO_REGISTER.toString()
|
||||||
|
) {
|
||||||
getResultCallback.onRequestError(exceptionCode)
|
getResultCallback.onRequestError(exceptionCode)
|
||||||
return
|
return
|
||||||
} else if (exceptionCode == ErrorCode.DEVICE_HAS_BIND.toString()) {
|
} else if (exceptionCode == ErrorCode.DEVICE_HAS_BIND.toString()) {
|
||||||
@@ -640,7 +643,7 @@ abstract class BaseActivity<T : ViewBinding>(val inflater: (inflater: LayoutInfl
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
mNetworkRequestsFailRetryCount = 0
|
mNetworkRequestsFailRetryCount = 0
|
||||||
if (isShowNoDataTip && data is MutableList<*> && data.size == 0) {
|
if (isShowNoDataTip && data is MutableList<*> && data.isEmpty()) {
|
||||||
showToast(R.string.no_data)
|
showToast(R.string.no_data)
|
||||||
}
|
}
|
||||||
//不做强制类型转换
|
//不做强制类型转换
|
||||||
|
|||||||
@@ -13,8 +13,8 @@ import com.abbidot.tracker.constant.ConstantInt
|
|||||||
import com.abbidot.tracker.constant.GetResultCallback
|
import com.abbidot.tracker.constant.GetResultCallback
|
||||||
import com.abbidot.tracker.databinding.FragmentForgetPasswordCnStartBinding
|
import com.abbidot.tracker.databinding.FragmentForgetPasswordCnStartBinding
|
||||||
import com.abbidot.tracker.deprecated.ui.activity.LoginRegisterCNActivity
|
import com.abbidot.tracker.deprecated.ui.activity.LoginRegisterCNActivity
|
||||||
import com.abbidot.tracker.vm.cn.RegisterCNViewModel
|
|
||||||
import com.abbidot.tracker.vm.CountDownTimerViewModel
|
import com.abbidot.tracker.vm.CountDownTimerViewModel
|
||||||
|
import com.abbidot.tracker.vm.cn.RegisterCNViewModel
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -109,7 +109,7 @@ class ForgetPasswordCNStartFragment : BaseFragment<FragmentForgetPasswordCnStart
|
|||||||
}
|
}
|
||||||
val activity = activity as LoginRegisterCNActivity
|
val activity = activity as LoginRegisterCNActivity
|
||||||
activity.mPhone = phone
|
activity.mPhone = phone
|
||||||
mRegisterCNViewModel.validatePhoneCode(this, phone, code, 4)
|
mRegisterCNViewModel.validatePhoneCode(this, phone, code, 4,"")
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -92,7 +92,7 @@ class RegisterCNStartFragment :
|
|||||||
}
|
}
|
||||||
|
|
||||||
activity.mPhone = phone
|
activity.mPhone = phone
|
||||||
mRegisterCNViewModel.validatePhoneCode(this, phone, code, 3)
|
mRegisterCNViewModel.validatePhoneCode(this, phone, code, 3,"")
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -1434,8 +1434,10 @@ interface INetworkService {
|
|||||||
@POST("user/phoneValidateCode")
|
@POST("user/phoneValidateCode")
|
||||||
suspend fun validatePhoneCode(
|
suspend fun validatePhoneCode(
|
||||||
@Field("phone") phone: String, @Field("code") code: String,
|
@Field("phone") phone: String, @Field("code") code: String,
|
||||||
//验证码类型 1是注册 2是忘记密码
|
//验证码类型 1注册 2忘记密码 3验证码登录 4微信绑定
|
||||||
@Field("type") type: Int
|
@Field("type") type: Int,
|
||||||
|
//微信标识(type:4的时候,必传)
|
||||||
|
@Field("openidIdentifier") openidIdentifier: String
|
||||||
): BaseResponse<UserBean>
|
): BaseResponse<UserBean>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -1321,8 +1321,8 @@ object NetworkApi : BaseNetworkApi<INetworkService>(INetworkService.BASE_URL) {
|
|||||||
/**
|
/**
|
||||||
* 手机号验证码验证
|
* 手机号验证码验证
|
||||||
*/
|
*/
|
||||||
suspend fun validatePhoneCode(phone: String, code: String, type: Int) = getResult {
|
suspend fun validatePhoneCode(phone: String, code: String, type: Int,openidIdentifier: String) = getResult {
|
||||||
service.validatePhoneCode(phone, code, type)
|
service.validatePhoneCode(phone, code, type,openidIdentifier)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ import com.abbidot.tracker.util.Util
|
|||||||
|
|
||||||
class SayHelloActivity : BaseActivity<ActivitySayHelloBinding>(ActivitySayHelloBinding::inflate) {
|
class SayHelloActivity : BaseActivity<ActivitySayHelloBinding>(ActivitySayHelloBinding::inflate) {
|
||||||
|
|
||||||
private var mWXCode = ""
|
private var mOpenid = ""
|
||||||
|
|
||||||
override fun getTopBar() = null
|
override fun getTopBar() = null
|
||||||
|
|
||||||
@@ -47,34 +47,37 @@ class SayHelloActivity : BaseActivity<ActivitySayHelloBinding>(ActivitySayHelloB
|
|||||||
}
|
}
|
||||||
|
|
||||||
XEventBus.observe(this, EventName.PostValue) { s: String ->
|
XEventBus.observe(this, EventName.PostValue) { s: String ->
|
||||||
mWXCode = s
|
mOpenid = s
|
||||||
}
|
}
|
||||||
|
|
||||||
//微信登录成功返回
|
//微信登录成功返回
|
||||||
XEventBus.observe(this, EventName.WXLoginResult) { it: Result<UserBean> ->
|
XEventBus.observe(this, EventName.WXLoginResult) { it: Result<UserBean> ->
|
||||||
dealRequestResult(it, object : GetResultCallback {
|
dealRequestResult(it, object : GetResultCallback {
|
||||||
override fun onResult(any: Any) {
|
override fun onResult(any: Any) {
|
||||||
|
showNoCancelableLoading(false)
|
||||||
it.getOrNull()?.let { userBean ->
|
it.getOrNull()?.let { userBean ->
|
||||||
Util.dealLoginSuccessData(mContext, userBean)
|
|
||||||
showToast(R.string.txt_login_successful, gravity = Gravity.CENTER)
|
showToast(R.string.txt_login_successful, gravity = Gravity.CENTER)
|
||||||
|
Util.dealLoginSuccessData(mContext, userBean, false)
|
||||||
Util.loginSuccessGo(this@SayHelloActivity, mViewBinding.root)
|
Util.loginSuccessGo(this@SayHelloActivity, mViewBinding.root)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onInterceptCode() {
|
override fun onInterceptCode() {
|
||||||
|
showNoCancelableLoading(false)
|
||||||
setButtonEnabled(
|
setButtonEnabled(
|
||||||
mViewBinding.btnSayHelloLoginWechat, ConstantInt.Type1
|
mViewBinding.btnSayHelloLoginWechat, ConstantInt.Type1
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onRequestError(exceptionCode: String?) {
|
override fun onRequestError(exceptionCode: String?) {
|
||||||
|
showNoCancelableLoading(false)
|
||||||
setButtonEnabled(
|
setButtonEnabled(
|
||||||
mViewBinding.btnSayHelloLoginWechat, ConstantInt.Type1
|
mViewBinding.btnSayHelloLoginWechat, ConstantInt.Type1
|
||||||
)
|
)
|
||||||
exceptionCode?.let { code ->
|
exceptionCode?.let { code ->
|
||||||
if (code == ErrorCode.USER_NO_EXIST.toString()) {
|
if (code == ErrorCode.WX_NO_EXIST.toString()) {
|
||||||
Intent(mContext, WXLoginActivity::class.java).let { i ->
|
Intent(mContext, WXLoginActivity::class.java).let { i ->
|
||||||
i.putExtra(MMKVKey.CountryCode, mWXCode)
|
i.putExtra(MMKVKey.CountryCode, mOpenid)
|
||||||
startActivity(i)
|
startActivity(i)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -110,6 +113,7 @@ class SayHelloActivity : BaseActivity<ActivitySayHelloBinding>(ActivitySayHelloB
|
|||||||
}
|
}
|
||||||
|
|
||||||
btnSayHelloLoginWechat -> {
|
btnSayHelloLoginWechat -> {
|
||||||
|
showNoCancelableLoading(true)
|
||||||
setButtonEnabled(
|
setButtonEnabled(
|
||||||
mViewBinding.btnSayHelloLoginWechat, ConstantInt.Type0
|
mViewBinding.btnSayHelloLoginWechat, ConstantInt.Type0
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -8,10 +8,11 @@ import com.abbidot.tracker.ui.fragment.account.EmailValidFragment
|
|||||||
import com.abbidot.tracker.ui.fragment.account.cn.AccountCnPhoneFragment
|
import com.abbidot.tracker.ui.fragment.account.cn.AccountCnPhoneFragment
|
||||||
|
|
||||||
class WXLoginActivity : AddEmailValidActivity() {
|
class WXLoginActivity : AddEmailValidActivity() {
|
||||||
private var mWXCode = ""
|
private var mWXOpenid = ""
|
||||||
override fun initData() {
|
override fun initData() {
|
||||||
mWXCode = intent.getStringExtra(MMKVKey.CountryCode) ?: ""
|
mWXOpenid = intent.getStringExtra(MMKVKey.CountryCode) ?: ""
|
||||||
mEmailValidFragment = EmailValidFragment.newInstance(this, ConstantInt.Type4) {
|
mEmailValidFragment =
|
||||||
|
EmailValidFragment.newInstance(this, ConstantInt.Type4, openid = mWXOpenid) {
|
||||||
switchFragment(2)
|
switchFragment(2)
|
||||||
}.apply {
|
}.apply {
|
||||||
mFragmentList.add(
|
mFragmentList.add(
|
||||||
@@ -22,7 +23,7 @@ class WXLoginActivity : AddEmailValidActivity() {
|
|||||||
mFragmentList.add(this)
|
mFragmentList.add(this)
|
||||||
mFragmentList.add(
|
mFragmentList.add(
|
||||||
CreateAccountV2ThreeFragment.newInstance(
|
CreateAccountV2ThreeFragment.newInstance(
|
||||||
this@WXLoginActivity, mWXCode
|
this@WXLoginActivity, mWXOpenid
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -172,7 +172,9 @@ class LiveActivityV3 : BaseActivity<ActivityLiveV3Binding>(ActivityLiveV3Binding
|
|||||||
Utils.DATE_FORMAT_PATTERN_EN12,
|
Utils.DATE_FORMAT_PATTERN_EN12,
|
||||||
isLiveJump
|
isLiveJump
|
||||||
) { mapLoadOk() }
|
) { mapLoadOk() }
|
||||||
if (AppUtils.isChina()) BaiduLocationManager.setScanSpan(10)
|
|
||||||
|
if (AppUtils.isChina()) BaiduLocationManager.setScanSpan(15)
|
||||||
|
|
||||||
ViewUtil.instance.setMapSwitchLocationButtonImage(
|
ViewUtil.instance.setMapSwitchLocationButtonImage(
|
||||||
ivMapLiveV2RefreshBtn, mShowCenterLocation
|
ivMapLiveV2RefreshBtn, mShowCenterLocation
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -44,6 +44,7 @@ open class EmailValidFragment : BaseFragment<FragmentBaseEmailValidBinding>(
|
|||||||
private var mEmail = ""
|
private var mEmail = ""
|
||||||
private var mBtnString = ""
|
private var mBtnString = ""
|
||||||
private var mVerifyCodeType = 0
|
private var mVerifyCodeType = 0
|
||||||
|
private var mOpenid = ""
|
||||||
|
|
||||||
private var mOnOkClickListener: OnClickListener? = null
|
private var mOnOkClickListener: OnClickListener? = null
|
||||||
|
|
||||||
@@ -53,9 +54,11 @@ open class EmailValidFragment : BaseFragment<FragmentBaseEmailValidBinding>(
|
|||||||
context: Context,
|
context: Context,
|
||||||
verifyCodeType: Int,
|
verifyCodeType: Int,
|
||||||
btnString: String = "",
|
btnString: String = "",
|
||||||
|
openid: String = "",
|
||||||
okClickListener: OnClickListener
|
okClickListener: OnClickListener
|
||||||
) = EmailValidFragment().apply {
|
) = EmailValidFragment().apply {
|
||||||
mContext = context
|
mContext = context
|
||||||
|
mOpenid = openid
|
||||||
mBtnString = btnString
|
mBtnString = btnString
|
||||||
mVerifyCodeType = verifyCodeType
|
mVerifyCodeType = verifyCodeType
|
||||||
mOnOkClickListener = okClickListener
|
mOnOkClickListener = okClickListener
|
||||||
@@ -209,9 +212,9 @@ open class EmailValidFragment : BaseFragment<FragmentBaseEmailValidBinding>(
|
|||||||
)
|
)
|
||||||
if (mVerifyCodeType == ConstantInt.Type4) {
|
if (mVerifyCodeType == ConstantInt.Type4) {
|
||||||
exceptionCode?.let { code ->
|
exceptionCode?.let { code ->
|
||||||
if (code == "519") {
|
if (code == ErrorCode.PHONE_NO_REGISTER.toString()) {
|
||||||
mOnOkClickListener?.onClick(view)
|
mOnOkClickListener?.onClick(view)
|
||||||
} else if (code == "520") {
|
} else if (code == ErrorCode.PHONE_HAS_BIND.toString()) {
|
||||||
showToast(
|
showToast(
|
||||||
R.string.txt_phone_has_bound, gravity = Gravity.CENTER
|
R.string.txt_phone_has_bound, gravity = Gravity.CENTER
|
||||||
)
|
)
|
||||||
@@ -301,15 +304,25 @@ open class EmailValidFragment : BaseFragment<FragmentBaseEmailValidBinding>(
|
|||||||
|
|
||||||
setButtonEnabled(mViewBinding.btnForgotPasswordV2TwoContinue, ConstantInt.Type0)
|
setButtonEnabled(mViewBinding.btnForgotPasswordV2TwoContinue, ConstantInt.Type0)
|
||||||
if (AppUtils.isChina()) {
|
if (AppUtils.isChina()) {
|
||||||
if (mVerifyCodeType == ConstantInt.Type3) {
|
when (mVerifyCodeType) {
|
||||||
|
ConstantInt.Type3 -> {
|
||||||
mLoginCNViewModel.phoneLogin(
|
mLoginCNViewModel.phoneLogin(
|
||||||
this@EmailValidFragment, mEmail, content
|
this@EmailValidFragment, mEmail, content
|
||||||
)
|
)
|
||||||
} else {
|
}
|
||||||
|
|
||||||
|
ConstantInt.Type4 -> {
|
||||||
mRegisterCNViewModel.validatePhoneCode(
|
mRegisterCNViewModel.validatePhoneCode(
|
||||||
this@EmailValidFragment, mEmail, content, mVerifyCodeType
|
this@EmailValidFragment, mEmail, content, mVerifyCodeType, mOpenid
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
else -> {
|
||||||
|
mRegisterCNViewModel.validatePhoneCode(
|
||||||
|
this@EmailValidFragment, mEmail, content, mVerifyCodeType, ""
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
mRegisterViewModel.validateCode(
|
mRegisterViewModel.validateCode(
|
||||||
this@EmailValidFragment, mEmail, content, mVerifyCodeType
|
this@EmailValidFragment, mEmail, content, mVerifyCodeType
|
||||||
|
|||||||
@@ -561,10 +561,10 @@ class Util {
|
|||||||
/**
|
/**
|
||||||
* 处理登录成功后的数据
|
* 处理登录成功后的数据
|
||||||
*/
|
*/
|
||||||
fun dealLoginSuccessData(context: Context, userBean: UserBean) {
|
fun dealLoginSuccessData(
|
||||||
|
context: Context, userBean: UserBean, isNotifyFinish: Boolean = true
|
||||||
|
) {
|
||||||
LogUtil.e("处理登录成功后的数据:$userBean")
|
LogUtil.e("处理登录成功后的数据:$userBean")
|
||||||
//通知相关页面关闭
|
|
||||||
XEventBus.post(EventName.FinishActivity)
|
|
||||||
userBean.apply {
|
userBean.apply {
|
||||||
MMKVUtil.putString(MMKVKey.UserId, userId)
|
MMKVUtil.putString(MMKVKey.UserId, userId)
|
||||||
MMKVUtil.putString(MMKVKey.Email, email)
|
MMKVUtil.putString(MMKVKey.Email, email)
|
||||||
@@ -580,6 +580,8 @@ class Util {
|
|||||||
//极光推送设置别名
|
//极光推送设置别名
|
||||||
JPushInterface.setAlias(context, rand.nextInt(1000), userId)
|
JPushInterface.setAlias(context, rand.nextInt(1000), userId)
|
||||||
}
|
}
|
||||||
|
//通知相关页面关闭
|
||||||
|
if (isNotifyFinish) XEventBus.post(EventName.FinishActivity)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ import kotlinx.coroutines.launch
|
|||||||
class RegisterCNViewModel : ViewModel() {
|
class RegisterCNViewModel : ViewModel() {
|
||||||
val mSendCodeResultLiveData = MutableLiveData<Result<String>>()
|
val mSendCodeResultLiveData = MutableLiveData<Result<String>>()
|
||||||
val mValidateCodeResultLiveData = MutableLiveData<Result<UserBean>>()
|
val mValidateCodeResultLiveData = MutableLiveData<Result<UserBean>>()
|
||||||
|
|
||||||
// val mPhoneRegisterResultLiveData = MutableLiveData<Result<String>>()
|
// val mPhoneRegisterResultLiveData = MutableLiveData<Result<String>>()
|
||||||
val mSetNewPasswordResultLiveData = MutableLiveData<Result<String>>()
|
val mSetNewPasswordResultLiveData = MutableLiveData<Result<String>>()
|
||||||
|
|
||||||
@@ -35,10 +36,12 @@ class RegisterCNViewModel : ViewModel() {
|
|||||||
/**
|
/**
|
||||||
* 手机号验证码验证
|
* 手机号验证码验证
|
||||||
*/
|
*/
|
||||||
fun validatePhoneCode(fragment: BaseFragment<*>, phone: String, code: String, type: Int) {
|
fun validatePhoneCode(
|
||||||
|
fragment: BaseFragment<*>, phone: String, code: String, type: Int, openidIdentifier: String
|
||||||
|
) {
|
||||||
fragment.showLoading(true)
|
fragment.showLoading(true)
|
||||||
viewModelScope.launch {
|
viewModelScope.launch {
|
||||||
val result = NetworkApi.validatePhoneCode(phone, code, type)
|
val result = NetworkApi.validatePhoneCode(phone, code, type, openidIdentifier)
|
||||||
mValidateCodeResultLiveData.value = result
|
mValidateCodeResultLiveData.value = result
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,8 @@
|
|||||||
package com.abbidot.tracker.wxapi
|
package com.abbidot.tracker.wxapi
|
||||||
|
|
||||||
|
import com.abbidot.baselibrary.constant.EventName
|
||||||
|
import com.abbidot.baselibrary.eventbus.XEventBus
|
||||||
|
import com.abbidot.baselibrary.network.exception.ErrorCode
|
||||||
import com.abbidot.baselibrary.util.LogUtil
|
import com.abbidot.baselibrary.util.LogUtil
|
||||||
import com.abbidot.tracker.vm.cn.LoginCNViewModel
|
import com.abbidot.tracker.vm.cn.LoginCNViewModel
|
||||||
import com.hjq.toast.Toaster
|
import com.hjq.toast.Toaster
|
||||||
@@ -22,7 +25,17 @@ class WXEntryActivity : WXBaseActivity() {
|
|||||||
override fun initData() {
|
override fun initData() {
|
||||||
mLoginCNViewModel.mWXLoginResultLiveData.observe(this) {
|
mLoginCNViewModel.mWXLoginResultLiveData.observe(this) {
|
||||||
LogUtil.e("mWXLoginResultLiveData:$it")
|
LogUtil.e("mWXLoginResultLiveData:$it")
|
||||||
// XEventBus.post(EventName.WXLoginResult, it)
|
if (null != it.exceptionOrNull()) {
|
||||||
|
//服务器返回错误信息
|
||||||
|
val exceptionMessage = it.exceptionOrNull()?.message
|
||||||
|
//服务器返回错误code
|
||||||
|
val exceptionCode = it.exceptionOrNull()?.toString()
|
||||||
|
if (exceptionCode == ErrorCode.WX_NO_EXIST.toString()) {
|
||||||
|
//传递openid
|
||||||
|
XEventBus.post(EventName.PostValue, exceptionMessage)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
XEventBus.post(EventName.WXLoginResult, it)
|
||||||
finish()
|
finish()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -35,8 +48,7 @@ class WXEntryActivity : WXBaseActivity() {
|
|||||||
BaseResp.ErrCode.ERR_OK -> {
|
BaseResp.ErrCode.ERR_OK -> {
|
||||||
result = "登录成功"
|
result = "登录成功"
|
||||||
val code = r.code
|
val code = r.code
|
||||||
LogUtil.e("${result}TAG_WECHAT_CODE:${r.openId}")
|
LogUtil.e("${result}TAG_WECHAT_CODE:$code")
|
||||||
// XEventBus.post(EventName.PostValue, code)
|
|
||||||
mLoginCNViewModel.wxLogin(code)
|
mLoginCNViewModel.wxLogin(code)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -85,8 +85,8 @@ abstract class BaseNetworkApi<I>(private val baseUrl: String) : IService<I> {
|
|||||||
return Result.success("${ErrorCode.CREDIT_CARD_PAY_FAIL}" as T)
|
return Result.success("${ErrorCode.CREDIT_CARD_PAY_FAIL}" as T)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//设备已被绑定
|
//设备已被绑定 微信绑定不存在
|
||||||
else if (response.code == ErrorCode.DEVICE_HAS_BIND) {
|
else if (response.code == ErrorCode.DEVICE_HAS_BIND || response.code == ErrorCode.WX_NO_EXIST) {
|
||||||
throw NetworkErrorCodeException.of(response.code, response.message + "")
|
throw NetworkErrorCodeException.of(response.code, response.message + "")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -7,5 +7,6 @@ data class BaseResponse<T>(
|
|||||||
var code: Int = 0,
|
var code: Int = 0,
|
||||||
val message: String? = null,
|
val message: String? = null,
|
||||||
val redirect: String? = null,
|
val redirect: String? = null,
|
||||||
val data: T? = null
|
val data: T? = null,
|
||||||
|
val errorData: ErrorDataBean? = null
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -0,0 +1,3 @@
|
|||||||
|
package com.abbidot.baselibrary.network.base
|
||||||
|
|
||||||
|
data class ErrorDataBean(val openid: String)
|
||||||
@@ -18,6 +18,9 @@ import androidx.annotation.IntDef
|
|||||||
ErrorCode.EMAIL_FORMAT_ERROR,
|
ErrorCode.EMAIL_FORMAT_ERROR,
|
||||||
ErrorCode.NO_SHARE_MYSELF,
|
ErrorCode.NO_SHARE_MYSELF,
|
||||||
ErrorCode.DEVICE_HAS_BOUND,
|
ErrorCode.DEVICE_HAS_BOUND,
|
||||||
|
ErrorCode.WX_NO_EXIST,
|
||||||
|
ErrorCode.PHONE_NO_REGISTER,
|
||||||
|
ErrorCode.PHONE_HAS_BIND,
|
||||||
ErrorCode.DEVICE_HAS_BIND,
|
ErrorCode.DEVICE_HAS_BIND,
|
||||||
ErrorCode.DEVICE_NOT_EXIST
|
ErrorCode.DEVICE_NOT_EXIST
|
||||||
)
|
)
|
||||||
@@ -69,6 +72,12 @@ annotation class ErrorCode {
|
|||||||
|
|
||||||
//515 设备未存在
|
//515 设备未存在
|
||||||
const val DEVICE_NOT_EXIST = 515
|
const val DEVICE_NOT_EXIST = 515
|
||||||
|
//519 手机号未注册
|
||||||
|
const val PHONE_NO_REGISTER = 519
|
||||||
|
//520 手机号已绑定
|
||||||
|
const val PHONE_HAS_BIND = 520
|
||||||
|
//微信绑定不存在
|
||||||
|
const val WX_NO_EXIST = 521
|
||||||
|
|
||||||
//信用卡支付成功
|
//信用卡支付成功
|
||||||
const val CREDIT_CARD_PAY_SUCCESS = 1
|
const val CREDIT_CARD_PAY_SUCCESS = 1
|
||||||
|
|||||||
Reference in New Issue
Block a user