(self, goryou_class: GoryouClass = GoryouClass.RANDOM)
| 78 | |
| 79 | |
| 80 | def check_date(self, goryou_class: GoryouClass = GoryouClass.RANDOM) -> GoryouClass: |
| 81 | day_of_week = self.start_time.weekday() |
| 82 | if day_of_week == 0: |
| 83 | # 周一不开放,退出 |
| 84 | logger.warning('Today is Monday and GoryouRealm is not open') |
| 85 | self.set_next_run(task='GoryouRealm', success=False, finish=True) |
| 86 | raise TaskEnd('GoryouRealm') |
| 87 | |
| 88 | match_day = { |
| 89 | GoryouClass.RANDOM: [1, 2, 3, 4, 5, 6], |
| 90 | GoryouClass.Dark_Divine_Dragon: [1, 5, 6], |
| 91 | GoryouClass.Dark_Hakuzousu: [2, 5, 6], |
| 92 | GoryouClass.Dark_Black_Panther: [3, 5, 6], |
| 93 | GoryouClass.Dark_Peacock: [4, 5, 6], |
| 94 | } |
| 95 | match_class = { |
| 96 | 1: GoryouClass.Dark_Divine_Dragon, |
| 97 | 2: GoryouClass.Dark_Hakuzousu, |
| 98 | 3: GoryouClass.Dark_Black_Panther, |
| 99 | 4: GoryouClass.Dark_Peacock, |
| 100 | } |
| 101 | if goryou_class == GoryouClass.RANDOM: |
| 102 | random_num = randint(1, 4) |
| 103 | goryou_class = match_class[random_num] |
| 104 | if day_of_week not in match_day[goryou_class]: |
| 105 | logger.warning(f'Today is {day_of_week} that do not support {goryou_class.name}') |
| 106 | logger.info(f'OAS will run {match_class[day_of_week].name} instead') |
| 107 | goryou_class = match_class[day_of_week] |
| 108 | |
| 109 | |
| 110 | return goryou_class |
| 111 | |
| 112 | |
| 113 |
no test coverage detected