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
0f190781
Commit
0f190781
authored
Jan 12, 2021
by
霍志良
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/4.1.64' into 4.1.64
parents
297404a4
a1ed8f19
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
29 additions
and
134 deletions
+29
-134
EncryptionParams.java
m-user/src/main/java/com/yidianling/user/http/EncryptionParams.java
+0
-56
LoginApiRequestUtil.kt
m-user/src/main/java/com/yidianling/user/http/LoginApiRequestUtil.kt
+2
-2
MD5.java
m-user/src/main/java/com/yidianling/user/http/MD5.java
+0
-37
UserApi.kt
m-user/src/main/java/com/yidianling/user/http/UserApi.kt
+1
-1
AccountSettingActivity.java
m-user/src/main/java/com/yidianling/user/mine/AccountSettingActivity.java
+1
-3
RegisterAndLoginActivity.kt
m-user/src/main/java/com/yidianling/user/ui/login/RegisterAndLoginActivity.kt
+1
-3
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
EncryptionParams.java
ydl-platform/src/main/java/com/ydl/ydlcommon/base/config/EncryptionParams.java
+18
-26
HttpConfig.kt
ydl-platform/src/main/java/com/ydl/ydlcommon/base/config/HttpConfig.kt
+0
-0
No files found.
m-user/src/main/java/com/yidianling/user/http/EncryptionParams.java
deleted
100644 → 0
View file @
297404a4
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 @
0f190781
...
...
@@ -34,8 +34,8 @@ class LoginApiRequestUtil {
/**
* 校验手机号:是否是用户版号码、是否有设置密码、是否被绑定
*/
fun
checkPhoneStatus
(
map
:
Map
<
String
,
String
>,
phone
:
String
,
countryCode
:
String
?):
Observable
<
BaseResponse
<
ChcekPhoneResponeBean
>>
{
return
getUserApi
().
checkPhoneStatus
(
map
,
phone
,
countryCode
!!
)
fun
checkPhoneStatus
(
phone
:
String
,
countryCode
:
String
?):
Observable
<
BaseResponse
<
ChcekPhoneResponeBean
>>
{
return
getUserApi
().
checkPhoneStatus
(
phone
,
countryCode
!!
)
}
/**
...
...
m-user/src/main/java/com/yidianling/user/http/MD5.java
deleted
100644 → 0
View file @
297404a4
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 @
0f190781
...
...
@@ -194,7 +194,7 @@ interface UserApi {
*/
@GET
(
"login/v2/phone_detection"
)
@Headers
(
YDL_DOMAIN
+
YDL_DOMAIN_LOGIN_BASE_URL
,
LOGIN_USER_PORT
)
fun
checkPhoneStatus
(
@
HeaderMap
headMap
:
Map
<
String
,
String
>,
@
Query
(
"phone"
)
phone
:
String
,
@Query
(
"countryCode"
)
countryCode
:
String
):
Observable
<
BaseResponse
<
ChcekPhoneResponeBean
>>
fun
checkPhoneStatus
(
@Query
(
"phone"
)
phone
:
String
,
@Query
(
"countryCode"
)
countryCode
:
String
):
Observable
<
BaseResponse
<
ChcekPhoneResponeBean
>>
/**
* 验证重置密码的短信验证码
...
...
m-user/src/main/java/com/yidianling/user/mine/AccountSettingActivity.java
View file @
0f190781
...
...
@@ -31,7 +31,6 @@ 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
;
...
...
@@ -118,8 +117,7 @@ public class AccountSettingActivity extends BaseActivity implements View.OnClick
return
;
}
showProgressDialog
();
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
())
LoginApiRequestUtil
.
Companion
.
checkPhoneStatus
(
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/RegisterAndLoginActivity.kt
View file @
0f190781
...
...
@@ -44,7 +44,6 @@ 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
...
...
@@ -396,8 +395,7 @@ class RegisterAndLoginActivity : BaseMvpActivity<ILoginContract.View, ILoginCont
return
@setOnClickListener
}
if
(
checkPhone
())
{
val
map
=
EncryptionParams
.
getParams
(
"/api/api/login/v2/phone_detection"
)
mPresenter
.
checkPhoneStatus
(
map
,
userPhoneNumber
!!
,
countryCode
!!
,
isUmengLoginState
)
mPresenter
.
checkPhoneStatus
(
userPhoneNumber
!!
,
countryCode
!!
,
isUmengLoginState
)
}
}
...
...
m-user/src/main/java/com/yidianling/user/ui/login/contract/ILoginContract.kt
View file @
0f190781
...
...
@@ -97,7 +97,7 @@ interface ILoginContract {
/**
* 校验手机号:是否是用户版号码、是否有设置密码、是否被绑定
*/
fun
checkPhoneStatus
(
map
:
Map
<
String
,
String
>,
phone
:
String
,
countryCode
:
String
,
isBind
:
Boolean
)
fun
checkPhoneStatus
(
phone
:
String
,
countryCode
:
String
,
isBind
:
Boolean
)
/**
* 通过一键认证服务登陆
...
...
@@ -120,7 +120,7 @@ interface ILoginContract {
/**
* 校验手机号:是否是用户版号码、是否有设置密码、是否被绑定
*/
fun
checkPhoneStatus
(
map
:
Map
<
String
,
String
>,
phone
:
String
,
countryCode
:
String
):
Observable
<
BaseResponse
<
ChcekPhoneResponeBean
>>
fun
checkPhoneStatus
(
phone
:
String
,
countryCode
:
String
):
Observable
<
BaseResponse
<
ChcekPhoneResponeBean
>>
/**
...
...
m-user/src/main/java/com/yidianling/user/ui/login/model/LoginModelImpl.kt
View file @
0f190781
...
...
@@ -48,8 +48,8 @@ class LoginModelImpl : ILoginContract.Model {
/**
* 校验手机号:是否是用户版号码、是否有设置密码、是否被绑定
*/
override
fun
checkPhoneStatus
(
map
:
Map
<
String
,
String
>,
phone
:
String
,
countryCode
:
String
):
Observable
<
BaseResponse
<
ChcekPhoneResponeBean
>>
{
return
LoginApiRequestUtil
.
checkPhoneStatus
(
map
,
phone
,
countryCode
)
override
fun
checkPhoneStatus
(
phone
:
String
,
countryCode
:
String
):
Observable
<
BaseResponse
<
ChcekPhoneResponeBean
>>
{
return
LoginApiRequestUtil
.
checkPhoneStatus
(
phone
,
countryCode
)
}
/**
...
...
m-user/src/main/java/com/yidianling/user/ui/login/presenter/LoginPresenterImpl.kt
View file @
0f190781
...
...
@@ -131,9 +131,9 @@ class LoginPresenterImpl(view: ILoginContract.View) : BasePresenter<ILoginContra
*@param isBind 是否是第三方登录成功后的绑定操作
*/
@SuppressLint
(
"CheckResult"
)
override
fun
checkPhoneStatus
(
map
:
Map
<
String
,
String
>,
phone
:
String
,
countryCode
:
String
,
isBind
:
Boolean
)
{
override
fun
checkPhoneStatus
(
phone
:
String
,
countryCode
:
String
,
isBind
:
Boolean
)
{
mView
.
showLoading
(
true
)
mModel
.
checkPhoneStatus
(
map
,
phone
,
countryCode
)
mModel
.
checkPhoneStatus
(
phone
,
countryCode
)
.
subscribeOn
(
Schedulers
.
io
())
.
observeOn
(
AndroidSchedulers
.
mainThread
())
.
subscribe
({
...
...
ydl-platform/src/main/java/com/ydl/ydlcommon/base/config/EncryptionParams.java
View file @
0f190781
...
...
@@ -2,11 +2,9 @@ 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
com.ydl.ydlcommon.utils.LogUtil
;
import
java.util.Arrays
;
import
java.util.Comparator
;
...
...
@@ -22,29 +20,23 @@ import java.util.stream.Collectors;
*/
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
());
public
static
String
getSign
(
String
path
,
String
timestamp
){
// 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 -> key+map.get(key))
// .collect(Collectors.joining()).trim()
// .concat();
String
sign
=
(
"path"
+
path
+
"timestamp"
+
timestamp
+
"version1.0.0"
).
concat
(
HttpConfig
.
Companion
.
getENCRYPTION_APP_SECRET
());
LogUtil
.
e
(
"sign"
,
sign
);
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
;
return
sign
;
}
}
ydl-platform/src/main/java/com/ydl/ydlcommon/base/config/HttpConfig.kt
View file @
0f190781
This diff is collapsed.
Click to expand it.
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