import datetime

from unitls.LogerinTxt import app_logger
from .flightDB import flightDB


def getFlightData(database:flightDB,*args):
    try:
        nowDay = datetime.datetime.now()
        nowDayStr = nowDay.strftime("%Y%m%d")
        if args!=():
            flightData = database.getAlldata('TaskFlightinfo{}'.format(args[0]))
        else:
            flightData = database.getAlldata('TaskFlightinfo{}'.format(nowDayStr))
        return flightData
    except Exception as e:
        app_logger.log_error(e)
