Ejemplo n.º 1
0
def test(cid):
    while 1:
        try:
            ret = requests.get(
                f'http://www.huomao.com/eventBox/isHaveEventTreasure?cid={cid}',
                cookies=Common.generate_cookies(uid),
                proxies={
                    'http': random.choice(ip_pool)
                }).json()
            print(ret)
            if ret['status']:
                print(ret)
                treasure_id = ret['data']['id']
                open_time = int(ret['data']['open_time'])
                time.sleep(open_time)
                for i in range(10):
                    ret = requests.get(
                        f'http://www.huomao.com/EventBox/getEventTreasure?treasure_id={treasure_id}&cid={cid}',
                        cookies=Common.generate_cookies(uid),
                        proxies={'http': random.choice(ip_pool)})
                    print(ret.json())
                time.sleep(0.2)
            time.sleep(100)
            time.sleep(random.randint(20, 40))
        except:
            print('error')
Ejemplo n.º 2
0
def banker(uid, **kw):
    data = {
        'period': '111111',  # 期号
        'opt_type':
        200001,  # 选项类型 normal,normal_3,normal_4,normal_5,money_line,ball
        'coin_type': 'free_bean',  # 货币类型仙豆free_bean,猫豆cat_bean
        # 'punter': 'banker',  # bet:普通下注,'banker':坐庄, 'buyer':买庄
        'banker_odds': 2,  # 赔率
        'chose': 1,  # 坐庄选项
        'amount': 1000,
        # 'third_id': 0,
    }
    for key, value in kw.items():
        data[key] = value
    post_data = Common.form_single_dict(data)
    res = requests.post(URL + '/guessnew/banker?bet_room_number=1&refer=web',
                        data=post_data,
                        cookies=Common.generate_cookies(uid))
    try:
        res = res.json()
        res_info = f'用户{uid}坐庄数据\n{data}返回{res}\n'
        logging.info(res_info)
        if res['status'] == 'success':
            return res['data']['banker']['order_id']
    except ValueError:
        logging.error(res.text)
        return False
Ejemplo n.º 3
0
 def test1(self):
     self.url = '/PrivateShow/joinShow'
     self.data = {}
     # 主播房间号
     self.data['cid'] = '10'
     res = requests.get(DOMAIN + self.url, params=self.data, cookies=Common.generate_cookies(5253)).text
     Common.try_json(res)
Ejemplo n.º 4
0
 def test4(self):
     self.url = '/PrivateShow/changeStatus'
     self.data = {}
     # 主播房间号
     self.data['cid'] = '14'
     res = requests.get(DOMAIN + self.url, params=self.data, cookies=Common.generate_cookies(1522)).text
     Common.try_json(res)
Ejemplo n.º 5
0
 def test3(self):
     self.url = '/PrivateShow/endShowByUid'
     self.data = {}
     # 主播房间号
     self.data['cid'] = '10'
     res = requests.get(DOMAIN + self.url, params=self.data, cookies=Common.generate_cookies(1522)).text
     Common.try_json(res)
Ejemplo n.º 6
0
 def test_delroomadmin_05(self):
     '''业务-房主权限-房主取消房管'''
     self.exp_res = {'code': '4000', 'status': True, 'message': '处理成功!'}
     self.user = anchor
     Common.set_fg(cid, room['fg'][5]['uid'])
     self.data['uid'] = room['fg'][5]['uid']
     self.ver = ver(room['fg'][5]['uid'], 0)
Ejemplo n.º 7
0
 def test_login_register1(self):
     # 获取文件的当前路径(绝对路径)
     cur_path = os.path.dirname(os.path.realpath(__file__))
     # 获取config.ini的路径
     config_path = os.path.join(cur_path, 'config.ini')
     conf = configparser.ConfigParser()
     # 读取配置
     conf.read(config_path)
     mobile = conf.get('config', 'mobile')
     # 设置配置
     conf.set('config', 'mobile', str(int(mobile) + 1))
     # 写入配置
     with open(config_path, 'w') as fw:
         conf.write(fw)
     # 添加验证码
     Common.add_mobile_yzm(mobile)
     driver = self.driver
     driver.find_element(By.ID, 'register-btn').click()
     driver.find_element(By.NAME, 'mobile').send_keys(mobile)
     driver.find_element(By.NAME, 'nick_name').send_keys(self.username)
     driver.find_element(By.ID, 'user_pwd_jia').click()
     driver.find_element(By.NAME, 'user_pwd').send_keys('test1234')
     driver.find_element(By.NAME, 'mobile_code').send_keys('123456')
     driver.find_element(By.ID, 'register-post').click()
     WebDriverWait(driver, 5).until(EC.text_to_be_present_in_element((By.CLASS_NAME, 'leftmenu-nickname'), self.username), '没注册成功')
Ejemplo n.º 8
0
 def test_gag_13(self):
     '''业务-房主权限-房主禁言房管'''
     self.exp_res = exps['t']
     self.user = anchor
     self.data['uid'] = room['fg'][2]['uid']
     # 初始化禁言信息
     Common.init_gag(self.data['uid'], cid)
     self.ver = ver(self.data['uid'])
Ejemplo n.º 9
0
 def test_gag_12(self):
     '''业务-房主权限-房主禁言普通用户'''
     self.exp_res = exps['t']
     self.user = anchor
     self.data['uid'] = user[2]['uid']
     # 初始化禁言信息
     Common.init_gag(self.data['uid'], cid)
     self.ver = ver(self.data['uid'])
Ejemplo n.º 10
0
 def test_gag_08(self):
     '''业务-房管权限-房管禁言普通用户'''
     self.exp_res = exps['t']
     self.user = room['fg'][0]['uid']
     self.data['uid'] = user[1]['uid']
     # 初始化禁言信息
     Common.init_gag(self.data['uid'], cid)
     self.ver = ver(self.data['uid'])
Ejemplo n.º 11
0
 def test_10(self):
     '''业务-用户被禁言'''
     self.exp_res = {
         'status': False,
         'code': '203',
         'message': '抱歉,您已被禁言!详情请咨询客服!'
     }
     self.user = self.create_user()
     Common.gag(self.user, anchor, cid)
Ejemplo n.º 12
0
 def get_m(self):
     res = {}
     uids = self.uids
     uids.append(self.uid)
     for uid in uids:
         xd = Common.get_xd(uid)
         md = Common.get_money(uid)['bean']
         res[uid] = (xd, md)
     return res
Ejemplo n.º 13
0
 def test_delgag_05(self):
     '''业务-普通用户取消禁言-被房主禁言的用户'''
     self.exp_res = exps['f1']
     self.user = user[3]['uid']
     uid = self.data['uid'] = user[5]['uid']
     # 初始化禁言信息
     Common.init_gag(uid, cid)
     # 房主禁言用户
     Common.gag(uid, anchor, cid)
     self.ver = ver(uid)
Ejemplo n.º 14
0
 def test_delgag_06(self):
     '''业务-普通用户取消禁言-被超管禁言的用户'''
     self.exp_res = exps['f1']
     self.user = user[3]['uid']
     uid = self.data['uid'] = user[6]['uid']
     # 初始化禁言信息
     Common.init_gag(uid, cid)
     # 超管禁言用户
     Common.gag(uid, super_uid, cid, -1)
     self.ver = ver(uid)
Ejemplo n.º 15
0
 def test_delgag_07(self):
     '''业务-房管取消禁言权限-被本身禁言的用户'''
     self.exp_res = exps['t']
     self.user = room['fg'][0]['uid']
     uid = self.data['uid'] = user[7]['uid']
     # 初始化禁言信息
     Common.init_gag(uid, cid)
     # 房管禁言用户
     Common.gag(uid, self.user, cid)
     self.ver = ver(uid, 0)
Ejemplo n.º 16
0
 def test_delgag_11(self):
     '''业务-房主取消禁言权限-被本身禁言的用户'''
     self.exp_res = exps['t']
     self.user = anchor
     uid = self.data['uid'] = user[11]['uid']
     # 初始化禁言信息
     Common.init_gag(uid, cid)
     # 房管禁言用户
     Common.gag(uid, self.user, cid)
     self.ver = ver(uid, 0)
Ejemplo n.º 17
0
 def test_delgag_08(self):
     '''业务-房管取消禁言权限-被其他房管禁言的用户'''
     self.exp_res = exps['f8']
     self.user = room['fg'][0]['uid']
     uid = self.data['uid'] = user[8]['uid']
     # 初始化禁言信息
     Common.init_gag(uid, cid)
     # 房管禁言用户
     Common.gag(uid, room['fg'][1]['uid'], cid)
     self.ver = ver(uid)
Ejemplo n.º 18
0
 def test_delgag_04(self):
     '''业务-普通用户取消禁言-被房管禁言的用户'''
     self.exp_res = exps['f1']
     self.user = user[3]['uid']
     uid = self.data['uid'] = user[4]['uid']
     # 初始化禁言信息
     Common.init_gag(uid, cid)
     # 房管禁言用户
     Common.gag(uid, room['fg'][0]['uid'], cid)
     self.ver = ver(uid)
Ejemplo n.º 19
0
 def test_login_register2(self):
     uid = Common.register(self.username)['uid']
     mobile = Common.bd_sj(uid)['mobile']
     Common.add_mobile_yzm(mobile)
     driver = self.driver
     driver.find_element(By.ID, 'login-btn').click()
     driver.find_element(By.NAME, 'mobile').send_keys(mobile)
     driver.find_element(By.NAME, 'mobile_code').send_keys('123456')
     driver.find_element(By.ID, 'login-post').click()
     WebDriverWait(driver, 5).until(EC.text_to_be_present_in_element((By.CLASS_NAME, 'leftmenu-nickname'), self.username), '没登陆')
Ejemplo n.º 20
0
 def test_delgag_13(self):
     '''业务-房管取消禁言权限-被超管禁言的用户'''
     self.exp_res = exps['f7']
     self.user = anchor
     uid = self.data['uid'] = user[13]['uid']
     # 初始化禁言信息
     Common.init_gag(uid, cid)
     # 超管禁言用户
     Common.gag(uid, super_uid, cid, -1)
     self.ver = ver(uid)
Ejemplo n.º 21
0
 def test_delgag_12(self):
     '''业务-房主取消禁言权限-被房管禁言的用户'''
     self.exp_res = exps['t']
     self.user = anchor
     uid = self.data['uid'] = user[12]['uid']
     # 初始化禁言信息
     Common.init_gag(uid, cid)
     # 房管禁言用户
     Common.gag(uid, room['fg'][0]['uid'], cid)
     self.ver = ver(uid, 0)
Ejemplo n.º 22
0
 def test_delgag_09(self):
     '''业务-房管取消禁言权限-被房主禁言的用户'''
     self.exp_res = exps['f8']
     self.user = room['fg'][0]['uid']
     uid = self.data['uid'] = user[9]['uid']
     # 初始化禁言信息
     Common.init_gag(uid, cid)
     # 房主禁言用户
     Common.gag(uid, anchor, cid)
     self.ver = ver(uid)
Ejemplo n.º 23
0
 def test_delroomadmin_03(self):
     '''业务-用户权限-用户取消房管'''
     self.exp_res = {
         'code': '4303',
         'data': [],
         'message': '房间号不存在或参数错误!',
         'status': False
     }
     self.user = user[5]['uid']
     Common.set_fg(cid, room['fg'][2]['uid'])
     self.data['uid'] = room['fg'][2]['uid']
Ejemplo n.º 24
0
 def test_setroomadmin_04(self):
     '''业务-用户权限-房管设置普通用户为房管'''
     self.exp_res = {
         'message': '参数错误!',
         'code': '4302',
         'status': False,
         'data': []
     }
     self.user = room['fg'][0]['uid']
     # 因为初始化删除了房管,所以重新设置
     Common.set_fg(cid, self.user)
     self.data['username'] = user[2]['name']
Ejemplo n.º 25
0
 def gamble_bet_bet(self):
     Common.set_xd(self.uid, 1200000)
     Common.set_money(self.uid, 0, 1200000)
     kw = dict(uid=self.uid,
               period=self.period,
               chose='option_A',
               coin_type='cat_bean',
               amount=200000)
     events = []
     for i in self.uids:
         events.append(gevent.spawn(bet, **kw))
     gevent.joinall(events)
Ejemplo n.º 26
0
def bx(data):
    try:
        data = json.loads(data)
        if data.get('code') == '300002':
            cid = data['gift']['channel']['cid']
            print(cid, '有普通宝箱')
            ret = requests.get(f'{url}/channels/isHaveTreasure?cid={cid}', proxies=proxies).json()
            for key, value in ret.items():
                if key != 'count':
                    treasure_key = value['key']
                    countdown = int(value['countdown'])
                    t = threading.Thread(target=get_bx, args=(countdown, cid, treasure_key))
                    t.start()
        elif data.get('code') == '888888':
            cid = data['allStation']['bannerWords']['targetUrl']
            print(cid, '有赛事宝箱')
            ret = requests.get(f'{url}/eventBox/isHaveEventTreasure?cid={cid}',
                               cookies=Common.generate_cookies(uid),
                               proxies=proxies).json()
            if ret['status']:
                treasure_id = ret['data']['id']
                open_time = int(ret['data']['open_time'])
                t = threading.Thread(target=get_ssbx, args=(open_time, cid, treasure_id))
                t.start()
    except Exception as e:
        print(e)
Ejemplo n.º 27
0
def create(**kw):
    # Calculation()
    data = {
        'guess_type': 'match',  # 竞猜类型,anchor:主播,match:赛事
        'match_id_or_room_number': '6473',  # 比赛ID/房间号
        'play_type': 'banker',  # 竞猜玩法,对赌:gamble,坐庄:banker
        'title': '赛事竞猜测试',  # 竞猜标题
        'opt_type': '200001',  # 选项类型
        'opt_items': {
            1: '选项1',
            2: '选项2'
        },
        'expire': str(int(time.time())),  # 竞猜封盘时间
        'note': f'{time.time()}',  # ??
    }
    for key, value in kw.items():
        data[key] = value
    post_data = Common.form_single_dict(data)
    ret = requests.post(ADMIN_URL + '/guessnew/create_save',
                        data=post_data,
                        cookies=ADMIN_COOKIES).text
    try:
        ret = json.loads(ret)
        logging.info(f"开盘{ret['period']},{ret}")
        time.sleep(2)
        return ret['period']
    except:
        logging.error(ret)
Ejemplo n.º 28
0
 def setUp(self):
     # 接口信息,后端只用uid
     self.name = '取消房管'
     self.url = '/myroom/delRoomAdministrator'
     self.method = 'post'
     # 默认报错信息
     self.info = ''
     # 默认登录用户
     self.user = ''
     # 默认请求数据
     self.data = {
         'uid': '',
         'username': '',
     }
     # 删除当前房管信息
     Common.del_fg(cid)
Ejemplo n.º 29
0
Archivo: 11.py Proyecto: github4n/work
def get_ssbx(open_time, cid, treasure_id):
    time.sleep(open_time)
    ret = requests.get(
        f'{url}/EventBox/getEventTreasure?treasure_id={treasure_id}&cid={cid}',
        cookies=Common.generate_cookies(uid),
        proxies=proxies)
    print(ret.json())
Ejemplo n.º 30
0
Archivo: 11.py Proyecto: github4n/work
def get_bx(countdown, cid, treasure_key):
    time.sleep(countdown)
    ret = requests.get(
        f'{url}/chatnew/getTreasure?cid={cid}&treasure_key={treasure_key}',
        cookies=Common.generate_cookies(uid),
        proxies=proxies)
    print(ret.json())