Exemplo n.º 1
0
def tomenu(): 
    try:
        menuid= request.query.get('menuid')
        channelids = request.query.get('channelids')


        flag=False
        for cid in channelids.split('_'):
            if cid != '':
                select_sql = "select count(*) from gkgp_cms_menu where parent=%s and path=%s"
                res = db.query_one(select_sql,(menuid,'/channel/gotochannel?cid='+cid))
                if res[0]>0:
                    flag=True
                    continue
                # delete_sql = "delete from gkgp_cms_menu where parent=%s and path=%s"
                # db.update(delete_sql,(menuid,'/channel/gotochannel?cid='+cid))

                insert_sql = "insert into gkgp_cms_menu (menuname,path,parent) values(%s,%s,%s)"
                cname = getchannelnamebyid(cid)
                db.update(insert_sql,(cname,'/channel/gotochannel?cid='+cid,menuid))
        if flag :
            return "exist"
        else:
            return 'ok'
    except Exception,data:
        traceback.print_exc()
        return 'error'
Exemplo n.º 2
0
def tomenu():
    try:
        menuid= request.query.get('menuid')
        channelids = request.query.get('channelids')

        for cid in channelids.split('_'):
            if cid != '':
                delete_sql = "delete from HNSJ_TDCMS_MENU where parent=%s and path=%s"
                db.update(delete_sql,(menuid,'/chanel/gotochannel?cid='+cid))

                insert_sql = "insert into HNSJ_TDCMS_MENU (menuname,path,parent) values(%s,%s,%s)"
                cname = getchannelnamebyid(cid)
                db.update(insert_sql,(cname,'/channel/gotochannel?cid='+cid,menuid))
        return 'ok'
    except Exception,data:
        traceback.print_exc()
        return 'error'