!18 屏蔽中小时数获取优化

Merge pull request !18 from zcl/master
pull/6/head
Java3y 3 years ago committed by Gitee
commit 802b0a014f
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F

@ -11,10 +11,10 @@ import com.java3y.austin.handler.shield.ShieldService;
import com.java3y.austin.support.utils.LogUtils;
import com.java3y.austin.support.utils.RedisUtils;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.time.DateFormatUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.time.LocalDateTime;
import java.util.Date;
import java.util.HashSet;
@ -60,7 +60,7 @@ public class ShieldServiceImpl implements ShieldService {
* @return
*/
private boolean isNight() {
return Integer.valueOf(DateFormatUtils.format(new Date(), "HH")) < 8;
return LocalDateTime.now().getHour() < 8;
}

Loading…
Cancel
Save