Ejemplo n.º 1
0
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
        })
Ejemplo n.º 2
0
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
Ejemplo n.º 3
0
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})
Ejemplo n.º 4
0
    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?')
Ejemplo n.º 5
0
async def Set_Data_To_1():
    DBH = DBHandler()
    result = DBH.DelDataFrom_CLD_DATA()
    return {"result": result}
Ejemplo n.º 6
0
async def Save_Data_To_DB(request_data: JsonDataModel):
    DBH = DBHandler()
    datadict = dict(request_data)
    result = DBH.SaveJsonDataToDB(datadict)
    return {"result": result}