Exemple #1
0
def Logout():  # 修改为参数传递        host_ali = get_val('host_ali')
    try:
        paishou = get_val('paishou')
        # debug 模式
        if not paishou:  ##拍手模式不用保存账号信息
            host_ali = get_val('host_ali')
            Identify_code = get_val('Identify_code')
            diskid = get_val('diskid')
            type = get_val('type')
            from component.variable import get_strategy_dick
            strategy_dick = get_strategy_dick()
            strategy_dick = json.dumps(strategy_dick)
            account = get_val('bid_number')
            password = get_val('bid_password')
            idcard = get_val('idcard')
            if account and password and idcard:
                account = {
                    'account': account,
                    'password': password,
                    'idcard': idcard
                }
            else:
                account = None
            strategy_data = get_val('strategy_data')
            strategy_data = json.dumps(strategy_data)
            if type == 'manage':
                target_url = f'{host_ali}/api/bid/bid_logout/'
                data = {
                    'type': type,
                    'identify_code': Identify_code,
                    'strategy_data': strategy_data
                }

                print(data)
                result = web_request(target_url, data)

            else:
                account = json.dumps(account)
                target_url = '{0}/api/bid/bid_logout/?type={1}&identify_code={2}&diskid={3}&strategy_dick={4}' \
                             '&account={5}'.format(
                    host_ali, type, Identify_code, diskid, strategy_dick, account
                )
                result = web_request(target_url)
            # target_url = host_ali + r'/main_api/userconfirm/info?' + 'username=%s' % Username + '&' + 'passwd=%s' % Password
            return result
    except:
        logger.error("登出出现异常")
        logger.exception('this is an exception message')
        return {'result': 'net error'}
Exemple #2
0
def Keeplogin():
    try:
        # debug 模式
        host_ali = get_val('host_ali')
        Identify_code = get_val('Identify_code')
        diskid = get_val('diskid')
        type = get_val('type')
        from component.variable import get_strategy_dick
        import json
        strategy_dick = get_strategy_dick()
        strategy_dick = json.dumps(strategy_dick)
        account = {
            'account': get_val('bidnumber'),
            'password': get_val('bidpassword'),
            'idcard': get_val('idcard')
        }
        account = json.dumps(account)
        target_url = '{0}/api/bid/bid_keeplogin/?type={1}&identify_code={2}&diskid={3}&strategy_dick={4}' \
                     '&account={5}'.format(
            host_ali, type, Identify_code, diskid, strategy_dick, account
        )
        print(target_url)
        # target_url = host_ali + r'/main_api/userconfirm/info?' + 'username=%s' % Username + '&' + 'passwd=%s' % Password
        result = web_request(target_url)
    except:
        logger.error("keeplogin出现异常")
        logger.exception('this is an exception message')
        return {'result': 'net error'}
    return result
Exemple #3
0
def MoniTest():  # 修改为参数传递
    try:
        from component.remote_control import get_unique_id  ##获取硬盘ID
        host_ali = get_val('host_ali')
        # debug 模式
        target_url = '{0}/api/bid/monitest/?format=json'.format(host_ali)
        # target_url = host_ali + r'/main_api/userconfirm/info?' + 'username=%s' % Username + '&' + 'passwd=%s' % Password
        result = web_request(target_url)
        return result
    except:
        logger.error("登录出现异常")
        logger.exception('this is an exception message')
        return {'result': 'net error'}
Exemple #4
0
 def run(self):
     """Run Worker Thread."""
     # This is the code executing in the new thread.
     from component.remote_control import web_request
     try:
         remotetime_url = get_val('remotetime_url')
         result = web_request(remotetime_url)
         remotetime = result['currenttime']
         print("获取成功")
         set_val('true_time', remotetime + 0.06)  # 补网络延迟
         set_val('a_time', remotetime + 0.06)  # 补网络延迟
         setSystemTime(remotetime)  ##同步本地时间
     except:
         print("获取成功")
         logger.exception('this is an exception message')
Exemple #5
0
def ConfirmUser(Username, Password, version):  # 修改为参数传递
    try:
        host_ali = get_val('host_ali')
        debug = get_val('debug')
        # debug 模式
        target_url = host_ali + r'/bid/bid_login/?' + 'username=%s' % Username + \
                     '&' + 'passwd=%s' % Password + '&' + 'version=%s' % version + '&' + "debug=%s" % debug
        # target_url = host_ali + r'/main_api/userconfirm/info?' + 'username=%s' % Username + '&' + 'passwd=%s' % Password
        print(target_url)

        result = web_request(target_url)
        print(result)
    except:
        logger.error("登录出现异常")
        logger.exception('this is an exception message')
        return {'result': 'net error'}
    return result
Exemple #6
0
def Confirm_firstprice():
    try:
        # debug 模式
        host_ali = get_val('host_ali')
        bid_number = get_val('bid_number')
        type = get_val('type')
        target_url = '{0}/api/bid/bid_firstprice/?type={1}&bid_number={2}'.format(
            host_ali, type, bid_number)
        # target_url = host_ali + r'/main_api/userconfirm/info?' + 'username=%s' % Username + '&' + 'passwd=%s' % Password
        print(target_url)
        result = web_request(target_url)
        print(result)
    except:
        logger.error("登录出现异常")
        logger.exception('this is an exception message')
        return {'result': 'net error'}
    return result
Exemple #7
0
def ConfirmCode(identify_code, version):  # 修改为参数传递
    try:
        from component.remote_control import get_unique_id  ##获取硬盘ID
        host_ali = get_val('host_ali')
        debug = get_val('debug')

        type = get_val('type')

        # debug 模式
        diskid = get_val('diskid')
        target_url = f'{host_ali}/api/bid/get_guopaiurl/?format=json&type={type}&debug={debug}&version={version}\
        &identify_code={identify_code}&diskid={diskid}'

        # target_url = host_ali + r'/main_api/userconfirm/info?' + 'username=%s' % Username + '&' + 'passwd=%s' % Password
        print(target_url)

        result = web_request(target_url)
        print(result)
        return result
    except:
        logger.error("登录出现异常")
        logger.exception('this is an exception message')
        return {'result': 'net error'}