Beispiel #1
0
def getallcpid():
    sql = "select SPID,SPNAME from HNSJ_VAC_SPINFO"
    l= db.query_list(sql,())
    d={}
    for o in l:
        d[str(o[0])]=o[1]
    return d
Beispiel #2
0
def getPlayVideoByCodes(codes):
    sql = ''' select    id, 
    itemid, 
    title, 
    description, 
    videotype, 
    tags, 
    itemcode, 
    playurl, 
    pics, 
    playtimes, 
    status, 
    queryurl, 
    totaltime, 
    addtime, 
    outerplayurl, 
    mpsurl, 
    brif_desc
     
    from 
    gkgp_item  where itemcode in %s'''

    sql = sql %  codes
    sql = string.replace(sql,"[","(")
    sql = string.replace(sql,"]",")")
    return db.query_list(sql,None)
Beispiel #3
0
def gotoindexsetting():
    moduleid = request.query.get('moduleid')
    if not moduleid :
        moduleid = 1
    settings = db.query_list('select * from gkgp_main_setting where module=%s',(moduleid))

    return template('main/main_list',dict(moduledict=moduledict,domain=SITE_DOMAIN,index_settings=settings),selectmodule=moduleid,itemdict=itemdict)
Beispiel #4
0
def findItemByList(ids):
	sql = "select id,itemid,title,description,videotype,tags,itemcode,playurl,pics,\
			playtimes,status,queryurl,totaltime,addtime,outerplayurl,mpsurl,brif_desc,\
			digtimes,burytimes from gkgp_item where id in %s"
	sql = sql %  ids
	sql = string.replace(sql,"[","(")
	sql = string.replace(sql,"]",")")
	return db.query_list(sql,None)
Beispiel #5
0
def goto_edit_channel():
    parent_channel = db.query_list('select id,channel_name from gkgp_channel where pid=-1',())
    cid= request.query.get('id')
    conn=db.getmysqlconn()
    c = conn.cursor()
    sql = 'select * from gkgp_channel where id=%s'
    c.execute(sql,(cid))
    res = c.fetchone()
    c.close()
    conn.close()
    return dict(channel=res,domain=SITE_DOMAIN,cid=cid,parent_channel_list= parent_channel)
Beispiel #6
0
def getsys():
    d={}
    sql = 'select * from HNSJ_SYS_CONFIG where table_name=%s'
    l = db.query_list(sql,('DESIGN'))    
    for one in l :
        sub  = {}
        sub['id']=one[0]
        sub['title']=one[4]
        sub['value']=one[3]
        d[one[2]] =sub
    
    return d
Beispiel #7
0
def gotoedit():
    vid = request.query.get('id')
    sql = "select itemid,description,picurl,productid,status,title from HNSJ_TDCMS_CHANNEL_ITEM where itemid=%s"
    video = db.query_one(sql,(vid))
    print video
    #-----get product ---------
    sql = "select t1.id ,t1.item_id,t1.product_id,t.sp_productid from HNSJ_VAC_PROINFO t,HNSJ_TDCMS_ITEM_PRODUCT t1 where \
            t.sp_productid = t1.product_id and t1.id = %s"
    p = db.query_list(sql,(video[0]))


    #-----get support cpids----
    sql = "select column_value from HNSJ_SYS_CONFIG where column_name = %s"
    cpids = db.query_one(sql,('SUPPORT_CP_IDS'))[0]
    print cpids
    cpidsql = ','.join(cpids.split(','))
    print cpidsql

    #------get all product------
    sql = "select sp_productid,productname from HNSJ_VAC_PROINFO where spid in (%s)"
    allproductlist = db.query_list(sql,(cpidsql))


    return dict(v = video,domain=SITE_DOMAIN,allproductlist=allproductlist,p=p)
Beispiel #8
0
def play(itemcode):
    item = db.query_one('select t1.id,t1.itemcode,t.username,t.id,t1.title,t1.addtime,t1.description,t1.playtimes,t1.digtimes,t1.burytimes \
      ,t1.pics from gkgp_user t,gkgp_item t1 ,gkgp_user_item t2 where t1.id = t2.videoid and t2.userid = t.id and \
       itemcode=%s',(itemcode))
    # put play history into cookie
    # key : playlist
    # value : {'itemcode1','itemcode3','itemcode4'}
    playlist = get_cookie('playlist')
    if playlist:
        l=json.loads(playlist)
        if itemcode not in l:
            if(len(l)>=10):
                del l[0]
                l.append(itemcode)
            else:
                l.append(itemcode)
            set_cookie('playlist',json.dumps(l))
    else:
        l=[]
        l.append(itemcode)
        set_cookie('playlist',json.dumps(l))
    # end

    if item is not None:
        playtime = 0
        if item[7] is not None and item[7]>=0:
            playtime = item[7]+1
        else:
             playtime =1
        db.update('update gkgp_item set playtimes=%s where id=%s',(playtime,item[0]))
    #首发
    firstvideo = main.changeVideo(main.findItem(8,5))
    # get user  other videos
    othervideos = db.query_list('select t.title,t.pics,t.itemcode from gkgp_item t, \
        gkgp_user_item t1 where t.id=t1.videoid and t1.userid=%s order by t.addtime desc limit 0,4 ',(item[3]))

    item = list(item)
    item[7] = beautifulDisPlay(str(item[7]))
    item[8] = beautifulDisPlay(str(item[8]))
    item[9] = beautifulDisPlay(str(item[9]))

    return dict(domain=SITE_DOMAIN,picdomain=PIC_DOMAIN,itemcode=itemcode,item=item,firstvideo=firstvideo,othervideos=othervideos)
Beispiel #9
0
def getallmenu():
    sql = "select id,menuname from HNSJ_TDCMS_MENU where parent=-1"
    return db.query_list(sql,())
Beispiel #10
0
def getallchannel():
    sql = "select id,name from HNSJ_TDCMS_CHANNEL"
    return db.query_list(sql,())
Beispiel #11
0
def getallchannel():
    sql = "select id,channel_name from gkgp_channel"
    return db.query_list(sql,())
Beispiel #12
0
def getallmenu():
	sql = "select id,menuname from gkgp_cms_menu where parent=-1"
	return db.query_list(sql,())
Beispiel #13
0
def goto_add_channel():
    parent_channel = db.query_list('select id,channel_name from gkgp_channel where pid=-1',())
    return dict(domain=SITE_DOMAIN,parent_channel_list= parent_channel)
Beispiel #14
0
def findItem(module,num,begin=0):
    sql='''select id, title, brif_desc, description, item_type, item_code, link_url, position, small_pic, big_pic, module, addTime, status, updateTime from 
        gkgp_main_setting  where status=1 and  module=%s order by position asc,updateTime desc limit %s,%s '''
    return dbsetting.query_list(sql,(module,begin,num))
Beispiel #15
0
def route():
    # get item_type
    sql ='select id,channel_name from gkgp_channel'
    typelist = db.query_list(sql,())

    return template('upload',dict(domain=SITE_DOMAIN,typelist=typelist))
Beispiel #16
0
def findItemIdByChannelId(chid,start,num):
	sql = "select item_id from gkgp_channel_item_link where item_type=1 and channel_id=%s and status=1 limit %s,%s"
	return db.query_list(sql,(chid,start,num))