Esempio n. 1
0
    def parse_task(self):
        result = list()

        qid = self.get_argument('qid')
        tid = self.get_argument('tid')
        uid = self.get_argument('uid')
        type = self.get_argument('type')
        ptid = self.get_argument('ptid')
        role = self.get_argument('role')
        csuid = self.get_argument('csuid')
        ori_type = self.get_argument('ori_type')
        req_list = json.loads(self.get_argument('req'))
        client_ip = self.request.remote_ip

        for req in req_list:
            task = Task()
            task.req_qid = qid
            task.req_uid = uid
            task.order_no = req.get('order_no', '')
            task.source = req['source']
            task.content = req['content']
            task.deadline = req.get('deadline', 0)
            task.debug = req.get('debug', False)
            task.tid = tid
            task.client_ip = client_ip
            task.ori_type = ori_type
            task.ticket_info = req['ticket_info']
            task.verify = req.get('verify', {'type': 'pre', 'set_type': 'E'})
            task.req_md5 = task.ticket_info.get('md5', 'default_md5')

            task.master_info = req.get('master_info', 'default_host')
            task.host = task.master_info.get('master_addr')

            task.redis_host = task.master_info.get('redis_addr').split(':')[0]
            task.redis_port = task.master_info.get('redis_addr').split(':')[-1]

            task.redis_db = task.master_info.get('redis_db')
            task.redis_passwd = task.master_info.get('redis_passwd')

            task.req_qid_md5 = task.req_qid + '-' + task.req_md5
            task.other_info = req.get('other_info', {})

            callback_type = 'scv100'
            if 'callback_type' in task.other_info:
                callback_type = task.other_info['callback_type']

            task.callback_type = callback_type
            redis_key_list = task.other_info.get('redis_key', [])
            # 之前redis_key 会传多个过来,现在只传一个,但保留了list的格式
            for each in redis_key_list:
                task.redis_key = each
                task.other_info['redis_key'] = each
                # logger.info('s[{0}] id[{1}]new verify task:{2}'.format(task.source, task.new_task_id, task))
                yield task
Esempio n. 2
0
        "acc_mj_uid": "daolv_001",
        "ClientID": "Mioji",
        "LicenseKey": "Mioji",
        "url": "http://api.didatravel.com",
        "apienv": "test"
    })
    # auth = json.dumps(auth)
    # task.ticket_info = {'env_name': 'test', "room_info": {"num": 2, "occ": 2}, "auth": auth, 'room_count': 1}
    # task.ticket_info = {
    #     'env_name': 'test',
    #     'room_info': [{"adult_info": [33, 44], "child_info": [9, 5]}],
    #     "auth": auth,
    #     'room_count': 1,
    #     # "verify_room": ["DOUBLE CITY VIEW TWO QUEEN BEDS"]
    # }
    task.redis_key = 'asdfasdfasdf'
    # 测试数据,美国 加州 奥克兰 滨水杰德微精品酒店
    # task.content = '13000&28333&3&20170809'
    # task.content = '13000&28333&3&20180610'
    # task.content = "30095&64958&1&20180905"

    for content in [
            '20977&39773&1&20190531', '20150&18131&2&20190508',
            '20070&3965&2&20190510', 'NULL&218279&3&20190531'
    ]:
        task.content = content
        task.ticket_info = {
            "room_info": [{
                "adult_info": [24],
                "child_info": [5]
            }, {