def intents_time_actions(self): # 5 时间+行为 query = self.request.Message() btc = teamin.BizTaskCount(self.request.AgentName, self.request.AgentUID) me = teamin.NameFindNames().ResolveName(self.request.UID(), self.me) start = None end = None if hasattr(self, 'stime') and hasattr(self, 'etime'): s = CNTime(self.stime) e = CNTime(self.etime) st, en = CNTime.Merge(s.guess_time(), e.guess_time()) logger.info('raw time {},{}'.format(st, en)) start, end = st, en if hasattr(self, 'etime') and not hasattr(self, 'stime'): time = CNTime(self.etime) fromt, tot = time.guess_time() logger.info('raw time {},{}'.format(fromt, tot)) start, end = fromt, tot (count, finished, expired), weburl = btc.SpecifyDblSelect(query, me, stime=start, etime=end, actions=self.actions) if (start != None and end != None): self.intent.set_interval(int(start.timestamp() * 1000), int(end.timestamp() * 1000), weburl) return self.Response(count, finished, expired, weburl)
def intents_who_time(self): # 2 谁+时间 query = self.request.Message() bdc = teamin.BizDocCount(self.request.AgentName, self.request.AgentUID) executors = teamin.NameFindNames().ResolveName(self.request.UID(), self.executor) start = None end = None if hasattr(self, 'stime') and hasattr(self, 'etime'): s = CNTime(self.stime) e = CNTime(self.etime) st, en = CNTime.Merge(s.guess_time(), e.guess_time()) logger.info('raw time {},{}'.format(st, en)) start, end = st, en if hasattr(self, 'etime') and not hasattr(self, 'stime'): time = CNTime(self.etime) fromt, tot = time.guess_time() logger.info('raw time {},{}'.format(fromt, tot)) start, end = fromt, tot (count, weburl) = bdc.SpecifyDblSelect(query, executors, stime=start, etime=end, executors=executors) self.intent.set_interval(int(start.timestamp() * 1000), int(end.timestamp() * 1000), weburl) return self.Response(count, weburl)
def Go(self): self.initSlots() query = self.request.Message() bdc = teamin.BizDocCount(self.request.AgentName, self.request.AgentUID) if hasattr(self, 'creator'): creator = teamin.NameFindNames().ResolveName( self.request.UID(), self.creator) count, weburl = bdc.SpecifyCreators(query, creator) self.intent.set_interval(0, 0, weburl) elif hasattr(self, 'stime') or hasattr(self, 'etime'): me = teamin.NameFindNames().ResolveName(self.request.UID(), self.me) if hasattr(self, 'stime') and hasattr(self, 'etime'): # 6号和7号 s = CNTime(self.stime) e = CNTime(self.etime) start, end = CNTime.Merge(s.guess_time(), e.guess_time()) # start = str(int(st.timestamp() * 1000)) # end = str(int(en.timestamp() * 1000)) if hasattr(self, 'etime') and not hasattr(self, 'stime'): # endt:6号到7号 time = CNTime(self.etime) start, end = time.guess_time() logger.info('raw time {},{}'.format(start, end)) # start = str(int(fromt.timestamp()*1000)) # end = str(int(tot.timestamp()*1000)) logger.info('类型:s:{},e:{}'.format(type(str(start)), type(str(end)))) logger.info('时间戳:{}~{}'.format(start, end)) count, weburl = bdc.SpecifyTime(query, start, end, me) self.intent.set_interval(int(start.timestamp() * 1000), int(end.timestamp() * 1000), weburl) elif hasattr(self, 'actions'): me = teamin.NameFindNames().ResolveName(self.request.UID(), self.me) count, weburl = bdc.SpecifyCreators(query, me) self.intent.set_interval(0, 0, weburl) return self.Response(count, weburl)