Beispiel #1
0
def getLog(initiator):
    sql = "select log_data, ajax_payload from  t_log where initiator_url = '%s' order by id desc limit 10" % (
        initiator)
    data = Db.fetch_all(sql)
    res = []
    for item in data:
        res.append({
            "log_data": json_decode(item['log_data']),
            "ajax_payload": json_decode(item['ajax_payload'])
        })
    return res
Beispiel #2
0
def getStageList(initiatorUrl, ajaxUrl):
    '''
    返回该地址栏下 某个ajax请求相关的步骤列表
    :param initiatorUrl: 地址栏
    :param ajaxUrl: ajax请求的url
    :return:
    '''
    req = getOne(initiatorUrl, ajaxUrl)
    if req:
        sql = " select ar.host, ar.url_format, ar.ajax_url, asr.cmd_format, asr.ajax_id, asr.stage_id, st.connect_str, st.stage_name, st.stage_type" \
              " from t_ajax_request ar join t_ajax_stage_relation asr on ar.id = asr.ajax_id " \
              " join t_stage st on asr.stage_id = st.id " \
              " where ar.id = %d"  %(req['id'])
        return Db.fetch_all(sql)
    return None
Beispiel #3
0
def getOne(initiatorUrl, ajaxUrl):
    '''
    通过地址栏和ajax请求的url,返回已有的请求信息
    :param initiatorUrl:
    :param ajaxUrl:
    :return:
    '''
    sql = "select id, url_format, ajax_url from t_ajax_request where ajax_url = '%s'" % (
        ajaxUrl)
    urlFormatList = Db.fetch_all(sql)
    for item in urlFormatList:
        urlFormat = item['url_format']
        reObj = re.compile(urlFormat)
        if initiatorUrl == urlFormat or (reObj.match(initiatorUrl)
                                         is not None):
            return item
    return None
Beispiel #4
0
def userList():
    sql = "select * from t_user order by id desc"
    return Db.fetch_all(sql) 
Beispiel #5
0
def stageList():
    sql = "select * from t_stage order by id desc"
    return Db.fetch_all(sql)
Beispiel #6
0
def getList(keyword=""):
    sql = "select min(id) as id, url_format, min(ajax_url) as ajax_url ,min(host) as host, min(create_time) as create_time from t_ajax_request group by url_format"
    res = Db.fetch_all(sql)
    return res
    """