""" 中标时间字段检查 """ import time class PublishtimeChecker(object): """ 开标时间字段检查 """ def __init__(self): self.errors_tables = { "0201": { "name": "发布时间 > 开标时间", "parent_name": "数据范围类型", "parent_code": "02", "checkFn": self.check0201 }, "0202": { "name": "发布时间 > 当前时间", "parent_name": "数据范围类型", "parent_code": "02", "checkFn": self.check0202 } } def check0201(self, subtype:str,bidopentime: int,publishtime:int ) -> bool: """ return true 代表返回异常 """ if subtype in ["招标", "邀标", "询价", "竞谈","单一","竞价","变更"]: if bidopentime and publishtime: if bidopentime < publishtime : return True else: return False else: # 两者中有一方为空不判断 return False else: return False def check0202(self, publishtime:int ) -> bool: current_timestamp = int(time.time()) if publishtime > current_timestamp: return True else: return False