def server_reply(self,data): admin=SqlAdmin() result='Hi' reply_dicts=admin.auto_reply() for line_dict in reply_dicts: for i in line_dict: if i == 'rev' and data.lower() in line_dict[i].lower(): result=line_dict['reply'] return result
def create_recordtable(name):#创建记录表 admin=SqlAdmin() table_list=[] mysql_tables=admin.check_tables() for dic in mysql_tables: for i in dic: table_list.append(dic[i]) if name not in table_list: admin.create_table(name) else: print 'exist table %s'%name
def check_record(name): admin=SqlAdmin() check_result=admin.check_record(name) for eachline in check_result: print eachline
def write_recordtable(name,client_data,server_data):#记录聊天到对应表里面 admin=SqlAdmin() admin.insert_data_to_table(name, client_data, server_data)