def __init__(self, owner): Component.__init__(self, owner) self.owner = owner self.pid = owner.baseInfo.id #角色id self.ctime = None #记录时间 self.counts = 0 #秒数间隔(剩余秒数) info = dbStrengthenicon.getByPid(self.pid) #剩余时间记录 if info: self.ctime = info['ctime'] self.counts = info['counts']
def __init__(self,owner): Component.__init__(self, owner) self.owner=owner self.pid=owner.baseInfo.id#角色id self.ctime=None#记录时间 self.counts=0#秒数间隔(剩余秒数) info=dbStrengthenicon.getByPid(self.pid)#剩余时间记录 if info: self.ctime=info['ctime'] self.counts=info['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 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)