|
@@ -24,8 +24,7 @@ class ScriptTask(FriendshipPoints, MysteryShopAssets, GeneralInvite):
|
|
|
day_of_week = self.start_time.weekday()
|
|
day_of_week = self.start_time.weekday()
|
|
|
if day_of_week != 2 and day_of_week != 5:
|
|
if day_of_week != 2 and day_of_week != 5:
|
|
|
logger.warning('Today is not MysteryShop day')
|
|
logger.warning('Today is not MysteryShop day')
|
|
|
- self.set_next_run(task='MysteryShop', success=False, finish=True)
|
|
|
|
|
- return
|
|
|
|
|
|
|
+ self.next_time(False)
|
|
|
self.ui_get_current_page()
|
|
self.ui_get_current_page()
|
|
|
self.ui_goto(page_mall)
|
|
self.ui_goto(page_mall)
|
|
|
self.ui_click(self.I_ME_ENTER, self.I_MS_SHARE)
|
|
self.ui_click(self.I_ME_ENTER, self.I_MS_SHARE)
|
|
@@ -41,8 +40,7 @@ class ScriptTask(FriendshipPoints, MysteryShopAssets, GeneralInvite):
|
|
|
self.back_mall()
|
|
self.back_mall()
|
|
|
|
|
|
|
|
|
|
|
|
|
- self.set_next_run(task='MysteryShop', success=True, finish=True)
|
|
|
|
|
- raise TaskEnd('MysteryShop')
|
|
|
|
|
|
|
+ self.next_time(True)
|
|
|
|
|
|
|
|
def next_one(self):
|
|
def next_one(self):
|
|
|
"""
|
|
"""
|
|
@@ -195,6 +193,33 @@ class ScriptTask(FriendshipPoints, MysteryShopAssets, GeneralInvite):
|
|
|
sleep(0.5)
|
|
sleep(0.5)
|
|
|
logger.info('Shop reward done')
|
|
logger.info('Shop reward done')
|
|
|
|
|
|
|
|
|
|
+ def next_time(self, success: bool = True):
|
|
|
|
|
+ """
|
|
|
|
|
+ 重写
|
|
|
|
|
+ """
|
|
|
|
|
+ target_time: time = self.config.mystery_shop.shop_config.time_of_mystery
|
|
|
|
|
+ target_time: timedelta = timedelta(hours=target_time.hour, minutes=target_time.minute,
|
|
|
|
|
+ seconds=target_time.second)
|
|
|
|
|
+ if target_time == time(hour=0, minute=0, second=0):
|
|
|
|
|
+ if success:
|
|
|
|
|
+ self.set_next_run(task='MysteryShop', success=True, finish=True)
|
|
|
|
|
+ else:
|
|
|
|
|
+ self.set_next_run(task='MysteryShop', success=False, finish=True)
|
|
|
|
|
+ raise TaskEnd('MysteryShop')
|
|
|
|
|
+ now = datetime.now()
|
|
|
|
|
+ day_of_week = now.weekday()
|
|
|
|
|
+ now_datetime = now.replace(hour=0, minute=0, second=0, microsecond=0)
|
|
|
|
|
+ if 2 <= day_of_week <= 4:
|
|
|
|
|
+ # 如果现在是周三和周五之间,那就设定下一次为这周六(hour=0, minute=0, second=0)+ target_time
|
|
|
|
|
+ next_time = now_datetime + timedelta(days=5 - day_of_week) + target_time
|
|
|
|
|
+ elif 5 <= day_of_week <= 6 or 0 <= day_of_week <= 1:
|
|
|
|
|
+ # 如果现在是周六和周一之间,那就设定下一次为下周三(hour=0, minute=0, second=0)+ target_time
|
|
|
|
|
+ next_time = now_datetime + timedelta(days=6 - day_of_week + 3) + target_time
|
|
|
|
|
+ else:
|
|
|
|
|
+ next_time = now_datetime + timedelta(days=2 - day_of_week) + target_time
|
|
|
|
|
+ logger.warning('Now is not in the time of mystery shop')
|
|
|
|
|
+ self.set_next_run(task='MysteryShop', target=next_time)
|
|
|
|
|
+ raise TaskEnd('MysteryShop')
|
|
|
|
|
|
|
|
|
|
|
|
|
if __name__ == '__main__':
|
|
if __name__ == '__main__':
|
|
@@ -208,4 +233,3 @@ if __name__ == '__main__':
|
|
|
# t.run_shop(t.config.mystery_shop.shop_config)
|
|
# t.run_shop(t.config.mystery_shop.shop_config)
|
|
|
t.shop_reward()
|
|
t.shop_reward()
|
|
|
|
|
|
|
|
-
|
|
|