def check_link_exist(link): sql = "select * from link where link='%s'" % link result = select_db(sql) if result: return True else: return False
def get_username_password_by_id(self): sql = "select user_name,pass_word from user where uid='%s'" % self.id res = select_db(sql) if res: return res[0][0], res[0][1] else: return None, None
def get_password_uid_by_username(self): sql = "select pass_word,uid from user where user_name='%s'" % self.username res = select_db(sql) if res: return res[0][0], res[0][1] else: return None, None
def get_url_by_level_uid(level, uid): urls = [] sql = "select link from link where level=%d and status=1 and uid='%s'" % ( level, uid) results = select_db(sql) if len(results) > 0: for item in results: urls.append(item[0]) return urls
def get_links_by_phone(num): links = [] num = int(num) sql = "select link from record where phone=%d " % num results = select_db(sql) if len(results) > 0: for item in results: links.append(item[0]) return links
def select(self): ret = db.select_db() return ret
def get_data(st, ed, uid=""): sql = "select create_time from record where create_time>='%s' and create_time<'%s' and uid='%s'" % ( st, ed, uid) res = select_db(sql) return res
def get_uid_by_id(s): sql = "select uid from id where id ='%s'" % s results = select_db(sql) if len(results) == 1: return results[0][0] return None
def get_level_status_by_id(s): sql = "select level,status from id where id='%s'" % s results = select_db(sql) if len(results) == 1: return results[0][0], results[0][1] return None, None
def get_phone_amount_by_id(s): sql = "select phone,amount from record where id='%s'" % s results = select_db(sql) if results and len(results) > 0: return results[0][0], results[0][1] return None, 5 # 查询无果默认手机号None 已领取5元