diff --git a/uapi/appapi.py b/uapi/appapi.py index 1fd6b41..6fad5f0 100644 --- a/uapi/appapi.py +++ b/uapi/appapi.py @@ -69,12 +69,18 @@ from upapp a left join and ownerid = ${ownerid}$) b on a.id = b.upappid where a.id = ${appid}$""" - recs = await sor.sqlExe(sql, {'appid':upappid, 'ownerid': callerid}) + recs = await sor.R('upapp', {'id': upappid}) if len(recs) < 1: e = Exception(f'{upappid=}, {callerid=} has not apikey') exception(f'{e}, {format_exc()}') raise e r = recs[0] + apikeys = sor.R('upappkey', {'upappid': upappid, 'ownerid': callerid}) + if len(apikeys) > 0: + r.apikey = apikeys[0].apikey + else: + debug(f'-------user({callerid}) has not upappkey -----') + r = recs[0] debug(f'{r=}') return DictObject(**{ 'apikey':password_decode(r.apikey),