from unitls.LogerinTxt import app_logger
from .flightDB import flightDB


def maintainAuthCheck(fdb:flightDB,name,flighttype):
    try:
        list = ["1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12"]
        notpasspeople=[]
        sts=False
        if name != "清空项目12345678987654321" and str(name) not in list:
            names = name.split(",")
            for people in names:
                search = fdb.queryTabel("workerinfo","姓名","姓名 = '{}' and 南航授权 like '%{}%'".format(people,flighttype))
                if search or len(search) !=0:
                    sts = True
                else:
                    sts = False
                    notpasspeople.append(people)

            if sts:
                return { "返回值" : "ok" }
            else:
                return {"返回值" : "notpass","未通过人员":notpasspeople}
        else:
            return  {"返回值": "ok"}
    except Exception as e:
        app_logger.log_error(e)
        return {"返回值": "fail"}