async def BaoXianGetDataVersion_2(request: Request, searchType: Optional[int] = 1, page: int = None, program_id: int = None, product_key: str = None, pageSize: int = None): DBH = DBHandler() datadict = { "searchType": 1, "page": page or 1, "program_id": program_id or 999, "product_key": product_key or "", "pageSize": pageSize or 5 } product_list, total_num = DBH.GetJsonDataFromDB(datadict) pageList = [ datadict["page"] - 2, datadict["page"] - 1, datadict["page"], datadict["page"] + 1, datadict["page"] + 2 ] return templates.TemplateResponse( "main_v2.html", { "request": request, "ProductsList": product_list, "DataDict": datadict, "pageList": pageList, "total_num": total_num })
async def BaoXianGetData(request: Request, searchType: Optional[int] = 1, page: int = None, program_id: int = None, product_key: str = None, pageSize: int = None): DBH_TEST = DBHandler() datadict = { "searchType": 1, "page": page or 1, # program_id: # 1000: BaoYun18 # 1001: QiXin18 # 1002: Niubao 100 # 1004: FengQi # 1005: Zhongbao # 其他:ALL "program_id": program_id or 999, "product_key": product_key or "", "pageSize": pageSize or 5 } product_list, total_num = DBH_TEST.GetJsonDataFromDB(datadict) pageList = [ datadict["page"] - 2, datadict["page"] - 1, datadict["page"], datadict["page"] + 1, datadict["page"] + 2 ] # return templates.TemplateResponse("index.html", {"request":request,"ProductsList": product_list, "DataDict":datadict, "pageList":pageList, "total_num":total_num}) return product_list
async def App_Run(request:Request, searchType: Optional[int] = 1, page:int = None, program_id:int = None, product_id:int = None, product_key:str = None, pageSize:int = None): DBH = DBHandler() datadict = { "searchType": 1, "page": page or 1, "program_id": program_id or 999, "product_key": product_key or "", "pageSize": pageSize or 5 } result_dict = DBH.GetDataFromDB(datadict) ProductsList = result_dict["result_list"] if result_dict["success"] else [] total_num = result_dict["total_num"] if result_dict["success"] else 0 pageList = [datadict["page"]-2, datadict["page"]-1, datadict["page"], datadict["page"]+1, datadict["page"]+2] return templates.TemplateResponse("index.html", {"request":request,"ProductsList": ProductsList, "DataDict":datadict, "pageList":pageList, "total_num":total_num})
def test_spins_up_and_initializes(self): db = DBHandler('horses_test') race_date = date(2017, 5, 6) race_id = RaceID(race_date, 'CD', 12) sut = Race(race_id, db) self.fail('Why is the 2017 KY Derby showing up as a race not found?')
async def Set_Data_To_1(): DBH = DBHandler() result = DBH.DelDataFrom_CLD_DATA() return {"result": result}
async def Save_Data_To_DB(request_data: JsonDataModel): DBH = DBHandler() datadict = dict(request_data) result = DBH.SaveJsonDataToDB(datadict) return {"result": result}