Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Server Maintain for Hunt Logs #158

Merged
merged 3 commits into from
Apr 27, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Update hunt_maintain.py
  • Loading branch information
a08381 authored Apr 27, 2022
commit 42e5c0e4f52b80a87cd68abd1818aac4ab2de2f1
11 changes: 9 additions & 2 deletions utils/hunt_maintain.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import sys
import os
import time
import datetime
import django

sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
Expand All @@ -12,7 +13,7 @@
from ffxivbot.models import *


def hunt_maintain(keyword: str = '国', maintain_time = time.time()):
def hunt_maintain(keyword: str = '国', strtime: str = ''):
if keyword == "国服" or keyword == '国':
servers = Server.objects.all()
elif keyword == "陆行鸟" or keyword == '鸟':
Expand All @@ -23,7 +24,13 @@ def hunt_maintain(keyword: str = '国', maintain_time = time.time()):
servers = Server.objects.filter(areaId=7)
elif keyword == "豆豆柴" or keyword == '狗':
servers = Server.objects.filter(areaId=8)
servers = Server.objects.filter(name=keyword)
else:
servers = Server.objects.filter(name=keyword)

if strtime != '':
maintain_time = datetime.datetime.strptime(strtime + '+0800', '%Y%m%d_%H%M%S%z').timestamp()
else:
maintain_time = time.time()
for s in servers:
hunt_log = HuntLog(server=s, log_type="maintain", time=maintain_time)
hunt_log.save()
Expand Down