def dbupdate(self): '''下线处理中,将信息记录到数据库中''' if self.ctime: tlist = configure.getchatimeTime(self.ctime, self.counts) ss = tlist[0] if ss < 1: return if dbStrengthenicon.getByPid(self.pid): #如果有记录 dbStrengthenicon.update(self.pid, self.ctime, self.counts) #修改 else: dbStrengthenicon.add(self.pid, self.ctime, self.counts)
def dbupdate(self): '''下线处理中,将信息记录到数据库中''' if self.ctime: tlist=configure.getchatimeTime(self.ctime,self.counts) ss=tlist[0] if ss<1: return if dbStrengthenicon.getByPid(self.pid):#如果有记录 dbStrengthenicon.update(self.pid, self.ctime, self.counts)#修改 else: dbStrengthenicon.add(self.pid, self.ctime, self.counts)
def add(self,pid): '''添加或者修改强化冷却时间 @param counts: int 冷却秒数 ''' import datetime,time ctime=datetime.datetime.fromtimestamp(time.time()) ss=self.getByPid(pid)#强化剩余冷却时间 if self.qhtime.has_key(pid): self.qhtime.get(pid)['counts']=ss+configure.m(5) self.qhtime.get(pid)['ctime']=ctime dbStrengthenicon.update(pid, ctime, self.qhtime.get(pid)['counts']) else: self.qhtime[pid]={"pid":pid,"ctime":ctime,"counts":configure.m(5)} dbStrengthenicon.add(pid, ctime, configure.m(5))