def checkapikey(apikey): conn = getConn() conn.query("""select apikey from mgnt_apikey where apikey='%s';""" % apikey) result = conn.store_result().fetch_row() if result == (): return False else: return True
def surl(surl): item = {} if len(surl) != 6: error = u"亲,您输入的段地址好像不对哦~" return render_template("/m/show.html", error = error) else: conn = getConn() conn.query("""select short_url,long_url from mgnt_url where short_url='%s';""" % surl) result = conn.store_result().fetch_row() if result == (): error = u"不好意思,没有找到此链接..." return render_template("/m/show.html", error = error) else: short_link = result[0][0] maglink = result[0][1] hashid = maglink[20:60] item["short_link"] = "http://mgnt.me/m/"+short_link item["maglink"] = maglink item["hashid"] = hashid item["vodlink"] = urllib2.quote(u"/vodplay/magnet:?xt=urn:btih:")+hashid+"/Unknown" return render_template("/m/show.html",item=item)
def surl(surl): item = {} if len(surl) != 6: error = u"亲,您输入的段地址好像不对哦~" return render_template("/m/show.html", error=error) else: conn = getConn() conn.query( """select short_url,long_url from mgnt_url where short_url='%s';""" % surl) result = conn.store_result().fetch_row() if result == (): error = u"不好意思,没有找到此链接..." return render_template("/m/show.html", error=error) else: short_link = result[0][0] maglink = result[0][1] hashid = maglink[20:60] item["short_link"] = "http://mgnt.me/m/" + short_link item["maglink"] = maglink item["hashid"] = hashid item["vodlink"] = urllib2.quote( u"/vodplay/magnet:?xt=urn:btih:") + hashid + "/Unknown" return render_template("/m/show.html", item=item)
def addtimes(apikey): conn = getConn() conn.query("""update mgnt_apikey set times=times+1 where apikey='%s'""" % apikey)