def noticeDaily(self, dailytype, associatedId, count):
     '''目标通知
     @param dailytype: int 目标类型
     @param associatedId: int 关联的ID
     @param count: int 变更的数量
     '''
     dailylist = dbdaily.getDailyForToday(dailytype,
                                          self._owner.creatTime)  #符合今日的目标
     characterId = self._owner.baseInfo.id
     if not dailylist:
         return
     for daily in dailylist:
         if daily['dailytype'] != dailytype or (
                 associatedId != 0
                 and associatedId != daily['associatedId']):
             continue
         if not self.dailygoal.has_key(daily['id']):
             self.dailygoal[daily['id']] = {'current': 0, 'received': 0}
             dbdaily.insertCharacterDaily(characterId, daily['id'])
         mydaily = self.dailygoal.get(daily['id'])
         if count < 0:
             count = mydaily['current'] - count
         if mydaily['current'] < daily['goal']:
             mydaily['current'] = min(count, daily['goal'])
             dbdaily.updateCharacterDaily(characterId, daily['id'],
                                          {'current': mydaily['current']})
 def noticeDaily(self,dailytype,associatedId,count):
     '''目标通知
     @param dailytype: int 目标类型
     @param associatedId: int 关联的ID
     @param count: int 变更的数量
     '''
     dailylist = dbdaily.getDailyForToday(dailytype,self._owner.creatTime)#符合今日的目标
     characterId = self._owner.baseInfo.id
     if not dailylist:
         return
     for daily in dailylist:
         if daily['dailytype']!=dailytype or (associatedId !=0 and associatedId !=daily['associatedId']):
             continue
         if not self.dailygoal.has_key(daily['id']):
             self.dailygoal[daily['id']] = {'current':0,'received':0}
             dbdaily.insertCharacterDaily(characterId, daily['id'])
         mydaily = self.dailygoal.get(daily['id'])
         if count<0:
             count = mydaily['current']-count
         if mydaily['current']<daily['goal']:
             mydaily['current'] = min(count,daily['goal'])
             dbdaily.updateCharacterDaily(characterId, daily['id'], {'current':mydaily['current']})
    def checkFinished(self, dailyID):
        '''检测是否完成
        @param dailyID: int 
        '''

        finished = False
        daily = dbdaily.ALL_DAILY.get(dailyID)
        createtime = self._owner.creatTime
        thisdate = datetime.date.today()
        daysdelta = (thisdate - createtime.date()).days + 1
        if not self.dailygoal.has_key(daily['id']):
            characterId = self._owner.baseInfo.id
            self.dailygoal[daily['id']] = {'current': 0, 'received': 0}
            dbdaily.insertCharacterDaily(characterId, daily['id'])
        if daysdelta < daily['dateindex']:  #不能提前完成任务
            return False
        mydaily = self.dailygoal.get(dailyID)
        if daily['dailytype'] == 2 and daysdelta >= daily['dateindex']:
            if self._owner.guild.getGuildLevel() >= daily['goal']:
                finished = True
        else:
            if mydaily and mydaily['current'] >= daily['goal']:
                finished = True
        return finished
 def checkFinished(self,dailyID):
     '''检测是否完成
     @param dailyID: int 
     '''
     
     finished = False
     daily = dbdaily.ALL_DAILY.get(dailyID)
     createtime = self._owner.creatTime
     thisdate = datetime.date.today()
     daysdelta = (thisdate - createtime.date()).days+1
     if not self.dailygoal.has_key(daily['id']):
         characterId = self._owner.baseInfo.id
         self.dailygoal[daily['id']] = {'current':0,'received':0}
         dbdaily.insertCharacterDaily(characterId, daily['id'])
     if daysdelta < daily['dateindex']:#不能提前完成任务
         return False
     mydaily = self.dailygoal.get(dailyID)
     if daily['dailytype']==2 and daysdelta >= daily['dateindex']:
         if self._owner.guild.getGuildLevel()>=daily['goal']:
             finished = True
     else:
         if mydaily and mydaily['current']>=daily['goal']:
             finished = True
     return finished