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

feat: 自动签到 #165

Merged
merged 1 commit into from
Jul 30, 2023
Merged

feat: 自动签到 #165

merged 1 commit into from
Jul 30, 2023

Conversation

mlzzen
Copy link

@mlzzen mlzzen commented Jul 10, 2023

feat: 自动签到

@mlzzen mlzzen closed this Jul 10, 2023
@mlzzen mlzzen deleted the feat/check_in branch July 10, 2023 14:08
@mlzzen mlzzen restored the feat/check_in branch July 10, 2023 14:09
@mlzzen mlzzen reopened this Jul 10, 2023
@mlzzen
Copy link
Author

mlzzen commented Jul 10, 2023

刚刚操作失误,不小心删掉了远程feature分支。。。


public class NgaClientApp extends Application {

private static final String TAG = NgaClientApp.class.getSimpleName();

private static boolean sNewVersion;

private CheckInTask mCheckInTask;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里缓存一个变量没什么意义

@@ -109,6 +114,13 @@ private void checkNewVersion() {
}
}

private void checkIn() {
if (mCheckInTask == null) {
mCheckInTask = new CheckInTask();
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个方法是静态方法,没有必要创建对象去调用

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

我对java不太熟,我改了一下,你看行不

public class CheckInTask {
private static final String url = Utils.getNGAHost() + "nuke.php?__lib=check_in&__act=check_in&lite=js";

public static void execute() {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里的时间判断似乎有点问题
上次签到成功的时间-24小时,和当前的时间比较天数
这样是不是永远条件都是成立的?是不用应该直接用上次签到成功的时间和当前时间比较天数?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

new Date().getTime() - 24 * 3600 * 1000 这里设置的是缺省值,也就是如果没查询到上次签到时间,才会是这个这个值,正常签到情况下存的是时间戳,取的也是时间戳。

@Justwen Justwen merged commit 81960f6 into Justwen:master Jul 30, 2023
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants