def query(self, word): sql = login.query(word) self.cur.execute(sql) r = self.cur.fetchone() if r: return r[0] pass
def query_btn_clicked(self): result = login.query(self.presentContact[0]) regex = re.compile('(\d{1,3}\.?){4}') if result == 'n': text = 'Friend offline' elif regex.match(result): text = 'Friend online' else: text = 'No such User!' QMessageBox.about(self, 'Query result', text)
def send_shake(source, target, port): data = {} data['type'] = 'SHAKE' data['source'] = source data['time'] = int(round(time.time() * 1000)) data['target'] = target data['data'] = '' sendCount = 0 for Id in target: ip = login.query(Id) regex = re.compile('(\d{1,3}\.?){4}') if regex.match(ip): sendCount += 1 t = threading.Thread(target=send_text_thread, args=(data, ip, port)) t.start() return [data, sendCount]
def send_file(source, target, fileName, port): data = {} data['type'] = 'FILE' data['source'] = source data['time'] = int(round(time.time() * 1000)) data['target'] = target data['data'] = fileName jsonData = json.dumps(data) sendCount = 0 for Id in target: ip = login.query(Id) regex = re.compile('(\d{1,3}\.?){4}') if regex.match(ip): sendCount += 1 t = threading.Thread(target=send_file_thread, args=(data, ip, port)) t.start() return [data, sendCount]
def send_recording(source, target, recordingName, options, port): data = {} data['type'] = 'RECORDING' data['source'] = source data['time'] = int(round(time.time() * 1000)) data['target'] = target data['data'] = [recordingName, options] jsonData = json.dumps(data) sendCount = 0 for Id in target: ip = login.query(Id) regex = re.compile('(\d{1,3}\.?){4}') if regex.match(ip): sendCount += 1 t = threading.Thread(target=send_recording_thread,\ args=(data, ip, port)) t.start() return [data, sendCount]
b = 0 log_user = login.login() #登陆验证并获取操作用户 lu_banlance = login.serach_ban(log_user, 'banlance') #获取当前用户的余额 log_account = login.get_account(log_user) #登陆用户的账户信息 now = int(time.strftime("%m")) #获取本月的月份 lst_fist = [datetime.date.today().year, datetime.date.today().month] #今年上月份 today = int(time.strftime("%Y%m%d")) #日期 #print today,type(today) if len(str(lst_fist[1])) == 1: b = '%s0%s' % (lst_fist[0], lst_fist[1]) else: b = '%s%s' % (lst_fist[0], lst_fist[1]) if int(time.strftime("%d")) == 30: print "您本月的账单为详情如下,请下月10号前按时还款!" a = login.query(log_user, b) raw_input("\033[1;32;10m 您下月需要还款%s,按确认键继续!\033[0m" % str(a)) credit = login.credit(log_user, 'credit') #登陆用户的额度 get_laccount = login.get_account(log_user) #获取登陆用户的账号信息 # u_con=login.query(log_user,time.strftime( "%Y%m"))#用户这个月用的钱 if int(credit) - int(lu_banlance) > 0 and today > 10: #欠款 with open('time.pkl', 'rb') as f: a = int(pickle.load(f)) # print "pickle-a %s"%a,type(a) if a != today: #如果记录的时间不等于当前的时间 znj = int((int(credit) - int(lu_banlance)) * 0.05) user_ban = int(lu_banlance) - znj #余额-滞纳金 log_account[4] = user_ban if user_ban >= 0: with open('bought.pkl', 'wb') as f: #刷新账户信息 pickle.dump(get_laccount, f)
if which=='1': b=0 log_user=login.login()#登陆验证并获取操作用户 lu_banlance=login.serach_ban(log_user,'banlance')#获取当前用户的余额 log_account=login.get_account(log_user)#登陆用户的账户信息 now=int(time.strftime( "%m"))#获取本月的月份 lst_fist = [datetime.date.today().year,datetime.date.today().month]#今年上月份 today=int(time.strftime("%Y%m%d"))#日期 #print today,type(today) if len(str(lst_fist[1]))==1: b='%s0%s'%(lst_fist[0],lst_fist[1]) else: b='%s%s'%(lst_fist[0],lst_fist[1]) if int(time.strftime("%d"))==30: print "您本月的账单为详情如下,请下月10号前按时还款!" a=login.query(log_user,b) raw_input("\033[1;32;10m 您下月需要还款%s,按确认键继续!\033[0m"%str(a)) credit=login.credit(log_user,'credit')#登陆用户的额度 get_laccount=login.get_account(log_user)#获取登陆用户的账号信息 # u_con=login.query(log_user,time.strftime( "%Y%m"))#用户这个月用的钱 if int(credit)-int(lu_banlance)>0 and today>10:#欠款 with open('time.pkl','rb') as f: a=int(pickle.load(f)) # print "pickle-a %s"%a,type(a) if a!=today:#如果记录的时间不等于当前的时间 znj=int((int(credit)-int(lu_banlance))*0.05) user_ban=int(lu_banlance)-znj #余额-滞纳金 log_account[4]=user_ban if user_ban>=0: with open('bought.pkl','wb') as f:#刷新账户信息 pickle.dump(get_laccount,f)