Ejemplo n.º 1
0
def _delect1():
    a = ddd.A(2)
    # _class_id='214096'
    # print(isinstance(_class_id,str))#判断是否是字符串
    # name1=str(input('门店名称'))
    user_uuid = '62cd95fe854f4491a9ce0eaa9658d3bc'
    # print(gym_id)
    #
    _class_id = a.get_user_uuid_classesId(user_uuid)
    a.isdelete(_class_id)
Ejemplo n.º 2
0
def __delect():
    #gym_id =
    a = ddd.A(2)
    # _class_id='214096'
    # print(isinstance(_class_id,str))#判断是否是字符串
    #name1=str(input('门店名称'))
    tel = input('上课教练账号:')
    gym_id = str(a.get_tel_gymId(tel))
    #print(gym_id)
    _class_id = a.get_time_classesId(gym_id)
    a.isdelete(_class_id)
Ejemplo n.º 3
0
def add_course():
    a = ff.A(2)

    user_uuid = '492a685f-16a4-40c0-a0a3-17dec392c9bd'
    time1 = str(time.time())
    # name = user_uuid
    namespace = uuid.NAMESPACE_DNS
    namespace1 = uuid.NAMESPACE_URL
    namespace2 = uuid.NAMESPACE_OID
    # print(namespace)
    # print(namespace1)
    uuid2 = uuid.uuid3(namespace, user_uuid + time1)
    uuid3 = str(uuid.uuid3(namespace1, user_uuid + time1))
    uuid4 = str(uuid.uuid3(namespace2, user_uuid + time1))
    uuid2 = str(uuid2)
    # print(uuid2)
    uuid2 = uuid2.replace('-', '')

    a.get_subjectFB(uuid2, uuid3, uuid4, user_uuid)
Ejemplo n.º 4
0
def add_chengwei():
    a = ff.A(2)

    #user_code = str(input('输入学员user_code:'))
    # user_uuid = a.get_uuid_code(user_code)#根据user_code获取学员user_uuid
    user_code = str(input('请输入用户的code'))
    user_uuid = a.get_uuid_code(user_code)
    namespace = uuid.NAMESPACE_DNS
    namespace1 = uuid.NAMESPACE_URL
    namespace2 = uuid.NAMESPACE_OID
    price = 2000000
    price1 = str(price)
    price2 = str(price * 100)
    time1 = str(time.time())
    uuid2 = uuid.uuid3(namespace, user_uuid + time1)
    uuid5 = str(uuid.uuid3(namespace2, user_uuid + time1))
    uuid4 = str(uuid.uuid3(namespace1, user_uuid + time1))
    uuid2 = str(uuid2)
    uuid2 = uuid2.replace('-', '')

    a.get_chengwei(uuid2, uuid4, uuid5, user_uuid, price1, price2)
Ejemplo n.º 5
0
    def login(self):
        try:
            data__2 = self.locust.user_data_queue.get()
        except queue.Empty:
            print('no data')

            exit()

        data_1 = data__2

        username = '******'
        password = '******'
        headers = {
            'user_Agent': 'KKTabletUDP/Android',
            'connection': 'Keep - Alive',
            'Accept - Encoding': 'gzip',
            'Host': 'test.kuaikuaikeji.com',
            'Cache - Control': 'no-cache',
        }
        r = self.client.post("/kcas/PadCoachLoginV2", headers=headers)
        auth = r.headers.get('WWW-Authenticate', '')
        m = hashlib.md5()  # 创建md5对象
        m1 = hashlib.md5()
        password1 = base64.encodebytes(
            password.encode('utf-8'))[:-1]  # base64编码
        password1 = password1.decode('utf-8')
        up = (username + password1)
        strs2 = (auth + up).encode('utf-8')
        m1.update(strs2)  # 生成加密串
        resp = m1.hexdigest()  # 获取加密串`
        response = base64.encodebytes(resp.encode('utf-8'))[:-1]
        response = response.decode('utf-8')  # byte类型转换成string类型
        author = "user=\"" + username + "\",response=\"" + response + "\""
        headers = {
            'user_Agent': 'KKTabletUDP/Android',
            'connection': 'Keep - Alive',
            'Accept - Encoding': 'gzip',
            'Host': 'test.kuaikuaikeji.com',
            'Cache - Control': 'no-cache',
            'authorization': author,
        }
        r = self.client.post("/kcas/PadCoachLoginV2", headers=headers)
        if r.status_code == 200:
            data_ = data_1.get('classDataList')
            coachId = r.json()['coachId']

            for y in data_:
                y = y

            coursecode = y.get('courseCode')
            if 'SJ' in coursecode:
                pass
            else:
                classesid = y.get('classesId')
                print(classesid)
                n = int(len(data_))
                classes_id = ff2.add_class1(coachId, classesid, coursecode,
                                            n)  # 加的课的id,不可缺少

                a = f1.A(2)
                gym_id = a.get_gymid(coachId)
                subjectid = a.get_subjectId(gym_id)
                data = {
                    'coachId': coachId,
                    'listRange': 0,
                    'listSort': 0,
                    'pageIndex': 0,
                    'pageSize': 100
                }
                headers = {
                    'user_Agent': 'KKTabletUDP/Android',
                    'connection': 'Keep - Alive',
                    'Accept - Encoding': 'gzip',
                    'Host': 'test.kuaikuaikeji.com',
                    'Cache - Control': 'no-cache'
                }
                r = self.client.post('/kcas/PadGetCoachClassListV2',
                                     json=data,
                                     headers=headers)
                data1 = {
                    'classesId': classes_id,
                }
                st = self.client.post('/kcas/PadStartClassV2',
                                      json=data1,
                                      headers=headers)
                # coursecode=st.json()
                data2 = {
                    'coachId ': coachId,
                    'classesId': classes_id,
                    'courseCode': coursecode
                }
                cek1 = self.client.post('/kcas/PadGetCourseDetailV2',
                                        json=data2,
                                        headers=headers)

                cek2 = self.client.post('/kcas/PadGetCoachClassCheckinV2',
                                        json=data2,
                                        headers=headers)
                numbers = cek2.json().get('userCheckinMap')
                t = []
                i1 = len(numbers)
                # classes_id=(classes_id)
                for y in numbers:
                    # b=numbers[y]

                    t.append(y)  # 把人数换成列表格式
                # print(t[0])
                # data1 = f2.data1()
                # data1 = data1.get('classDataList')
                start_time1 = (time.time()) * 1000
                print(start_time1)
                # start_time = time.strftime("%Y-%m-%d %H:%M:%S", start_time1)
                # print(start_time)
                end_time1 = (time.time() + 3600) * 1000
                print(end_time1)
                # end_time = time.strftime("%Y-%m-%d %H:%M:%S", end_time1)
                # print(len(data1))
                classDataList = []

                # print(1)
                # print(n)
                for i in range(n):
                    # print(data_)
                    # classesId = '218527'
                    # weight=data_[i]['weightData']
                    # print(weight)
                    # print(i)
                    if 'weightData' in data_[i]:
                        data_[i]['weightData'] = data_[i]['weightData']
                        data_[i]['baseData'] = data_[i]['baseData']

                    else:
                        pass

                    data_[i]['endTime'] = end_time1
                    data_[i]['startTime'] = start_time1
                    # data1[i]['subjectId'] = subjectid
                    data_[i]['userUuid'] = t[i]
                    data_[i]['classesId'] = classes_id
                    data_[i]['subjectId'] = subjectid

                    # data1[i]['courseCode'] = coursecode
                    classDataList.append(data_[i])
                    # print(3)

                    # print(classDataList)

                    # cek3 =.post(url='http://test.kuaikuaikeji.com/kcas/PadGetCoachClassInfoV2', json=data,headers=headers)  # 刷新后的页面,获取课程详情
                # print(2)
                data3 = {
                    'classDataList': classDataList,
                    "uploadType": 1,
                    'uploadVersion': 3
                }
                # print(coursecode )

                report1 = self.client.post('/kcas/PadUploadAllClassDataV2',
                                           json=data3,
                                           headers=headers)
                # print(report1.json())
                # print(report1.status_code)
                # print(classesId)

                # tmeout = (report1.elapsed.microseconds)/number#发送请求到服务器端响应的时间大于1秒,只会截取后面的小数部分
                tmeout1 = report1.elapsed.total_seconds(
                )  # 这个才是正确的 获取响应时间,发送请求到收到相应的时间差
                # report1.elapsed.
                print('上传报告所需时间', tmeout1)
                # print('上传报告所需时间', tmeout)
                if report1.status_code == 200:
                    data4 = {'classesId': classes_id, 'subjectId': subjectid}
                    getreport1 = self.client.post(
                        '/kcas/PadGetClassReportListV2',
                        json=data4,
                        headers=headers)
                    # print(getreport1.json())
                    classReportList = getreport1.json().get('classReportList')
                    for x in range(len(classReportList)):
                        cl = classReportList[x]
                        reurl = cl.get('reportUrl')
                        print(reurl)

                        # if getreport1.status_code!=200:
                        # print(classes_id)
                        # exit()

                        # else:
                        #  print('success')
                        # classReportList = getreport1.json().get('classReportList')
                        print(classes_id)

                else:
                    print('上传失败 ', report1.status_code)

        else:
            print('用户名或密码错误')
Ejemplo n.º 6
0
def weight_get(subject_id, classes_id):
    data = {
        "initWeightData": {
            "dataSourceType": 1,
            "entrailsFat": 5,  #内脏脂肪
            "fatRate": 18,  # 脂肪率
            "macAddress": "F9:15:01:D8:AD:5A",
            "musleRate": 68.5,  # 肌肉率
            "resistance": 463.29998779296875,  # 电阻
            "skeletonRate": 4.6,  # 骨骼率
            "userBmr": 1547,  # 用户bmr
            "waterRate": 51.1,  # 水分率
            "weight": 64.2  # 体重
        },
        "userUuid": "492a685f-16a4-40c0-a0a3-17dec392c9bd"
    }
    headers = {
        'user_Agent': 'KKTabletUDP/Android',
        'connection': 'Keep - Alive',
        'Accept - Encoding': 'gzip',
        'Host': 'test.kuaikuaikeji.com',
        'Cache - Control': 'no-cache'
    }

    a1 = qqq.A(2)

    #import 上课.addclass1 as f

    #a1 = f.A(2)  # 调用其他类都需要实例化类方法
    user_uuid1 = a1.useruuid()
    #user_uuidlist = []
    # print(user_uuid1)
    #user_uuid1=['8472006b-caa2-4414-8a58-3c4bdb7cc72f']
    for useruuid in user_uuid1:
        #print(useruuid)
        a = qqq.C(4)

        id = a.select_user_daily_weight(useruuid)
        #print(id)
        if id == None:
            pass
            #print('shangke')
        else:
            # print(id)
            user_uuid2 = a.get_userweightid(id)
            user_uuid1 = copy.deepcopy(user_uuid1)
            # print(user_uuid2)
            # for user_uuid2 in user_uuid1:
            user_uuid1.remove(user_uuid2)  #当天称过重的话就删除该称重用户
    #print(user_uuid1)
    #user_uuid = a2.useruuid()
    for useruuid in user_uuid1:
        data['userUuid'] = useruuid
        #print(data)
        # time1=time.time()
        checkdata1 = requests.post(url=q.kkweight_app_url2 + q.三次校验接口,
                                   json=data,
                                   headers=headers)

        weightData = checkdata1.json()['corrWeightData']
        weight = data["initWeightData"]['weight']
        fat_rate = weightData.get('fatRate')
        mac_address = weightData.get('macAddress')
        resistance = weightData.get('resistance')
        skeleton_rate = weightData.get('skeletonRate')
        user_bmr = weightData.get('userBmr')
        water_rate = weightData.get('waterRate')
        memo = checkdata1.json()['modifiedMemo']
        WeightData = {
            "dataSourceType": 1,
            "entrailsFat": 5,  # 内脏脂肪
            "fatRate": fat_rate,  # 脂肪率
            "macAddress": mac_address,
            "musleRate": 68.5,  # 肌肉率
            "resistance": resistance,  # 电阻
            "skeletonRate": skeleton_rate,  # 骨骼率
            "userBmr": user_bmr,  # 用户bmr
            "waterRate": water_rate,  # 水分率
            "weight": weight  # 体重
        }
        #print(weightData)
        #return WeightData
        useruuid = useruuid
        classes_id = classes_id
        subject_id = subject_id
        b4 = qqq.C(2)
        b4.insert_weight(useruuid, weight, fat_rate, subject_id, water_rate,
                         user_bmr, skeleton_rate, classes_id, resistance,
                         mac_address, memo)
Ejemplo n.º 7
0
import pymysql
import requests
import re
import time
import uuid
import pad_app.上课.function as ff
a = ff.A(2)
b = ff.D()


def tel():
    #tel=input('上课教练账号:')
    # tel='15828640467'

    #tel = '13691421359'
    tel = '17600958351'

    coachId = a.get_coachId(tel)
    return coachId


#uuid=uuid.uuid1()
def add_class(coachId):
    a.addclass(coachId)


#  print('添加成功')
def add_class_private(coachId, user_uuid):
    a.addclass_private(coachId, user_uuid)

Ejemplo n.º 8
0
def report_test(data1):
    #print(data1)

    uname = '17600958351'
    pwd = '123456'
    res_session = requests.session()
    tme1 = time.time()
    tme2 = time.time() * 1000  #毫秒级时间戳
    if log(uname, pwd, res_session).status_code == 200:
        data_ = data1.get('classDataList')
        coachId = log(uname, pwd, res_session).json()['coachId']

        for y in data_:
            y = y

        coursecode = y.get('courseCode')
        classesid = y.get('classesId')

        # subjectid = y.get('subjectId')
        #print(data)
        n = int(len(data_))

        print(coursecode)

        if 'SJ' not in coursecode:

            classes_id = ff2.add_class1(coachId, classesid, coursecode,
                                        n)  #加的课的id,不可缺少
            print('classid')
            print(classes_id)

            a = fff.A(2)
            gym_id = a.get_gymid(coachId)
            subjectid = a.get_subjectId(gym_id)

            #classesId =  y.get('classesId')  # 好简单 ,昨天试了半天。目前感觉还不是很好
            #startTime =  y.get('startTime')  # 毫秒级时间戳
            #endTime =  y.get('endTime')

            #print(tme1)

            data = {
                'coachId': coachId,
                'listRange': 0,
                'listSort': 0,
                'pageIndex': 0,
                'pageSize': 100
            }
            headers = {
                'user_Agent': 'KKTabletUDP/Android',
                'connection': 'Keep - Alive',
                'Accept - Encoding': 'gzip',
                'Host': 'test.kuaikuaikeji.com',
                'Cache - Control': 'no-cache'
            }
            r = res_session.post(url=f1.kkweight_app_url2 + f1.获取课程列表信息,
                                 json=data,
                                 headers=headers)
            data1 = {
                'classesId': classes_id,
            }
            st = res_session.post(url=f1.kkweight_app_url2 + f1.开始课程,
                                  json=data1,
                                  headers=headers)
            #coursecode=st.json()
            data2 = {
                'coachId ': coachId,
                'classesId': classes_id,
                'courseCode': coursecode
            }
            cek1 = res_session.post(url=f1.kkweight_app_url2 + f1.获取课程详细信息,
                                    json=data2,
                                    headers=headers)

            cek2 = res_session.post(url=f1.kkweight_app_url2 + f1.查看签到状态,
                                    json=data2,
                                    headers=headers)
            numbers = cek2.json().get('userCheckinMap')
            t = []
            i1 = len(numbers)
            #classes_id=(classes_id)
            for y in numbers:
                # b=numbers[y]

                t.append(y)  # 把人数换成列表格式
            # print(t[0])
            #data1 = f2.data1()
            #data1 = data1.get('classDataList')
            start_time1 = (time.time()) * 1000
            #print(start_time1)
            #start_time = time.strftime("%Y-%m-%d %H:%M:%S", start_time1)
            # print(start_time)
            end_time1 = (time.time() + 3600) * 1000
            #print(end_time1 )
            #end_time = time.strftime("%Y-%m-%d %H:%M:%S", end_time1)
            #print(len(data1))
            classDataList = []

            #print(1)
            #print(n)
            for i in range(n):
                # print(data_)
                # classesId = '218527'
                #weight=data_[i]['weightData']
                #print(weight)
                #print(i)
                if 'weightData' in data_[i]:
                    data_[i]['weightData'] = data_[i]['weightData']
                    data_[i]['baseData'] = data_[i]['baseData']

                else:
                    pass

                data_[i]['endTime'] = end_time1
                data_[i]['startTime'] = start_time1
                #data1[i]['subjectId'] = subjectid
                data_[i]['userUuid'] = t[i]
                data_[i]['classesId'] = classes_id
                data_[i]['subjectId'] = subjectid

                #data1[i]['courseCode'] = coursecode
                classDataList.append(data_[i])
                #print(3)

                # print(classDataList)

                # cek3 = res_session.post(url='http://test.kuaikuaikeji.com/kcas/PadGetCoachClassInfoV2', json=data,headers=headers)  # 刷新后的页面,获取课程详情
            #print(2)
            data3 = {
                'classDataList': classDataList,
                "uploadType": 1,
                'uploadVersion': 3
            }
            #print(coursecode )

            report1 = res_session.post(url=f1.kkweight_app_url2 + f1.上传报告,
                                       json=data3,
                                       headers=headers)
            # print(report1.json())
            # print(report1.status_code)
            #print(classesId)

            aa = fff.D()
            number = aa.number()
            #tmeout = (report1.elapsed.microseconds)/number#发送请求到服务器端响应的时间大于1秒,只会截取后面的小数部分
            tmeout1 = report1.elapsed.total_seconds(
            )  #这个才是正确的 获取响应时间,发送请求到收到相应的时间差
            #report1.elapsed.
            print('上传报告所需时间', tmeout1)
            #print('上传报告所需时间', tmeout)
            if report1.status_code == 200:
                data4 = {'classesId': classes_id, 'subjectId': subjectid}
                getreport1 = res_session.post(url=f1.kkweight_app_url2 +
                                              f1.报告列表,
                                              json=data4,
                                              headers=headers)
                # print(getreport1.json())
                classReportList = getreport1.json().get('classReportList')
                for x in range(len(classReportList)):
                    cl = classReportList[x]
                    reurl = cl.get('reportUrl')
                    print(reurl)

                    #if getreport1.status_code!=200:
                    #print(classes_id)
                    #exit()

                    #else:
                    #  print('success')
                    #classReportList = getreport1.json().get('classReportList')
                    print(classes_id)

            else:
                print('上传失败 ', report1.status_code)

        else:
            pass

    else:
        print('用户名或密码错误')
Ejemplo n.º 9
0
    async def hello(self, datas):

        async with aiohttp.ClientSession() as session:
            headers = {
                'user_Agent': 'KKTabletUDP/Android',
                'connection': 'Keep - Alive',
                'Accept - Encoding': 'gzip',
                'Host': 'test.kuaikuaikeji.com',
                'Cache - Control': 'no-cache',
            }
            username = '******'
            password = '******'

            async with session.post(
                    "http://test.kuaikuaikeji.com/kcas/PadCoachLoginV2",
                    headers=headers) as res:

                auth = res.headers.get('WWW-Authenticate', '')
                m = hashlib.md5()  # 创建md5对象
                m1 = hashlib.md5()
                # m2=hashlib.md5()
                # password='******'
                # username='******'
                '''strs1=(username+password).encode('utf-8')

                m.update(strs1)#生成加密串
                ha=m.hexdigest()#获取加密串
                #print(ha)'''
                m.update(password.encode('utf-8'))
                pd = m.hexdigest()

                password1 = base64.encodebytes(
                    pd.encode('utf-8'))[:-1]  # base64编码
                password1 = password1.decode('utf-8')
                # password2=password1.decode('utf-8')
                # print(password1)
                '''username1=username.encode('utf-8')#string类型转换成byte类型
                 up=(username1+password1).encode('utf-8')
                 print(up)#也可以用'''
                up = (username + password1)
                strs2 = (auth + up).encode('utf-8')

                m1.update(strs2)  # 生成加密串
                resp = m1.hexdigest()  # 获取加密串`

                response = base64.encodebytes(resp.encode('utf-8'))[:-1]

                response = response.decode('utf-8')  # byte类型转换成string类型

                author = "user=\"" + username + "\",response=\"" + response + "\""
                print(author)

                headers = {
                    'user_Agent': 'KKTabletUDP/Android',
                    'connection': 'Keep - Alive',
                    'Accept - Encoding': 'gzip',
                    'Host': 'test.kuaikuaikeji.com',
                    'Cache - Control': 'no-cache',
                    'authorization': author,
                }

                async with session.post(
                        "http://test.kuaikuaikeji.com/kcas/PadCoachLoginV2",
                        headers=headers) as req:
                    a = await req.json()
                    if req.status == 200:
                        data_ = datas.get('classDataList')
                        coachId = a['coachId']
                        for y in data_:
                            y = y

                        coursecode = y.get('courseCode')
                        classesid = y.get('classesId')

                        # subjectid = y.get('subjectId')
                        # print(data)
                        n = int(len(data_))

                        print(coursecode)

                        if 'SJ' not in coursecode:

                            classes_id = ff2.add_class1(
                                coachId, classesid, coursecode,
                                n)  # 加的课的id,不可缺少
                            print('classid')
                            print(classes_id)

                            a = fff.A(2)
                            gym_id = a.get_gymid(coachId)
                            subjectid = a.get_subjectId(gym_id)

                            # classesId =  y.get('classesId')  # 好简单 ,昨天试了半天。目前感觉还不是很好
                            # startTime =  y.get('startTime')  # 毫秒级时间戳
                            # endTime =  y.get('endTime')

                            # print(tme1)

                            data = {
                                'coachId': coachId,
                                'listRange': 0,
                                'listSort': 0,
                                'pageIndex': 0,
                                'pageSize': 100
                            }
                            headers = {
                                'user_Agent': 'KKTabletUDP/Android',
                                'connection': 'Keep - Alive',
                                'Accept - Encoding': 'gzip',
                                'Host': 'test.kuaikuaikeji.com',
                                'Cache - Control': 'no-cache'
                            }
                            # r = res_session.post(url=f1.kkweight_app_url2 + f1.获取课程列表信息, json=data, headers=headers)
                            # data1 = {
                            #      'classesId': classes_id,
                            #   }
                            # st = res_session.post(url=f1.kkweight_app_url2 + f1.开始课程, json=data1, headers=headers)
                            # coursecode=st.json()
                            data2 = {
                                'coachId ': coachId,
                                'classesId': classes_id,
                                'courseCode': coursecode
                            }
                            # cek1 = res_session.post(url=f1.kkweight_app_url2 + f1.获取课程详细信息, json=data2, headers=headers)
                            async with session.post(url=f1.kkweight_app_url2 +
                                                    f1.查看签到状态,
                                                    json=data2,
                                                    headers=headers) as req1:
                                numbers1 = await req1.json()
                                print(numbers1)
                                numbers = numbers1['userCheckinMap']
                                t = []
                                i1 = len(numbers)
                                # classes_id=(classes_id)
                                for y in numbers:
                                    # b=numbers[y]

                                    t.append(y)  # 把人数换成列表格式
                                # print(t[0])
                                # data1 = f2.data1()
                                # data1 = data1.get('classDataList')
                                start_time1 = (time.time()) * 1000
                                # print(start_time1)
                                # start_time = time.strftime("%Y-%m-%d %H:%M:%S", start_time1)
                                # print(start_time)
                                end_time1 = (time.time() + 3600) * 1000
                                # print(end_time1 )
                                # end_time = time.strftime("%Y-%m-%d %H:%M:%S", end_time1)
                                # print(len(data1))
                                classDataList = []

                                # print(1)
                                # print(n)
                                for i in range(n):
                                    # print(data_)
                                    # classesId = '218527'
                                    # weight=data_[i]['weightData']
                                    # print(weight)
                                    # print(i)
                                    if 'weightData' in data_[i]:
                                        data_[i]['weightData'] = data_[i][
                                            'weightData']
                                        data_[i]['baseData'] = data_[i][
                                            'baseData']

                                    else:
                                        pass

                                    data_[i]['endTime'] = end_time1
                                    data_[i]['startTime'] = start_time1
                                    # data1[i]['subjectId'] = subjectid
                                    data_[i]['userUuid'] = t[i]
                                    data_[i]['classesId'] = classes_id
                                    data_[i]['subjectId'] = subjectid

                                    # data1[i]['courseCode'] = coursecode
                                    classDataList.append(data_[i])
                                    # print(3)

                                    # print(classDataList)

                                    # cek3 = res_session.post(url='http://test.kuaikuaikeji.com/kcas/PadGetCoachClassInfoV2', json=data,headers=headers)  # 刷新后的页面,获取课程详情
                                # print(2)
                                data3 = {
                                    'classDataList': classDataList,
                                    "uploadType": 1,
                                    'uploadVersion': 3
                                }
                                # print(coursecode )

                                time1 = time.time()
                                async with session.post(
                                        url=f1.kkweight_app_url2 + f1.上传报告,
                                        json=data3,
                                        headers=headers) as req2:
                                    # print(report1.json())
                                    # print(report1.status_code)
                                    # print(classesId)

                                    aa = fff.D()
                                    number = aa.number()
                                    # await req2.json()
                                    time2 = time.time()
                                    # tmeout = (report1.elapsed.microseconds)/number#发送请求到服务器端响应的时间大于1秒,只会截取后面的小数部分
                                    # tmeout1 = req2.elapsed.total_seconds()  # 这个才是正确的 获取响应时间,发送请求到收到相应的时间差
                                    # report1.elapsed.
                                    print('上传报告所需时间', time2 - time1)
                                    # print('上传报告所需时间', tmeout)
                                    if req2.status == 200:
                                        data4 = {
                                            'classesId': classes_id,
                                            'subjectId': subjectid
                                        }
                                        async with session.post(
                                                url=f1.kkweight_app_url2 +
                                                f1.报告列表,
                                                json=data4,
                                                headers=headers) as req4:
                                            # print(getreport1.json())
                                            classReportList1 = await req4.json(
                                            )
                                            classReportList = classReportList1[
                                                'classReportList']
                                            for x in range(
                                                    len(classReportList)):
                                                cl = classReportList[x]
                                                reurl = cl.get('reportUrl')
                                                print(reurl)

                                                # if getreport1.status_code!=200:
                                                # print(classes_id)
                                                # exit()

                                                # else:
                                                #  print('success')
                                                # classReportList = getreport1.json().get('classReportList')
                                                print(classes_id)

                                    else:
                                        print('上传失败 ', req2.status)

                        else:
                            pass

                    else:
                        print('用户名或密码错误')
Ejemplo n.º 10
0
def f():  #定义一个函数第一个进程
    #while True:#print('第一个进程')
    a = fff.A(1)
    a.user()
Ejemplo n.º 11
0
                                    'courseCode': coursecode
                                }
                                if 'FB.1.0.1.' in coursecode:
                                    data3 = {
                                        "classesId": classesId,
                                        "coachAssistantTel": tel
                                    }
                                    # cek1,cek2,cek3 三者基本是同步的,点击开始课程后的数据
                                    cek2 = res_session.post(
                                        url=f1.kkweight_app_url2 + f1.设置辅导员,
                                        json=data3,
                                        headers=headers)
                                else:
                                    pass
                                if private_1 == 1:
                                    a = fff.A(1)
                                    n = a.classes_number(classesId)

                                    courseCodeList = ["SJ.MAN.JZ.ZC.65-80.3"]
                                    courseCodeList = courseCodeList * n
                                    courseCodeList = eval(
                                        json.dumps(courseCodeList))

                                    data22 = {"courseCodeList": courseCodeList}
                                    cek1 = res_session.post(
                                        url=f1.kkweight_app_url2 +
                                        f1.获取课程详细信息私教,
                                        json=data22,
                                        headers=headers)
                                    coachCourse1 = cek1.json(
                                    )['coursePairList']
Ejemplo n.º 12
0
def report(classesId):
    uname='18610728165'
    pwd='123456'
    res_session = requests.session()
    tme1=time.time()
    tme2=time.time()*1000  #毫秒级时间戳
    #print(tme1)
    tel='18610728165'
    while True:
        #try:
            weight=int(input('是否需要称重:输入数字1或者2,1代表称重,2代表未称重'))
            weight1=str(input('用户体重'))
            private_1=int(input('是否是非私教课,是的话Q1 不是的话 爱咋咋的'))
            if weight==1:

             if log(uname,pwd,res_session).status_code==200:

            #print(p.log(uname,pwd).json()['coachId'])
               coachId = log(uname, pwd, res_session).json()['coachId']
               classdatalist=[]

            # print(coachId)
               data = {'coachId': coachId,
                    'listRange': 0,
                    'listSort': 0,
                    'pageIndex': 0,
                    'pageSize': 100}
               headers = {'user_Agent': 'KKTabletUDP/Android',
                       'connection': 'Keep - Alive',
                       'Accept - Encoding': 'gzip',
                       'Host': 'test.kuaikuaikeji.com',
                       'Cache - Control': 'no-cache'
                       }
               r = res_session.post(url=f1.kkweight_app_url2+f1.获取课程列表信息, json=data, headers=headers)
               #p = r.json()

               q = r.json()['classInfoList']
               if q :


                         # print('classesId=', classesId)
                         # print('classesId :', classesId,'coursecode:', coursecode)

                             # print(cek3.status_code)

                             #print(user_uuid)
                     #print(startTime)



                             # print(classdatalist)

                       data1 = {
                               'classesId': classesId,
                              }
                       st = res_session.post(url=f1.kkweight_app_url2+f1.开始课程, json=data1,headers=headers)  # 开始课程接口
                       rt=st.json().get('result')
                       if rt==0:

            # print(st.status_code)
                          a=fff.A(1)
                          coursecode=a.coursecode(classesId)
                          subjectId=a.get_subjectid_by_id(classesId)
                          if st.status_code == 200:
                             data2 = {'coachId ': coachId,
                                'classesId': classesId,
                               'courseCode': coursecode
                                }
                             if 'FB.1.0.1.' in coursecode:
                               data3={"classesId":classesId,"coachAssistantTel":tel}
                # cek1,cek2,cek3 三者基本是同步的,点击开始课程后的数据
                               cek2=res_session.post(url=f1.kkweight_app_url2+f1.设置辅导员,json=data3,headers=headers)
                             else:
                                 pass
                             if private_1==1:
                                 a=fff.A(1)
                                 n=a.classes_number(classesId)


                                 courseCodeList = ["SJ.MAN.JZ.ZC.65-80.3"]
                                 courseCodeList=courseCodeList*n
                                 courseCodeList=eval(json.dumps(courseCodeList))

                                 data22={"courseCodeList":courseCodeList}
                                 cek1 = res_session.post(url=f1.kkweight_app_url2 + f1.获取课程详细信息私教, json=data22,
                                                         headers=headers)


                                 coachCourse1 = cek1.json()['coursePairList']
                                 start_time = coachCourse1[0]['coachCourse']['createTime']
                                 dangqian_time = time.time()*1000

                                 unitList1=coachCourse1[0]['coachCourse']['programList']
                             else:
                                cek1 = res_session.post(url=f1.kkweight_app_url2+f1.获取课程详细信息, json=data2, headers=headers)  # check这个字段不能用,之前报错,获取课程信息
                                start_time = cek1.json()['course']['createTime']
                                print(start_time)
                                dangqian_time=time.time()*1000

                                unitList1 = cek1.json()['course']['programList']
                             endTime=float(start_time)+3600*1000
                             if float(start_time)<=dangqian_time:
                                 for unitList1 in unitList1:
                                   unitlist2=unitList1.get('unitList')
                                 unitList2=unitlist2
                                 name1=[]
                                 unitCode1=[]

                                 for x in unitList2:
                                     name=x['name']
                                     unitCode=x['unitCode']
                                     name1.append(name)
                                     unitCode1.append(unitCode)
                                 name1=name1
                                 unitCode1=unitCode1
                                 print(name1)
                                 print(unitCode1)
                                # print(1)



                    # print(cek1.json())
                    # if cek.status_code==200:

                                 cek2 = res_session.post(url=f1.kkweight_app_url2+f1.查看签到状态, json=data2,headers=headers)  # 查看是否签到
                                 numbers=cek2.json().get('userCheckinMap')#字典格式
                                 #print(numbers)
                                 #y1 = numbers.keys(0)
                                 #print(y1)
                                 if numbers:
                                     t = []
                                     i1 = int(len(numbers))
                                     for y1 in numbers:  #可以读取到键值也就是学员uuid
                                         # b=numbers[y]

                                         t.append(y1)  # 把人数换成列表格式
                                     # print(t[0])
                                     data1 = f.data1()
                                     data1 = data1.get('classDataList')

                                     classDataList = []
                                     if i1 <= len(data1):

                                         for i in range(i1):
                                             if  'baseData'  in data1[i]:

                                                 data1[i]['baseData'] = data1[i]['baseData']
                                             else:
                                                 print('xuyaode shuju ',i)

                                             if 'weightData' in data1[i]:


                                                if 'SXFB' or 'SXTB' or 'SXYB' in coursecode:#各项经纬度数值
                                                    data1[i]['weightData']['measureData']={
                                                         "abdomenLine": 83,
                                                         "hipLine": 93,
                                                         "leftShankLine": 33,
                                                         "leftThighLine": 55,
                                                         "rightShankLine": 33,
                                                         "rightThighLine": 55,
                                                         "waistLine": 71.5
                                                     }
                                                else:
                                                    pass


                                                #data1[i]['baseData'] = data1[i]['baseData']
                                                 #pass

                                             else:
                                                 pass
                                             for y in range(len(name1)):
                                                 #name1=name1
                                                 data1[i]['unitDataList'][y]['unitName']=name1[y]
                                                 data1[i]['unitDataList'][y]['unitCode']=unitCode1[y]
                                             # print(data_)
                                             #classesId = '218527
                                             useruuid = t[i]

                                             #weightdata=ff1._weight_get(useruuid)#称重数据
                                             #data1[i]['weightData'] = data
                                             data1[i]['weightData'] = {
                                                 "dataSourceType": 1,
                                                 "entrailsFat": 5,  # 内脏脂肪
                                                 "fatRate": 17,  # 脂肪率
                                                 "macAddress": "F9:15:01:D8:AD:5A",
                                                 "musleRate": 68.5,  # 肌肉率

                                                 "skeletonRate": 4.6,  # 骨骼率
                                                 "userBmr": 1547,  # 用户bmr
                                                 "waterRate": 51.1,  # 水分率
                                                 "weight":weight1# 体重

                                             }
                                             #
                                             data1[i]['classesId'] =classesId
                                             data1[i]['endTime'] =endTime
                                             data1[i]['startTime'] = start_time
                                             data1[i]['subjectId'] =subjectId
                                             data1[i]['userUuid'] = useruuid

                                             data1[i]['courseCode'] =coursecode
                                             classDataList.append(data1[i])
                                             #print(classDataList)


                                      # cek3 = res_session.post(url='http://test.kuaikuaikeji.com/kcas/PadGetCoachClassInfoV2', json=data,headers=headers)  # 刷新后的页面,获取课程详情
                                         data3 = {'classDataList': classDataList,
                                               "uploadType": 1,
                                                  'uploadVersion' :3

                                               }
                                        #print(data3)
                                         tme3=time.time()

                                         #ff1.weight_get(subjectId,classesId)#称重
                                         #b3 = ffff.weight_get()

                                         report1 = res_session.post(url=f1.kkweight_app_url2+f1.上传报告,json=data3, headers=headers)
                                        #print(report1.json())
                                        #print(report1.status_code)
                                         print(classesId)
                                         tme4=time.time()
                                         tmeout=tme4-tme3
                                         print('上传报告所需时间',tmeout)
                                         if report1.status_code == 200:
                                           data4 = {'classesId': classesId,
                                                'subjectId': 0}
                                           getreport1 = res_session.post(url=f1.kkweight_app_url2+f1.报告列表,json=data4, headers=headers)
                                           #print(getreport1.json())
                                           classReportList = getreport1.json().get('classReportList')
                                           for x in range(len(classReportList)):
                                             cl = classReportList[x]
                                             reurl = cl.get('reportUrl')
                                             print(reurl)
                                          # nn = int(input('删除课程请输入1:'))
                                          # b1=fff.B()
                                           #b1.deleteclass1(nn)

                                         else:
                                           print('报告上传失败')
                                           break
                                     else:
                                       print('请确保上课人数与现网报告人数的一致性')
                                       break
                                 else:
                                     print('该节课没有学员预约,请查看是否有学员约课')
                                     break




                       else:
                              print('该节课已上传报告,报告为:')
                              data4 = {'classesId': classesId,
                                        'subjectId': subjectId}
                              getreport1 = res_session.post(url=f1.kkweight_app_url2+f1.报告列表,json=data4, headers=headers)
                              classReportList = getreport1.json().get('classReportList')
                              print(classesId)
                              for x in range(len(classReportList)):
                                  cl = classReportList[x]
                                  reurl = cl.get('reportUrl')

                                  print(reurl)
                              #nn = int(input('删除课程请输入1:'))
                            #  b1 = fff.B()
                            #  b1.deleteclass1(nn)


                              else:
                                 time2 = time.localtime((start_time/1000))
                                 dt = time.strftime("%Y-%m-%d %H:%M:%S", time2)
                                 print('课程还未开始,开始时间:',dt)
                                 break




            # print(cek2.status_code)
            # if cek2.status_code == 200:






                 # r=json.dumps(data,indent=1)

                 #print(b)

                 #break
              #except Exception:
                    #print('必须是整数或者课程不存在或者try里面出现错误')
               else:
                   print('没有课程,请先添加好课程,再来上课QAQ')
                   ff2.add_class(coachId)

                   #a1.addclass(coachId)#调用需要执行的方法  首次加课
                   #fff.addclasses(coachId)
                   print('添加了一节课')














             else:
                print('用户名或密码错误')
                break
            else:
                pass