def checkday():
    now = int(time.time())
    timeStruct = time.localtime(now)
    year = timeStruct.tm_year
    month = timeStruct.tm_mon
    day = timeStruct.tm_mday

    # 工作日对应结果为 0, 休息日对应结果为 1, 节假日对应的结果为 2;
    date = "{0}{1:02d}{2:02d}".format(year, month, day)
    choliday = check_holiday.checkholiday(date)
    print(choliday)
    return choliday
Beispiel #2
0
import check_holiday

config = configparser.ConfigParser(allow_no_value=False)
config.read("dingding.cfg", encoding='utf-8')
directory = config.get("ADB", "directory")
gowork_time = config.get("time", "go_time")
offwork_time = config.get("time", "off_time")

now = int(time.time())
timeStruct = time.localtime(now)
year = timeStruct.tm_year
month = timeStruct.tm_mon
day = timeStruct.tm_mday
#工作日对应结果为 0, 休息日对应结果为 1, 节假日对应的结果为 2;
date = "{0}{1:02d}{2:02d}".format(year, month, day)
holiday_status = check_holiday.checkholiday(date)['work_status']
print(holiday_status)


def job_gowork():
    print("开始上班打卡调度")
    if holiday_status == 0:
        dingding = Ding.dingding(directory)
        png = dingding.goto_work()
        print(dingding.filename)
    else:
        print('今天不干活')


def job_offwork():
    print("开始下班打卡调度")
config = configparser.ConfigParser(allow_no_value=False)
config.read("dingding.cfg",encoding='utf-8')
directory = config.get("ADB","directory")
gowork_time=config.get("time","go_time")
offwork_time=config.get("time","off_time")
stagger_min=config.get("time","random_min")

now = int(time.time())
timeStruct = time.localtime(now)
year = timeStruct.tm_year
month = timeStruct.tm_mon
day = timeStruct.tm_mday
#工作日对应结果为 0, 休息日对应结果为 1, 节假日对应的结果为 2;
date="{0}{1:02d}{2:02d}".format(year,month,day)
choliday=check_holiday.checkholiday(date)
holiday_status=choliday['work_status']
print('程序启动')

def job_gowork():
    print("开始上班打卡调度")
    second = random_minute(int(stagger_min))
    str_time = string_toDatetime(gowork_time, second)
    # print("程序启动,休眠{0}秒".format(second))
    msg = '今天是:{0}-{1:02d}-{2:02d},{3},将在{4}打卡'.format(year, month, day, choliday['wday'], str_time)
    print(msg)
    time.sleep(second)
    if holiday_status == 0:
        dingding = Ding.dingding(directory)
        png = dingding.goto_work()
        print(dingding.filename)