Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: 时间戳问题(验证码偶发送失败) #284

Merged
merged 1 commit into from
Feb 19, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,9 @@ public void refreshMTVersion() {
public Boolean sendCode(String mobile, String deviceId) {
Map<String, Object> data = new HashMap<>();
data.put("mobile", mobile);
data.put("md5", signature(mobile));
data.put("timestamp", String.valueOf(System.currentTimeMillis()));
final long curTime = System.currentTimeMillis();
data.put("md5", signature(mobile, curTime));
data.put("timestamp", String.valueOf(curTime));
// data.put("MT-APP-Version", MT_VERSION);

HttpRequest request = HttpUtil.createRequest(Method.POST,
Expand Down Expand Up @@ -141,9 +142,10 @@ public boolean login(String mobile, String code, String deviceId) {
map.put("mobile", mobile);
map.put("vCode", code);

map.put("md5", signature(mobile + code + "" + ""));
final long curTime = System.currentTimeMillis();
map.put("md5", signature(mobile + code + "" + "", curTime));

map.put("timestamp", String.valueOf(System.currentTimeMillis()));
map.put("timestamp", String.valueOf(curTime));
map.put("MT-APP-Version", getMTVersion());

HttpRequest request = HttpUtil.createRequest(Method.POST,
Expand Down Expand Up @@ -621,9 +623,9 @@ public static String AesDecrypt(String params) {
* @param content
* @return
*/
private static String signature(String content) {
private static String signature(String content, long time) {

String text = SALT + content + System.currentTimeMillis();
String text = SALT + content + time;
String md5 = "";
try {
MessageDigest md = MessageDigest.getInstance("MD5");
Expand Down