dapi/wwwroot/copy_apikey.dspy
2025-08-28 09:41:11 +08:00

61 lines
1.1 KiB
Plaintext

debug(f'{params_kw=}')
dbname = get_module_dbname('dapi')
db = DBPools()
async with db.sqlorContext(dbname) as sor:
orgid = await get_userorgid()
userid = await get_user()
ns = {
"id": params_kw.id,
"orgid":orgid,
"userid":userid
}
sql = """select a.*,
b.apikey
from downapp a, downapikey b
where a.id = b.dappid
and a.id = ${id}$
and a.orgid = ${orgid}$
and b.userid = ${userid}$"""
recs = await sor.sqlExe(sql, ns)
if len(recs):
r = recs[0]
return {
"widgettype":"VBox",
"options":{
"height":"100%",
"width":"100%"
},
"subwidgets":[
{
"widgettype":"Text",
"options":{
"wrap":True,
"halign":"left",
"text":f"appid={r.id}"
}
},
{
"widgettype":"Text",
"options":{
"wrap":True,
"halign":"left",
"text":f"apikey={password_decode(r.apikey)}"
}
},
{
"widgettype":"Text",
"options":{
"wrap":True,
"halign":"left",
"text":f"secretkey={password_decode(r.secretkey)}"
}
}
]
}
return {
"widgettype":"Text",
"options":{
"text":'copy apikey error'
}
}