[Enhance] API for redeem

- Add API endpoints for redeem system
- Continue to fix the bug mentioned in 930faf508d
This commit is contained in:
Lost-MSth
2023-02-28 18:28:09 +08:00
parent 930faf508d
commit a84ec560dd
15 changed files with 283 additions and 50 deletions

View File

@@ -94,7 +94,7 @@ class TCPRouter:
self.data = data # data: list[str] = [command, ...]
def debug(self):
if Config.IS_DEBUG:
if Config.DEBUG:
return eval(self.data[1])
return 'ok'
@@ -186,9 +186,13 @@ class TCPRouter:
return '1202'
room: Room = Store.room_code_dict[room_code]
if room.player_num == 4:
player_num = room.player_num
if player_num == 4:
# 满人
return '1201'
elif player_num == 0:
# 房间不存在
return '1202'
elif room.state != 2:
# 无法加入
return '1205'