Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Y
YDL-Component-Medical
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
杨凯
YDL-Component-Medical
Commits
87a829ff
Commit
87a829ff
authored
Mar 17, 2021
by
YKai
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat:m-user组件升级,强绑手机号
parent
dd01e2b0
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
70 additions
and
26 deletions
+70
-26
config.gradle
config.gradle
+1
-1
LoginApiRequestUtil.kt
m-user/src/main/java/com/yidianling/user/http/LoginApiRequestUtil.kt
+9
-0
UserApi.kt
m-user/src/main/java/com/yidianling/user/http/UserApi.kt
+12
-1
BindPhoneActivity.kt
m-user/src/main/java/com/yidianling/user/ui/login/BindPhoneActivity.kt
+34
-5
RegisterAndLoginActivity.kt
m-user/src/main/java/com/yidianling/user/ui/login/RegisterAndLoginActivity.kt
+2
-2
ILoginContract.kt
m-user/src/main/java/com/yidianling/user/ui/login/contract/ILoginContract.kt
+1
-1
LoginPresenterImpl.kt
m-user/src/main/java/com/yidianling/user/ui/login/presenter/LoginPresenterImpl.kt
+10
-16
activity_bind_phone.xml
m-user/src/main/res/layout/activity_bind_phone.xml
+1
-0
No files found.
config.gradle
View file @
87a829ff
...
@@ -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.1
1
"
,
"m-user"
:
"0.0.61.1
4
"
,
"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"
,
...
...
m-user/src/main/java/com/yidianling/user/http/LoginApiRequestUtil.kt
View file @
87a829ff
...
@@ -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
m-user/src/main/java/com/yidianling/user/http/UserApi.kt
View file @
87a829ff
...
@@ -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
m-user/src/main/java/com/yidianling/user/ui/login/BindPhoneActivity.kt
View file @
87a829ff
...
@@ -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
()
{
...
...
m-user/src/main/java/com/yidianling/user/ui/login/RegisterAndLoginActivity.kt
View file @
87a829ff
...
@@ -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
{
...
...
m-user/src/main/java/com/yidianling/user/ui/login/contract/ILoginContract.kt
View file @
87a829ff
...
@@ -44,7 +44,7 @@ interface ILoginContract {
...
@@ -44,7 +44,7 @@ interface ILoginContract {
/**
/**
* 三方登录成功
* 三方登录成功
*/
*/
fun
thirdLoginSuccess
(
userInfo
:
UserResponseBean
.
UserInfo
)
fun
thirdLoginSuccess
(
userInfo
:
UserResponseBean
.
UserInfo
,
thirdLoginPlatform
:
String
)
/**
/**
* 弹窗
* 弹窗
...
...
m-user/src/main/java/com/yidianling/user/ui/login/presenter/LoginPresenterImpl.kt
View file @
87a829ff
...
@@ -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
()
...
...
m-user/src/main/res/layout/activity_bind_phone.xml
View file @
87a829ff
...
@@ -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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment