config.py 533 B

1234567891011121314151617181920
  1. import datetime
  2. ## 考勤范围:在指定时间区间内,随机时间进行考勤
  3. # 考勤范围开始,格式 [小时, 分钟]
  4. START_TIME = [8, 0]
  5. # 考勤范围结束,格式 [小时, 分钟]
  6. END_TIME = [9, 0]
  7. # 自定义规则(此处设置周六周日不打卡,1月后不打卡)
  8. def check_rule():
  9. t = datetime.datetime.now()
  10. if t.weekday() == 5 or t.weekday() == 6: # 周六日无需打卡
  11. return False
  12. if t.month != 1: # 1月后假期无需打卡
  13. return False
  14. return True