This commit is contained in:
yumoqing 2025-09-01 14:45:43 +08:00
parent b392345fa9
commit 843f010500

View File

@ -57,25 +57,13 @@ async def get_userapikey(sor, upappid, callerid):
None: this orgid has not gotton apikey from upapp None: this orgid has not gotton apikey from upapp
dict if apikey and upapp infos dict if apikey and upapp infos
""" """
sql = """select
a.myappid,
a.ownerid as appownerid,
a.baseurl,
a.secretkey,
b.apikey
from upapp a left join
(select * from upappkey
where upappid=${appid}$
and ownerid = ${ownerid}$) b
on a.id = b.upappid
where a.id = ${appid}$"""
recs = await sor.R('upapp', {'id': upappid}) recs = await sor.R('upapp', {'id': upappid})
if len(recs) < 1: if len(recs) < 1:
e = Exception(f'upapp id={upappid} not found, result={recs}') e = Exception(f'upapp id={upappid} not found, result={recs}')
exception(f'{e}, {format_exc()}') exception(f'{e}, {format_exc()}')
raise e raise e
r = recs[0] r = recs[0]
apikeys = sor.R('upappkey', {'upappid': upappid, 'ownerid': callerid}) apikeys = await sor.R('upappkey', {'upappid': upappid, 'ownerid': callerid})
if len(apikeys) > 0: if len(apikeys) > 0:
r.apikey = apikeys[0].apikey r.apikey = apikeys[0].apikey
else: else: