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
a2965c7e
Commit
a2965c7e
authored
Jan 11, 2021
by
YKai
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat:登录代码提交
parent
15c1f497
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
22 changed files
with
307 additions
and
44 deletions
+307
-44
config.gradle
config.gradle
+3
-3
build.gradle
m-user/build.gradle
+1
-2
crashshield-release.aar
m-user/libs/crashshield-release.aar
+0
-0
EncryptionParams.java
m-user/src/main/java/com/yidianling/user/http/EncryptionParams.java
+56
-0
LoginApiRequestUtil.kt
m-user/src/main/java/com/yidianling/user/http/LoginApiRequestUtil.kt
+3
-2
MD5.java
m-user/src/main/java/com/yidianling/user/http/MD5.java
+37
-0
UserApi.kt
m-user/src/main/java/com/yidianling/user/http/UserApi.kt
+5
-8
PhoneLoginAutoParam.kt
m-user/src/main/java/com/yidianling/user/http/request/PhoneLoginAutoParam.kt
+6
-1
AccountSettingActivity.java
m-user/src/main/java/com/yidianling/user/mine/AccountSettingActivity.java
+3
-1
OneKeyLoginHelp.kt
m-user/src/main/java/com/yidianling/user/ui/login/OneKeyLoginHelp.kt
+72
-6
RegisterAndLoginActivity.kt
m-user/src/main/java/com/yidianling/user/ui/login/RegisterAndLoginActivity.kt
+11
-5
ILoginContract.kt
m-user/src/main/java/com/yidianling/user/ui/login/contract/ILoginContract.kt
+2
-2
LoginModelImpl.kt
m-user/src/main/java/com/yidianling/user/ui/login/model/LoginModelImpl.kt
+2
-2
LoginPresenterImpl.kt
m-user/src/main/java/com/yidianling/user/ui/login/presenter/LoginPresenterImpl.kt
+2
-2
testLoginActivity.kt
m-user/src/main/java/com/yidianling/user/ui/login/testLoginActivity.kt
+0
-0
EncryptionParams.java
ydl-platform/src/main/java/com/ydl/ydlcommon/base/config/EncryptionParams.java
+50
-0
GlobalConfig.kt
ydl-platform/src/main/java/com/ydl/ydlcommon/base/config/GlobalConfig.kt
+2
-1
HttpConfig.kt
ydl-platform/src/main/java/com/ydl/ydlcommon/base/config/HttpConfig.kt
+31
-5
GatewayRequestDTO.kt
ydl-platform/src/main/java/com/ydl/ydlcommon/bean/GatewayRequestDTO.kt
+9
-0
ApiRequestUtil.java
ydl-platform/src/main/java/com/ydl/ydlcommon/data/http/api/ApiRequestUtil.java
+4
-2
NetApiStore.java
ydl-platform/src/main/java/com/ydl/ydlcommon/data/http/api/NetApiStore.java
+2
-2
api.properties
ydl-platform/src/main/res/raw/api.properties
+6
-0
No files found.
config.gradle
View file @
a2965c7e
...
...
@@ -8,7 +8,7 @@ ext {
"m-confide"
:
"0.0.48.91"
,
"m-consultant"
:
"0.0.59.40"
,
"m-fm"
:
"0.0.30.00"
,
"m-user"
:
"0.0.60.
38
"
,
"m-user"
:
"0.0.60.
44
"
,
"m-home"
:
"0.0.22.51"
,
"m-im"
:
"0.0.18.30"
,
"m-dynamic"
:
"0.0.7.13"
,
...
...
@@ -33,7 +33,7 @@ ext {
//-------------- 功能组件 --------------
//第一步
"ydl-platform"
:
"0.0.39.6
6
"
,
"ydl-platform"
:
"0.0.39.6
7
"
,
//第二步 若干
"ydl-webview"
:
"0.0.38.33"
,
...
...
@@ -91,7 +91,7 @@ ext {
"m-confide"
:
"0.0.48.91"
,
"m-consultant"
:
"0.0.51.16"
,
"m-fm"
:
"0.0.23.5"
,
"m-user"
:
"0.0.60.
37
"
,
"m-user"
:
"0.0.60.
43
"
,
"m-home"
:
"0.0.22.51"
,
"m-im"
:
"0.0.3.15"
,
"m-dynamic"
:
"0.0.1.7"
,
...
...
m-user/build.gradle
View file @
a2965c7e
...
...
@@ -65,6 +65,7 @@ android {
}
}
compileOptions
{
sourceCompatibility
JavaVersion
.
VERSION_1_8
targetCompatibility
JavaVersion
.
VERSION_1_8
...
...
@@ -79,8 +80,6 @@ dependencies {
androidTestImplementation
'com.android.support.test.espresso:espresso-core:3.0.2'
kapt
'com.alibaba:arouter-compiler:1.2.2'
implementation
"org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
// crashshield-release.aar依赖了uc的crash收集库,因此还需要集成uc的crash收集库。
implementation
'com.ucweb.wpk:crashsdk-java:3.2.0.1'
api
rootProject
.
ext
.
dependencies
[
"ydl-user-router"
]
if
(
rootProject
.
ext
.
dev_mode
){
...
...
m-user/libs/crashshield-release.aar
deleted
100644 → 0
View file @
15c1f497
File deleted
m-user/src/main/java/com/yidianling/user/http/EncryptionParams.java
0 → 100644
View file @
a2965c7e
package
com
.
yidianling
.
user
.
http
;
import
android.os.Build
;
import
android.support.annotation.RequiresApi
;
import
android.util.Log
;
import
com.ydl.burypointlib.MD5Util
;
import
com.ydl.ydlcommon.base.BaseApp
;
import
com.ydl.ydlcommon.base.config.HttpConfig
;
import
com.yidianling.common.tools.RxAppTool
;
import
java.util.Arrays
;
import
java.util.Comparator
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.stream.Collectors
;
/**
* Created by Ykai on 2021/1/11.
*
* 获取加密参数类
*/
public
class
EncryptionParams
{
@RequiresApi
(
api
=
Build
.
VERSION_CODES
.
N
)
public
static
Map
<
String
,
String
>
getParams
(
String
path
){
String
timestamp
=
String
.
valueOf
(
System
.
currentTimeMillis
());
//值应该为毫秒数的字符串形式
Map
<
String
,
String
>
map
=
new
HashMap
<>();
map
.
put
(
"timestamp"
,
timestamp
);
map
.
put
(
"path"
,
path
);
map
.
put
(
"version"
,
"1.0.0"
);
List
<
String
>
storedKeys
=
Arrays
.
stream
(
map
.
keySet
()
.
toArray
(
new
String
[]{}))
.
sorted
(
Comparator
.
naturalOrder
())
.
collect
(
Collectors
.
toList
());
String
sign
=
storedKeys
.
stream
()
// .map(key -> String.join("", key, map.get(key)))
.
map
(
key
->
key
+
map
.
get
(
key
))
.
collect
(
Collectors
.
joining
()).
trim
()
.
concat
(
"ABA88F2FF7E64A688D2213B20A9B3A3E"
);
Log
.
e
(
"sign"
,
sign
);
sign
=
MD5Util
.
md5
(
sign
).
toUpperCase
();
// sign = MD5.md5(sign).toUpperCase();
Log
.
e
(
"sign"
,
sign
);
Map
<
String
,
String
>
headersMap
=
new
HashMap
<>();
headersMap
.
put
(
"appKey"
,
"20BB42485BD448DE888DD745899C457D"
);
headersMap
.
put
(
"sign"
,
sign
);
// headersMap.put("sign","2410C6CDC7235DC6318F5CF0FFFAA0B7");
headersMap
.
put
(
"timestamp"
,
timestamp
);
// headersMap.put("timestamp","1610352010360");
return
headersMap
;
}
}
m-user/src/main/java/com/yidianling/user/http/LoginApiRequestUtil.kt
View file @
a2965c7e
package
com.yidianling.user.http
import
com.google.gson.Gson
import
com.ydl.ydlcommon.base.config.HttpConfig
import
com.ydl.ydlcommon.data.http.BaseResponse
import
com.ydl.ydlnet.YDLHttpUtils
import
com.yidianling.user.api.bean.UserResponseBean
...
...
@@ -33,8 +34,8 @@ class LoginApiRequestUtil {
/**
* 校验手机号:是否是用户版号码、是否有设置密码、是否被绑定
*/
fun
checkPhoneStatus
(
phone
:
String
,
countryCode
:
String
?):
Observable
<
BaseResponse
<
ChcekPhoneResponeBean
>>
{
return
getUserApi
().
checkPhoneStatus
(
phone
,
countryCode
!!
)
fun
checkPhoneStatus
(
map
:
Map
<
String
,
String
>,
phone
:
String
,
countryCode
:
String
?):
Observable
<
BaseResponse
<
ChcekPhoneResponeBean
>>
{
return
getUserApi
().
checkPhoneStatus
(
map
,
phone
,
countryCode
!!
)
}
/**
...
...
m-user/src/main/java/com/yidianling/user/http/MD5.java
0 → 100644
View file @
a2965c7e
package
com
.
yidianling
.
user
.
http
;
import
java.security.MessageDigest
;
import
java.security.NoSuchAlgorithmException
;
public
class
MD5
{
public
static
final
char
HEX_DIGITS
[]
=
{
'0'
,
'1'
,
'2'
,
'3'
,
'4'
,
'5'
,
'6'
,
'7'
,
'8'
,
'9'
,
'a'
,
'b'
,
'c'
,
'd'
,
'e'
,
'f'
};
public
static
String
toHexString
(
byte
[]
b
)
{
StringBuffer
sb
=
new
StringBuffer
(
b
.
length
*
2
);
for
(
int
i
=
0
;
i
<
b
.
length
;
i
++)
{
sb
.
append
(
HEX_DIGITS
[(
b
[
i
]
&
0xf0
)
>>>
4
]);
sb
.
append
(
HEX_DIGITS
[
b
[
i
]
&
0x0f
]);
}
return
sb
.
toString
();
}
/**
* md5加密字符串
*
* @param s
* @return
*/
public
static
String
md5
(
String
s
)
{
try
{
MessageDigest
digest
=
MessageDigest
.
getInstance
(
"MD5"
);
digest
.
update
(
s
.
getBytes
());
byte
messageDigest
[]
=
digest
.
digest
();
return
toHexString
(
messageDigest
);
}
catch
(
NoSuchAlgorithmException
e
)
{
e
.
printStackTrace
();
}
return
""
;
}
}
m-user/src/main/java/com/yidianling/user/http/UserApi.kt
View file @
a2965c7e
package
com.yidianling.user.http
import
com.google.gson.internal.LinkedTreeMap
import
com.ydl.ydlcommon.base.config.YDLConstants
import
com.ydl.ydlcommon.base.config.YDL_DOMAIN
import
com.ydl.ydlcommon.base.config.YDL_DOMAIN_JAVA
import
com.ydl.ydlcommon.base.config.YDL_DOMAIN_LOGIN_BASE_URL
import
com.ydl.ydlcommon.base.config.*
import
com.ydl.ydlcommon.data.http.BaseAPIResponse
import
com.ydl.ydlcommon.data.http.BaseResponse
import
com.yidianling.user.api.bean.UserResponseBean
...
...
@@ -160,7 +157,7 @@ interface UserApi {
* 绑定手机号
*/
@POST
(
"/login/v2/bind_phone"
)
@Headers
(
YDL_DOMAIN
+
YDL_DOMAIN_LOGIN_BASE_URL
,
LOGIN_USER_PORT
)
@Headers
(
YDL_DOMAIN
+
YDL_DOMAIN_LOGIN_BASE_URL
,
LOGIN_USER_PORT
)
fun
bindPhone
(
@Body
body
:
RequestBody
):
Observable
<
BaseResponse
<
Any
>>
/**
...
...
@@ -197,7 +194,7 @@ interface UserApi {
*/
@GET
(
"login/v2/phone_detection"
)
@Headers
(
YDL_DOMAIN
+
YDL_DOMAIN_LOGIN_BASE_URL
,
LOGIN_USER_PORT
)
fun
checkPhoneStatus
(
@Query
(
"phone"
)
phone
:
String
,
@Query
(
"countryCode"
)
countryCode
:
String
):
Observable
<
BaseResponse
<
ChcekPhoneResponeBean
>>
fun
checkPhoneStatus
(
@
HeaderMap
headMap
:
Map
<
String
,
String
>,
@
Query
(
"phone"
)
phone
:
String
,
@Query
(
"countryCode"
)
countryCode
:
String
):
Observable
<
BaseResponse
<
ChcekPhoneResponeBean
>>
/**
* 验证重置密码的短信验证码
...
...
@@ -210,14 +207,14 @@ interface UserApi {
* 重置密码
*/
@POST
(
"/login/v2/reset_pwd"
)
@Headers
(
YDL_DOMAIN
+
YDL_DOMAIN_
JAVA
)
@Headers
(
YDL_DOMAIN
+
YDL_DOMAIN_
LOGIN_BASE_URL
,
LOGIN_USER_PORT
)
fun
resetPwd
(
@Body
body
:
RequestBody
):
Observable
<
BaseResponse
<
UserResponseBean
>>
/**
* 发送登录验证码
*/
@GET
(
"user/send_login_sms"
)
@Headers
(
YDL_DOMAIN
+
YDL_DOMAIN_
JAVA
)
@Headers
(
YDL_DOMAIN
+
YDL_DOMAIN_
LOGIN_BASE_URL
,
LOGIN_USER_PORT
)
fun
sendLoginMsgCode
(
@Query
(
"phone"
)
phone
:
String
,
@Query
(
"countryCode"
)
countryCode
:
String
):
Observable
<
BaseResponse
<
Any
>>
/**
...
...
m-user/src/main/java/com/yidianling/user/http/request/PhoneLoginAutoParam.kt
View file @
a2965c7e
...
...
@@ -9,6 +9,10 @@ package com.yidianling.user.http.request
*/
data class
PhoneLoginAutoParam
(
var
accessCode
:
String
,
//sdk token
var
channelId
:
String
?,
var
deviceType
:
Int
=
2
,
var
directType
:
Int
,
// 登录类型:1本机号码检验(需要传手机号和token); 2一键登录(只需要token)
var
phoneNumber
:
String
,
//手机号
var
type
:
Int
=
2
var
version
:
String
)
\ No newline at end of file
m-user/src/main/java/com/yidianling/user/mine/AccountSettingActivity.java
View file @
a2965c7e
...
...
@@ -31,6 +31,7 @@ import com.yidianling.user.UserConstants;
import
com.yidianling.user.UserHelper
;
import
com.yidianling.user.api.event.RefreshRecentContactListEvent
;
import
com.yidianling.user.event.UpdateBindStatusEvent
;
import
com.yidianling.user.http.EncryptionParams
;
import
com.yidianling.user.http.LoginApiRequestUtil
;
import
com.yidianling.user.http.UserHttp
;
import
com.yidianling.user.http.UserHttpImpl
;
...
...
@@ -117,7 +118,8 @@ public class AccountSettingActivity extends BaseActivity implements View.OnClick
return
;
}
showProgressDialog
();
LoginApiRequestUtil
.
Companion
.
checkPhoneStatus
(
UserHelper
.
INSTANCE
.
getUserInfo
().
getUserInfo
().
getPhone
(),
UserHelper
.
INSTANCE
.
getUserInfo
().
getUserInfo
().
getCountry_code
())
Map
<
String
,
String
>
map
=
EncryptionParams
.
getParams
(
"/api/api/login/v2/phone_detection"
);
LoginApiRequestUtil
.
Companion
.
checkPhoneStatus
(
map
,
UserHelper
.
INSTANCE
.
getUserInfo
().
getUserInfo
().
getPhone
(),
UserHelper
.
INSTANCE
.
getUserInfo
().
getUserInfo
().
getCountry_code
())
.
subscribeOn
(
Schedulers
.
io
())
.
observeOn
(
AndroidSchedulers
.
mainThread
())
.
subscribe
(
response
->
{
...
...
m-user/src/main/java/com/yidianling/user/ui/login/OneKeyLoginHelp.kt
View file @
a2965c7e
...
...
@@ -2,6 +2,7 @@ package com.yidianling.user.ui.login
import
android.content.pm.ActivityInfo
import
android.graphics.Color
import
android.text.TextUtils
import
android.util.TypedValue
import
android.view.Gravity
import
android.view.View
...
...
@@ -13,12 +14,30 @@ import com.meituan.android.walle.WalleChannelReader
import
com.mobile.auth.gatewayauth.*
import
com.mobile.auth.gatewayauth.model.TokenRet
import
com.ydl.ydlcommon.base.BaseActivity
import
com.ydl.ydlcommon.base.BaseApp
import
com.ydl.ydlcommon.base.config.HttpConfig
import
com.ydl.ydlcommon.base.config.YDL_DOMAIN_LOGIN_BASE_URL
import
com.ydl.ydlcommon.utils.ActivityManager
import
com.ydl.ydlcommon.utils.JPushUtils
import
com.ydl.ydlcommon.utils.LogUtil
import
com.ydl.ydlcommon.utils.YDLCacheUtils
import
com.ydl.ydlcommon.utils.actionutil.ActionCountUtils
import
com.ydl.ydlcommon.utils.log.LogHelper
import
com.ydl.ydlnet.builder.manage.HttpUrlManager
import
com.yidianling.common.tools.RxAppTool
import
com.yidianling.common.tools.RxDeviceTool
import
com.yidianling.common.tools.RxImageTool
import
com.yidianling.user.LoginUtils
import
com.yidianling.user.StatusUtils
import
com.yidianling.user.api.bean.UserResponseBean
import
com.yidianling.user.bean.AliAuthBean
import
com.yidianling.user.constants.UserBIConstants
import
com.yidianling.user.http.LoginApiRequestUtil
import
com.yidianling.user.http.request.PhoneLoginAutoParam
import
com.yidianling.user.route.UserIn
import
io.reactivex.android.schedulers.AndroidSchedulers
import
io.reactivex.schedulers.Schedulers
import
java.math.BigDecimal
/**
* Created by Ykai on 2020/12/22.
...
...
@@ -59,8 +78,6 @@ object OneKeyLoginHelp {
it
.
setAuthSDKInfo
(
YDL_EXPERT_APP_KEY
)
}
}
// 配置动态网关
HttpUrlManager
.
Companion
.
getInstance
()
?.
addUrl
(
YDL_DOMAIN_LOGIN_BASE_URL
,
HttpConfig
.
JAVA_LOGIN_BASE_URL
)
// 获取渠道
val
channel
=
WalleChannelReader
.
getChannel
(
activity
)
checkBoxHidden
=
!(
channel
==
"huawei"
||
channel
==
"vivo"
)
...
...
@@ -314,9 +331,32 @@ object OneKeyLoginHelp {
LogUtil
.
e
(
"唤起授权页成功:$s"
)
}
ResultCode
.
CODE_SUCCESS
->
{
// 获取token成功
val
token
=
tokenRet
.
token
mPhoneNumberAuthHelper
?.
setAuthListener
(
null
)
mIsGetTokenSuccess
=
false
val
param
=
PhoneLoginAutoParam
(
tokenRet
.
token
,
JPushUtils
.
getRegistrationID
(),
2
,
2
,
""
,
RxAppTool
.
getAppVersionName
(
BaseApp
.
Companion
.
getApp
()))
LoginApiRequestUtil
.
autoLogin
(
param
)
.
subscribeOn
(
Schedulers
.
io
())
.
observeOn
(
AndroidSchedulers
.
mainThread
())
.
subscribe
({
if
(
it
.
code
==
200
)
{
saveUserData
(
it
.
data
)
if
(
it
.
data
.
firstLogin
==
1
)
{
//第一次登录:是注册
StatusUtils
.
isFirstLogin
=
true
// 埋点
ActionCountUtils
.
baiduCount
(
it
.
data
.
uid
,
UserBIConstants
.
APP_REGISTER_PAGE
,
UserBIConstants
.
POSITION_ALIYUN_REGISTER_CLICK
,
""
,
""
,
25
)
}
else
{
ActionCountUtils
.
countUid
(
UserBIConstants
.
POSITION_LOGIN_SUCCESS_CLICK
,
it
.
data
.
uid
!!
,
UserBIConstants
.
ACTION_TYPE_DIRECT_LOGIN
)
}
mPhoneNumberAuthHelper
?.
let
{
helper
->
helper
.
hideLoginLoading
()
helper
.
quitLoginPage
()
helper
.
setAuthListener
(
null
)
}
mIsGetTokenSuccess
=
false
LoginUtils
.
LoginSuccessOperate
(
mActivity
)
}
},
{
toLoginActivity
()
})
}
}
}
...
...
@@ -334,7 +374,10 @@ object OneKeyLoginHelp {
// 一键登录
when
(
tokenRet
.
code
)
{
ResultCode
.
CODE_ERROR_USER_CANCEL
->
{
// 用户主动取消一键登录
if
(
mIsFromGuide
){
// 如果是从引导页首次打开
ActivityManager
.
finishOtherActivity
(
mActivity
)
UserIn
.
mainIntent
(
mActivity
,
4
)
}
}
else
->
{
// 其它失败原因
// 跳转到原生登录界面
...
...
@@ -359,4 +402,27 @@ object OneKeyLoginHelp {
verifyTokenResultListener
=
listener
}
/**
* 保存登录信息
*/
private
fun
saveUserData
(
userResponse
:
UserResponseBean
)
{
if
(!
TextUtils
.
isEmpty
(
userResponse
.
userInfo
!!
.
phone
))
{
YDLCacheUtils
.
saveUserPhone
(
userResponse
.
userInfo
!!
.
phone
)
YDLCacheUtils
.
saveCountryPhoneCode
(
userResponse
.
userInfo
!!
.
country_code
)
}
if
(
userResponse
.
uid
!!
.
contains
(
"."
))
{
val
bd
=
BigDecimal
(
userResponse
.
uid
)
var
uid
=
bd
.
toPlainString
()
if
(
uid
.
endsWith
(
".0"
))
{
uid
=
uid
.
replace
(
".0"
,
""
)
}
userResponse
.
userInfo
!!
.
uid
=
uid
userResponse
.
uid
=
uid
}
LoginUtils
.
saveData
(
userResponse
)
LogHelper
.
getInstance
().
writeLogSync
(
"登录成功"
)
LoginUtils
.
onLogin
(
userResponse
)
}
}
m-user/src/main/java/com/yidianling/user/ui/login/RegisterAndLoginActivity.kt
View file @
a2965c7e
...
...
@@ -24,14 +24,17 @@ import com.tbruyelle.rxpermissions2.RxPermissions
import
com.umeng.socialize.UMShareAPI
import
com.umeng.socialize.UMShareConfig
import
com.umeng.socialize.bean.SHARE_MEDIA
import
com.ydl.ydlcommon.base.BaseApp
import
com.ydl.ydlcommon.base.BaseMvpActivity
import
com.ydl.ydlcommon.data.PlatformRamImpl
import
com.ydl.ydlcommon.utils.ActivityManager
import
com.ydl.ydlcommon.utils.JPushUtils
import
com.ydl.ydlcommon.utils.StatusBarUtils
import
com.ydl.ydlcommon.utils.YDLCacheUtils
import
com.ydl.ydlcommon.utils.actionutil.ActionCountUtils
import
com.ydl.ydlcommon.view.dialog.CommonDialog
import
com.yidianling.common.tools.LogUtil
import
com.yidianling.common.tools.RxAppTool
import
com.yidianling.common.tools.RxKeyboardTool
import
com.yidianling.common.tools.ToastUtil
import
com.yidianling.user.LoginUtils
...
...
@@ -41,6 +44,7 @@ import com.yidianling.user.UserHelper
import
com.yidianling.user.api.bean.UserResponseBean
import
com.yidianling.user.bean.AliAuthBean
import
com.yidianling.user.constants.UserBIConstants
import
com.yidianling.user.http.EncryptionParams
import
com.yidianling.user.http.request.BindPhoneJavaParam
import
com.yidianling.user.http.request.PhoneLoginAutoParam
import
com.yidianling.user.http.response.ChcekPhoneResponeBean
...
...
@@ -182,12 +186,12 @@ class RegisterAndLoginActivity : BaseMvpActivity<ILoginContract.View, ILoginCont
}
ResultCode
.
CODE_SUCCESS
->
{
// 获取token成功
val
aliAuthBean
=
AliAuthBean
()
aliAuthBean
.
accessCode
=
result
aliAuthBean
.
accessCode
=
tokenRet
.
token
if
(
isUmengLoginState
)
{
//绑定手机号码
umengLoginBindPhone
(
aliAuthBean
.
accessCode
)
}
else
{
autoLogin
(
aliAuthBea
n
)
autoLogin
(
tokenRet
.
toke
n
)
}
OneKeyLoginHelp
.
mPhoneNumberAuthHelper
?.
setAuthListener
(
null
)
OneKeyLoginHelp
.
mIsGetTokenSuccess
=
false
...
...
@@ -392,7 +396,8 @@ class RegisterAndLoginActivity : BaseMvpActivity<ILoginContract.View, ILoginCont
return
@setOnClickListener
}
if
(
checkPhone
())
{
mPresenter
.
checkPhoneStatus
(
userPhoneNumber
!!
,
countryCode
!!
,
isUmengLoginState
)
val
map
=
EncryptionParams
.
getParams
(
"/api/api/login/v2/phone_detection"
)
mPresenter
.
checkPhoneStatus
(
map
,
userPhoneNumber
!!
,
countryCode
!!
,
isUmengLoginState
)
}
}
...
...
@@ -546,8 +551,9 @@ class RegisterAndLoginActivity : BaseMvpActivity<ILoginContract.View, ILoginCont
/**
* 通过阿里sdk一键认证服务登陆
*/
private
fun
autoLogin
(
bean
:
AliAuthBean
)
{
var
param
=
PhoneLoginAutoParam
(
bean
.
accessCode
!!
,
userPhoneNumber
!!
)
private
fun
autoLogin
(
token
:
String
)
{
val
param
=
PhoneLoginAutoParam
(
token
,
JPushUtils
.
getRegistrationID
(),
2
,
1
,
userPhoneNumber
!!
,
RxAppTool
.
getAppVersionName
(
BaseApp
.
Companion
.
getApp
()))
mPresenter
.
autoLogin
(
param
)
}
...
...
m-user/src/main/java/com/yidianling/user/ui/login/contract/ILoginContract.kt
View file @
a2965c7e
...
...
@@ -97,7 +97,7 @@ interface ILoginContract {
/**
* 校验手机号:是否是用户版号码、是否有设置密码、是否被绑定
*/
fun
checkPhoneStatus
(
phone
:
String
,
countryCode
:
String
,
isBind
:
Boolean
)
fun
checkPhoneStatus
(
map
:
Map
<
String
,
String
>,
phone
:
String
,
countryCode
:
String
,
isBind
:
Boolean
)
/**
* 通过一键认证服务登陆
...
...
@@ -120,7 +120,7 @@ interface ILoginContract {
/**
* 校验手机号:是否是用户版号码、是否有设置密码、是否被绑定
*/
fun
checkPhoneStatus
(
phone
:
String
,
countryCode
:
String
):
Observable
<
BaseResponse
<
ChcekPhoneResponeBean
>>
fun
checkPhoneStatus
(
map
:
Map
<
String
,
String
>,
phone
:
String
,
countryCode
:
String
):
Observable
<
BaseResponse
<
ChcekPhoneResponeBean
>>
/**
...
...
m-user/src/main/java/com/yidianling/user/ui/login/model/LoginModelImpl.kt
View file @
a2965c7e
...
...
@@ -48,8 +48,8 @@ class LoginModelImpl : ILoginContract.Model {
/**
* 校验手机号:是否是用户版号码、是否有设置密码、是否被绑定
*/
override
fun
checkPhoneStatus
(
phone
:
String
,
countryCode
:
String
):
Observable
<
BaseResponse
<
ChcekPhoneResponeBean
>>
{
return
LoginApiRequestUtil
.
checkPhoneStatus
(
phone
,
countryCode
)
override
fun
checkPhoneStatus
(
map
:
Map
<
String
,
String
>,
phone
:
String
,
countryCode
:
String
):
Observable
<
BaseResponse
<
ChcekPhoneResponeBean
>>
{
return
LoginApiRequestUtil
.
checkPhoneStatus
(
map
,
phone
,
countryCode
)
}
/**
...
...
m-user/src/main/java/com/yidianling/user/ui/login/presenter/LoginPresenterImpl.kt
View file @
a2965c7e
...
...
@@ -131,9 +131,9 @@ class LoginPresenterImpl(view: ILoginContract.View) : BasePresenter<ILoginContra
*@param isBind 是否是第三方登录成功后的绑定操作
*/
@SuppressLint
(
"CheckResult"
)
override
fun
checkPhoneStatus
(
phone
:
String
,
countryCode
:
String
,
isBind
:
Boolean
)
{
override
fun
checkPhoneStatus
(
map
:
Map
<
String
,
String
>,
phone
:
String
,
countryCode
:
String
,
isBind
:
Boolean
)
{
mView
.
showLoading
(
true
)
mModel
.
checkPhoneStatus
(
phone
,
countryCode
)
mModel
.
checkPhoneStatus
(
map
,
phone
,
countryCode
)
.
subscribeOn
(
Schedulers
.
io
())
.
observeOn
(
AndroidSchedulers
.
mainThread
())
.
subscribe
({
...
...
m-user/src/main/java/com/yidianling/user/ui/login/testLoginActivity.kt
deleted
100644 → 0
View file @
15c1f497
This diff is collapsed.
Click to expand it.
ydl-platform/src/main/java/com/ydl/ydlcommon/base/config/EncryptionParams.java
0 → 100644
View file @
a2965c7e
package
com
.
ydl
.
ydlcommon
.
base
.
config
;
import
android.os.Build
;
import
android.support.annotation.RequiresApi
;
import
android.util.Log
;
import
com.ydl.burypointlib.MD5Util
;
import
com.ydl.ydlcommon.base.BaseApp
;
import
com.yidianling.common.tools.RxAppTool
;
import
java.util.Arrays
;
import
java.util.Comparator
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.stream.Collectors
;
/**
* Created by Ykai on 2021/1/11.
*
* 获取加密参数类
*/
public
class
EncryptionParams
{
@RequiresApi
(
api
=
Build
.
VERSION_CODES
.
N
)
public
static
Map
<
String
,
String
>
getParams
(
String
path
){
String
timestamp
=
String
.
valueOf
(
System
.
currentTimeMillis
());
//值应该为毫秒数的字符串形式
Map
<
String
,
String
>
map
=
new
HashMap
<>();
map
.
put
(
"timestamp"
,
timestamp
);
map
.
put
(
"path"
,
path
);
map
.
put
(
"version"
,
RxAppTool
.
getAppVersionName
(
BaseApp
.
Companion
.
getApp
()));
List
<
String
>
storedKeys
=
Arrays
.
stream
(
map
.
keySet
()
.
toArray
(
new
String
[]{}))
.
sorted
(
Comparator
.
naturalOrder
())
.
collect
(
Collectors
.
toList
());
String
sign
=
storedKeys
.
stream
()
.
map
(
key
->
String
.
join
(
""
,
key
,
map
.
get
(
key
)))
.
collect
(
Collectors
.
joining
()).
trim
()
.
concat
(
HttpConfig
.
Companion
.
getENCRYPTION_APP_SECRET
());
sign
=
MD5Util
.
md5
(
sign
).
toUpperCase
();
Log
.
e
(
"sign"
,
sign
);
Map
<
String
,
String
>
headersMap
=
new
HashMap
<>();
headersMap
.
put
(
"appKey"
,
HttpConfig
.
Companion
.
getENCRYPTION_APP_KEY
());
headersMap
.
put
(
"sign"
,
sign
);
headersMap
.
put
(
"timestamp"
,
timestamp
);
return
headersMap
;
}
}
ydl-platform/src/main/java/com/ydl/ydlcommon/base/config/GlobalConfig.kt
View file @
a2965c7e
...
...
@@ -111,6 +111,7 @@ class GlobalConfig private constructor(var builder: Builder) {
.
setBaseUrl
(
appBaseURL
?:
HttpConfig
.
PHP_BASE_URL
)
.
addUrl
(
YDL_DOMAIN_JAVA
,
HttpConfig
.
JAVA_BASE_URL
)
.
addUrl
(
YDL_DOMAIN_JAVA_URL
,
HttpConfig
.
JAVA_URL
)
.
addUrl
(
YDL_DOMAIN_LOGIN_BASE_URL
,
HttpConfig
.
JAVA_LOGIN_BASE_URL
)
.
setMultipleUrlMap
(
multipleUrl
)
if
(
okHttpClient
==
null
)
{
...
...
@@ -119,7 +120,7 @@ class GlobalConfig private constructor(var builder: Builder) {
apiFactory
.
setOkClient
(
okHttpClient
)
HttpConfig
.
getInstance
().
initAuth
()
HttpConfig
.
getInstance
().
initLoginBaseUrlConfig
()
HttpConfig
.
getInstance
().
initLoginBaseUrlConfig
(
multipleUrl
)
}
}
...
...
ydl-platform/src/main/java/com/ydl/ydlcommon/base/config/HttpConfig.kt
View file @
a2965c7e
...
...
@@ -7,6 +7,7 @@ import com.facebook.stetho.okhttp3.StethoInterceptor
import
com.ydl.pushserver.pushagent.YdlPushAgent
import
com.ydl.ydlcommon.base.BaseApp
import
com.ydl.ydlcommon.bean.AuthBean
import
com.ydl.ydlcommon.bean.GatewayRequestDTO
import
com.ydl.ydlcommon.data.PlatformDataManager
import
com.ydl.ydlcommon.data.http.BaseAPIResponse
import
com.ydl.ydlcommon.data.http.EncryptUtils
...
...
@@ -16,6 +17,7 @@ import com.ydl.ydlcommon.data.http.api.ApiRequestUtil
import
com.ydl.ydlcommon.modular.ModularServiceManager
import
com.ydl.ydlcommon.utils.YDLCacheUtils
import
com.ydl.ydlnet.builder.config.OkHttpConfig
import
com.ydl.ydlnet.builder.factory.ApiFactory
import
com.ydl.ydlnet.builder.interceptor.log.RequestHandler
import
com.yidianling.common.tools.LogUtil
import
com.yidianling.common.tools.RxAppTool
...
...
@@ -27,6 +29,7 @@ import okio.Buffer
import
okio.BufferedSink
import
java.util.*
import
kotlin.collections.ArrayList
import
kotlin.collections.HashMap
/**
...
...
@@ -99,7 +102,11 @@ class HttpConfig {
*/
var
ACTION_URL
=
""
var
JAVA_LOGIN_BASE_URL
=
""
// 登录注册动态配置网关地址
var
JAVA_LOGIN_BASE_URL
=
""
// 登录注册动态配置的网关地址
var
ENCRYPTION_APP_KEY
=
""
// 接口加密appKey
var
ENCRYPTION_APP_SECRET
=
""
// 接口加密appSecret
var
isEncryption
=
false
fun
getInstance
():
HttpConfig
{
return
Holder
.
INSTANCE
...
...
@@ -132,6 +139,15 @@ class HttpConfig {
.
build
()
}
/**
* 开启动态网关,请求头某些参数加密
*/
// private fun addEncryptionHeaderParams():Interceptor{
// return Interceptor {
// var request = it.request()
// }
// }
private
fun
getRequestHandler
():
RequestHandler
{
return
object
:
RequestHandler
{
override
fun
onHttpResultResponse
(
...
...
@@ -364,6 +380,8 @@ class HttpConfig {
PHP_BASE_URL
=
properties
.
getProperty
(
"serverurl.$appEnv"
)
JAVA_BASE_URL
=
properties
.
getProperty
(
"javaapi.$appEnv"
)
JAVA_LOGIN_BASE_URL
=
JAVA_BASE_URL
ENCRYPTION_APP_KEY
=
properties
.
getProperty
(
"appKey.$appEnv"
)
ENCRYPTION_APP_SECRET
=
properties
.
getProperty
(
"appSecret.$appEnv"
)
ACTION_URL
=
properties
.
getProperty
(
"actionurl.$appEnv"
)
H5_URL
=
properties
.
getProperty
(
"h5url.$appEnv"
)
...
...
@@ -409,14 +427,22 @@ class HttpConfig {
*
*/
@SuppressLint
(
"CheckResult"
)
fun
initLoginBaseUrlConfig
(){
ApiRequestUtil
.
getBaseUrl
()
fun
initLoginBaseUrlConfig
(
urlMap
:
HashMap
<
String
,
String
>){
val
map
=
HashMap
<
String
,
Any
>()
val
list
=
ArrayList
<
GatewayRequestDTO
>()
val
gatewayRequestDTO
=
GatewayRequestDTO
(
"login"
)
list
.
add
(
gatewayRequestDTO
)
map
[
"gatewayRequestDTOList"
]
=
list
ApiRequestUtil
.
getBaseUrl
(
map
)
.
compose
(
RxUtils
.
applySchedulers
())
.
compose
(
RxUtils
.
resultJavaData
())
.
subscribe
({
if
(
it
.
baseUrlGatewayDTOList
.
isNotEmpty
()){
if
(
it
.
baseUrlGatewayDTOList
[
0
].
goGateway
){
JAVA_LOGIN_BASE_URL
=
it
.
baseUrlGatewayDTOList
[
0
].
baseUrl
isEncryption
=
it
.
baseUrlGatewayDTOList
[
0
].
goGateway
if
(
isEncryption
){
JAVA_LOGIN_BASE_URL
=
it
.
baseUrlGatewayDTOList
[
0
].
baseUrl
+
"/"
urlMap
[
YDL_DOMAIN_LOGIN_BASE_URL
]
=
JAVA_LOGIN_BASE_URL
ApiFactory
.
getInstance
().
setMultipleUrlMap
(
urlMap
)
}
}
})
{
...
...
ydl-platform/src/main/java/com/ydl/ydlcommon/bean/GatewayRequestDTO.kt
0 → 100644
View file @
a2965c7e
package
com.ydl.ydlcommon.bean
/**
* Created by Ykai on 2021/1/9.
*/
data class
GatewayRequestDTO
(
var
bizType
:
String
)
\ No newline at end of file
ydl-platform/src/main/java/com/ydl/ydlcommon/data/http/api/ApiRequestUtil.java
View file @
a2965c7e
...
...
@@ -13,10 +13,12 @@ import com.ydl.ydlcommon.utils.NetworkParamsUtils;
import
com.ydl.ydlnet.YDLHttpUtils
;
import
java.util.List
;
import
java.util.Map
;
import
io.reactivex.Observable
;
import
okhttp3.MediaType
;
import
okhttp3.RequestBody
;
import
retrofit2.http.Body
;
/**
* 模块请求工具类
...
...
@@ -63,7 +65,7 @@ public class ApiRequestUtil {
/**
* 获取登录注册模块网关
*/
public
static
Observable
<
BaseAPIResponse
<
BaseUrlBean
>>
getBaseUrl
(){
return
YDLHttpUtils
.
Companion
.
obtainApi
(
NetApiStore
.
class
).
getBaseUrl
();
public
static
Observable
<
BaseAPIResponse
<
BaseUrlBean
>>
getBaseUrl
(
Map
<
String
,
Object
>
map
){
return
YDLHttpUtils
.
Companion
.
obtainApi
(
NetApiStore
.
class
).
getBaseUrl
(
map
);
}
}
ydl-platform/src/main/java/com/ydl/ydlcommon/data/http/api/NetApiStore.java
View file @
a2965c7e
...
...
@@ -51,7 +51,7 @@ interface NetApiStore {
@GET
(
"config/socket-config"
)
Observable
<
BaseAPIResponse
<
JavaGlobalInfo
>>
getJavaGlobalInfo
();
@Headers
({
YDL_DOMAIN
+
YDL_DOMAIN_JAVA
,
"userPort:1"
})
@Headers
({
YDL_DOMAIN
+
YDL_DOMAIN_JAVA
,
"userPort:1"
,
"Content-type:application/json;charset=UTF-8"
})
@POST
(
"systemconfig/get_gateway_base_url"
)
Observable
<
BaseAPIResponse
<
BaseUrlBean
>>
getBaseUrl
();
Observable
<
BaseAPIResponse
<
BaseUrlBean
>>
getBaseUrl
(
@Body
Map
<
String
,
Object
>
map
);
}
ydl-platform/src/main/res/raw/api.properties
View file @
a2965c7e
...
...
@@ -51,3 +51,9 @@ javatempurl.prod = https://dc.ydl.com/api/
javaapi.test
=
https://testapi.ydl.com/api/
javaapi.auto_test
=
https://auto_testapi.ydl.com/api/
javaapi.prod
=
https://api.ydl.com/api/
# 开启网关加密appKey和appSecret
appKey.test
=
20BB42485BD448DE888DD745899C457D
appSecret.test
=
ABA88F2FF7E64A688D2213B20A9B3A3E
appKey.prod
=
appSecret.prod
=
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