Exemple #1
0
def main():
    #sectets字段录入
    sckey, success, failure, result, phone, password = [], [], [], [], [], []
    #多人循环录入
    while True:
        try:
            users = input()
            info = users.split(',')
            phone.append(info[0])
            password.append(info[1])
            sckey.append(info[2])
        except:
            break

    #提交打卡
    for index,value in enumerate(phone):
        print("开始获取用户%s信息"%(value[-4:]))
        try:
            campus = CampusCard(phone[index], password[index])
            loginJson = campus.get_main_info()
            token = campus.user_info["sessionId"]
            driver.get('https://reportedh5.17wanxiao.com/collegeHealthPunch/index.html?token=%s#/punch?punchId=180'%token)
            #time.sleep(10)
            response = check_in(token)
            strTime = GetNowTime()
            if  response.json()["msg"] == '成功':
                success.append(value[-4:])
                msg = value[-4:]+"打卡成功-" + strTime
                result=response
            else:
                failure.append(value[-4:])
                msg = value[-4:] + "打卡异常-" + strTime
                time.sleep(15)
            print(response.text)
        except Exception as err:
            print(err)
            msg = "出现错误"
            failure.append(value[-4:])
            break
        print(msg)
        print("-----------------------")
    fail = sorted(set(failure),key=failure.index)
    strTime = GetNowTime()
    title = "成功: %s 人,失败: %s 人"%(len(success),len(fail))
    try:
        if  len(sckey[0])>2:
            print('主用户开始微信推送...')
            WechatPush(title,'https://sc.ftqq.com/'+sckey[0]+'.send',success,fail,result)
    except Exception as err:
        print("微信推送出错!%s"%(err))
def main():
    # sectets字段录入
    sckey, success, failure, result, phone, password, guardianPhone, egcP, sckey = [
    ], [], [], [], [], [], [], [], []
    # 多人循环录入
    while True:
        try:
            users = input()
            info = users.split(',')
            phone.append(info[0])
            password.append(info[1])
            egcP.append(info[2])
            guardianPhone.append(info[3])
            sckey.append(info[4])
        except BaseException:
            break

    # 提交打卡
    for index, value in enumerate(phone):
        print("开始获取用户%s信息" % (value[-4:]))
        count = 0
        while (count < 3):
            try:
                campus = CampusCard(phone[index], password[index])
                loginJson = campus.get_main_info()
                token = campus.user_info["sessionId"]
                driver.get(
                    'https://reportedh5.17wanxiao.com/collegeHealthPunch/index.html?token=%s#/punch?punchId=180'
                    % token)
                # time.sleep(10)
                response = check_in(loginJson["classId"],
                                    loginJson["classDescription"],
                                    loginJson["stuNo"], loginJson["username"],
                                    phone[index], egcP[index],
                                    guardianPhone[index], loginJson["userId"],
                                    loginJson["customerId"], token)
                if response.json()["msg"] == '成功' and index == 0:
                    strTime = GetNowTime()
                    success.append(value[-4:])
                    print(response.text)
                    msg = value[-4:] + "打卡成功-" + strTime
                    result = response
                    break
                elif response.json()["msg"] == '业务异常' and index == 0:
                    strTime = GetNowTime()
                    failure.append(value[-4:])
                    print(response.text)
                    msg = value[-4:] + "打卡失败-" + strTime
                    result = response
                    count = count + 1
                elif response.json()["msg"] == '成功':
                    strTime = GetNowTime()
                    success.append(value[-4:])
                    print(response.text)
                    msg = value[-4:] + "打卡成功-" + strTime
                    break
                else:
                    strTime = GetNowTime()
                    failure.append(value[-4:])
                    print(response.text)
                    msg = value[-4:] + "打卡异常-" + strTime
                    count = count + 1
                    print('%s打卡失败,开始第%d次重试...' % (value[-6:], count))
                    time.sleep(15)

            except Exception as err:
                print(err)
                msg = "出现错误"
                failure.append(value[-4:])
                break
        print(msg)
        print("-----------------------")
    fail = sorted(set(failure), key=failure.index)
    strTime = GetNowTime()
    title = "成功: %s 人,失败: %s 人" % (len(success), len(fail))
    try:
        if len(sckey[0]) > 2:
            print('主用户开始微信推送...')
            WechatPush(title, 'https://sc.ftqq.com/' + sckey[0] + '.send',
                       success, fail, result)
    except BaseException:
        print("微信推送出错!")
Exemple #3
0
def main():
    #sectets字段录入
    text, sckey, success, failure, result, phone, password = [], [], [], [], [], [], []
    #多人循环录入
    while True:
        try:
            users = input()
            info = users.split(',')
            phone.append(info[0])
            password.append(info[1])
            text.append(info[2])
            sckey.append(info[3])
        except:
            break

    templateid = "clockSign2"
    RuleId = 147

    #提交打卡
    for index, value in enumerate(phone):
        print("开始获取用户%sDeptId" % (value[-4:]))
        count = 0
        while (count < 3):
            try:
                campus = CampusCard(phone[index], password[index])
                loginJson = campus.get_main_info()
                token = campus.user_info["sessionId"]
                stuNum = loginJson["outid"]
                userName = loginJson["name"]
                driver.get(
                    'https://reportedh5.17wanxiao.com/collegeHealthPunch/index.html?token=%s#/punch?punchId=180'
                    % token)
                #time.sleep(10)
                response = check_in(text[index], stuNum, userName, RuleId,
                                    templateid, token)
                if response.json()["msg"] == '成功' and index == 0:
                    strTime = GetNowTime()
                    success.append(value[-4:])
                    print(response.text)
                    msg = value[-4:] + "打卡成功-" + strTime
                    result = response
                    break
                elif response.json()["msg"] == '业务异常' and index == 0:
                    strTime = GetNowTime()
                    failure.append(value[-4:])
                    print(response.text)
                    msg = value[-4:] + "打卡失败-" + strTime
                    result = response
                    count = count + 1
                elif response.json()["msg"] == '成功':
                    strTime = GetNowTime()
                    success.append(value[-4:])
                    print(response.text)
                    msg = value[-4:] + "打卡成功-" + strTime
                    break
                else:
                    strTime = GetNowTime()
                    failure.append(value[-4:])
                    print(response.text)
                    msg = value[-4:] + "打卡异常-" + strTime
                    count = count + 1
                    print('%s打卡失败,开始第%d次重试...' % (value[-6:], count))
                    time.sleep(15)

            except:
                msg = "出现错误"
                failure.append(value[-4:])
                break
        print(msg)
        print("-----------------------")
    fail = sorted(set(failure), key=failure.index)
    strTime = GetNowTime()
    title = "成功: %s 人,失败: %s 人" % (len(success), len(fail))
    try:
        if len(sckey[0]) > 2:
            print('主用户开始微信推送...')
            WechatPush(title, sckey[0], success, fail, result)
    except:
        print("微信推送出错!")