async def post(self, *args, **kwargs): # 重庆时时彩 termnumber = 59 ut = UtilTime() today = ut.arrow_to_string(format_v="YYYYMMDD") tomorrow = ut.arrow_to_string(ut.today.shift(days=1), format_v="YYYYMMDD") data = {} tomorrow_first_next = "" for i in range(termnumber): term = "%s0%02d" % (tomorrow, i + 1) if i == 0: tomorrow_first_next = term if i == termnumber - 1: nextterm = "today" else: nextterm = "%s0%02d" % (tomorrow, i + 2) data[term] = nextterm await self.redis.hset("term_cqssc", format(tomorrow), json.dumps({"term": data})) data = {} for i in range(termnumber): term = "%s0%02d" % (today, i + 1) if i == termnumber - 1: nextterm = tomorrow_first_next else: nextterm = "%s0%02d" % (today, i + 2) data[term] = nextterm await self.redis.hset("term_cqssc", format(today), json.dumps({"term": data})) return None
async def post(self, *args, **kwargs): ut = UtilTime() start = self.data['obj']['quiet'].split("-")[0] end = self.data['obj']['quiet'].split("-")[1] s = ut.arrow_to_string(format_v="HH:mm") if start <= s <= end: logger.info("处于安静时间{},{}".format(self.data['obj']['quiet'], s)) return None else: pass t = self.data['obj']['nosend_limit'].split(',')[0] u = self.data['obj']['nosend_limit'].split(',')[1] createtime = ut.today if u == 'H': runTime = createtime.shift(hours=int(t)) elif u == 'M': runTime = createtime.shift(minutes=int(t)) elif u == 'S': runTime = createtime.shift(seconds=int(t)) else: return None if self.data['obj']['send_type'] == '0': self.scheduler.add_job( reply_run, 'date', run_date=runTime.datetime, kwargs={ "url": "{}/v1/api/wechat/AccReply_Send".format( self.application.settings.get("busiServer")), "data": { "data": { "obj": self.data['obj'], "send_type": '1', "listids": self.data['obj']['listids'], "nickname": self.data.get("nickname"), "openid": self.data.get("openid"), "accid": self.data.get("accid"), "createtime": createtime.timestamp } } }) elif self.data['obj']['send_type'] == '1': for item in json.loads(self.data['obj']['listids']): print(runTime.datetime) self.scheduler.add_job( reply_run, 'date', run_date=runTime.datetime, kwargs={ "url": "{}/v1/api/wechat/AccReply_Send".format( self.application.settings.get("busiServer")), "data": { "data": { "obj": self.data['obj'], "send_type": '2', "listids": [item], "nickname": self.data.get("nickname"), "openid": self.data.get("openid"), "accid": self.data.get("accid"), "createtime": createtime.timestamp } } }) if self.data['obj']['send_limit'].split(",")[1] == 'H': runTime = runTime.shift(hours=int( self.data['obj']['send_limit'].split(",")[0])) elif self.data['obj']['send_limit'].split(",")[1] == 'M': runTime = runTime.shift(minutes=int( self.data['obj']['send_limit'].split(",")[0])) elif self.data['obj']['send_limit'].split(",")[1] == 'S': runTime = runTime.shift(seconds=int( self.data['obj']['send_limit'].split(",")[0])) elif self.data['obj']['send_type'] == '2': self.scheduler.add_job( reply_run, 'date', run_date=runTime.datetime, kwargs={ "url": "{}/v1/api/wechat/AccReply_Send".format( self.application.settings.get("busiServer")), "data": { "data": { "obj": self.data['obj'], "send_type": '0', "listids": self.data['obj']['listids'], "nickname": self.data.get("nickname"), "openid": self.data.get("openid"), "accid": self.data.get("accid"), "createtime": createtime.timestamp } } }) return None