40 lines
1.0 KiB
Plaintext
40 lines
1.0 KiB
Plaintext
class Params:
|
|
def __init__(obj, sor):
|
|
obj.sor = sor
|
|
obj.accounting_orgid = '6woiJ-_5tDmZUHFnLLty_'
|
|
obj.customerid = 'Uf0e9kZ4MXcHQvaHsbnVr'
|
|
obj.productid='XGcWsUEgFc6kmXgr_ZFNy'
|
|
obj.curdate = '2023-06-30'
|
|
|
|
async def get_customer_price(obj):
|
|
sor = obj.sor
|
|
print('=========begin============')
|
|
sql1 = """select * from floorprice
|
|
where offer_orgid = ${id}$
|
|
and (bid_orgid = ${customerid}$ or bid_orgid = '' or bid_orgid is null)
|
|
and productid = ${productid}$
|
|
and begin_date <= ${curdate}$
|
|
and ${curdate}$ < end_date
|
|
and del_flg = '0'
|
|
"""
|
|
ns = {
|
|
'id':obj.accounting_orgid,
|
|
'customerid':obj.customerid,
|
|
'productid':obj.productid,
|
|
'curdate':obj.curdate
|
|
}
|
|
print('1=========begin============', ns)
|
|
recs = await sor.sqlExe(sql1, ns.copy())
|
|
print(f'{recs=}, {sql1=},{obj.curdate=}')
|
|
if len(recs) > 0:
|
|
p = recs[0]['price']
|
|
return {'price':p}
|
|
print('5=========error============', ns)
|
|
|
|
db = DBPools()
|
|
async with db.sqlorContext('kboss') as sor:
|
|
obj = Params(sor)
|
|
x = await obj.get_customer_price()
|
|
return x
|
|
|