config.py 570 B

123456789101112131415161718192021222324
  1. import datetime
  2. from chinese_calendar import is_workday
  3. ## 考勤范围:在指定时间区间内,随机时间进行考勤
  4. # 考勤范围开始,格式 [小时, 分钟]
  5. START_TIME = [8, 0]
  6. # 考勤范围结束,格式 [小时, 分钟]
  7. END_TIME = [10, 0]
  8. # 自定义规则
  9. def check_rule():
  10. t = datetime.date.today()
  11. #if t.weekday() == 5 or t.weekday() == 6 or is_holiday(t): # 周六日无需打卡
  12. # return False
  13. if not is_workday(t):
  14. return False
  15. if t.month > 6: # 6月后无需打卡
  16. return False
  17. return True