Esempio n. 1
0
def queryDocCatalogsWithoutText(param, con=db.doc_db_con):
    sql = "select t.*  from sp_doc_catalogs t "
    cond = " where t.MEDIA_ID IS NOT NULL AND t.doc_id not in (select distinct doc_id from sp_doc_passages) "
    result = []
    arr = []
    if param and len(param) > 0:
        isCond = False

        if 'media_name' in param.keys():
            arr.append(param['source'])
            cond += " and t.media_name=%s "
            isCond = True

        if 'create_time' in param.keys():
            arr.append(param['create_time'])
            cond += " and date_format(t.create_time,'" + param[
                'format'] + "')=%s "
            isCond = True

        if 'doc_id' in param.keys():
            arr.append(param['doc_id'])
            cond += " and t.doc_id=%s "
            isCond = True

        if isCond:
            sql += cond
    else:
        print 'param is none'
        sql += cond

    result = db.select(con, sql, arr)
    return result
Esempio n. 2
0
def queryDocCatalogs(param, con=db.doc_db_con):
    sql = "select t.doc_id, t.source, t.doc_type, t.sp_type, t.title, t.abstract, t.article_url, t.image_url, t.comment_count, t.datetime, t.create_time, t.keyword, t.media_name, t.tag, t.tag_id from sp_doc_catalogs t"
    cond = " where 1=1 "

    result = []
    if param and len(param) > 0:
        arr = []

        isCond = False

        if 'source' in param.keys():
            arr.append(param['source'])
            cond += " and t.source=%s "
            isCond = True

        if 'create_time' in param.keys():
            arr.append(param['create_time'])
            cond += " and date_format(t.create_time,'" + param[
                'format'] + "')=%s "
            isCond = True

        if 'doc_id' in param.keys():
            arr.append(param['doc_id'])
            cond += " and t.doc_id=%s "
            isCond = True

        if isCond:
            sql += cond

        result = db.select(con, sql, arr)
    else:
        print 'param is none, service quit !!!'

    return result
Esempio n. 3
0
def queryMediaParseConf(media_id, source, con=db.doc_db_con):
    sql = "SELECT T.* FROM sp_media_sub_parse_config T WHERE T.media_id = %s union all  SELECT T.* FROM sp_media_sup_parse_config T WHERE T.media_id = %s"

    param = [media_id, source]

    result = []
    if param and len(param) > 0:
        result = db.select(con, sql, param)
    else:
        print 'param is none, service quit !!!'

    return result
Esempio n. 4
0
def queryToutiaoMediaUserUnDone(param, con=db.doc_db_con):
    sql = "select t.* from sp_media_user t  "
    cond = " where t.media_type='0' and t.media_id not in (select distinct media_id from sp_doc_catalogs where media_id is not null) "

    result = []
    if param and len(param) > 0:
        arr = []

        isCond = False

        if 'source' in param.keys():
            arr.append(param['source'])
            cond += " and t.source=%s "
            isCond = True

        if 'create_time' in param.keys():
            arr.append(param['create_time'])
            cond += " and date_format(t.create_time,'" + param[
                'format'] + "')=%s "
            isCond = True

        if 'media_id' in param.keys():
            arr.append(param['media_id'])
            cond += " and t.media_id=%s "
            isCond = True

        if 'media_name' in param.keys():
            arr.append(param['media_name'])
            cond += " and t.media_name=%s "
            isCond = True

        if isCond:
            sql += cond

        result = db.select(con, sql, arr)
    else:
        print 'param is none, service quit !!!'

    return result
Esempio n. 5
0
def queryToutiaoMediaUser(param, con=db.doc_db_con):
    sql = "select t.media_id, t.media_name, t.source, t.img_url, t.user_url, t.keywords, t.create_time, t.remark from sp_media_user t"
    cond = " where t.media_type='0' "

    result = []
    if param and len(param) > 0:
        arr = []

        isCond = False

        if 'source' in param.keys():
            arr.append(param['source'])
            cond += " and t.source=%s "
            isCond = True

        if 'create_time' in param.keys():
            arr.append(param['create_time'])
            cond += " and date_format(t.create_time,'" + param[
                'format'] + "')=%s "
            isCond = True

        if 'media_id' in param.keys():
            arr.append(param['media_id'])
            cond += " and t.media_id=%s "
            isCond = True

        if 'media_name' in param.keys():
            arr.append(param['media_name'])
            cond += " and t.media_name=%s "
            isCond = True

        if isCond:
            sql += cond

        result = db.select(con, sql, arr)
    else:
        print 'param is none, service quit !!!'

    return result