This commit is contained in:
yumoqing 2026-07-01 13:55:22 +08:00
parent a4c0d3cbb0
commit c771771558
4 changed files with 132 additions and 11 deletions

View File

@ -6,6 +6,116 @@
"sortby":"name",
"logined_userorgid":"ownerid",
"confidential_fields":["secretkey"],
"toolbar":{
"tools":[
{
"name":"jumpin",
"label":"跳转到",
"selected_data":true
},
{
"selected_row":true,
"name":"upappkey",
"icon":"{{entire_url('/imgs/upappkey.svg')}}",
"label":"APIKEY"
},
{
"selected_row":true,
"name":"uapi",
"icon":"{{entire_url('/imgs/uapi.svg')}}",
"label":"API"
},
{
"selected_row":true,
"name":"copy_api",
"label":"复制API"
}
]
},
"binds":[
{
"wid":"self",
"event":"jumpin",
"actiontype":"urlwidget",
"target":"self",
"options":{
"url":"{{entire_url('/uapi/jump_in.dspy')}}"
}
},
{
"wid":"self",
"event":"upappkey",
"actiontype":"urlwidget",
"target":"PopupWindow",
"popup_options":{
"title":"APIKEY",
"icon":"{{entire_url('/appbase/get_icon.dspy')}}?id=upappkey",
"resizable":true,
"height":"70%",
"width":"70%"
},
"params_mapping":{
"mapping":{
"id":"upappid",
"referer_widget":"referer_widget"
},
"need_other":false
},
"options":{
"method":"POST",
"params":{},
"url":"{{entire_url('../upappkey')}}"
}
},
{
"wid":"self",
"event":"uapi",
"actiontype":"urlwidget",
"target":"PopupWindow",
"popup_options":{
"title":"API",
"icon":"{{entire_url('/appbase/get_icon.dspy')}}?id=uapi",
"resizable":true,
"height":"70%",
"width":"70%"
},
"params_mapping":{
"mapping":{
"id":"upappid",
"referer_widget":"referer_widget"
},
"need_other":false
},
"options":{
"method":"POST",
"params":{},
"url":"{{entire_url('../uapi')}}"
}
},
{
"wid":"self",
"event":"copy_api",
"actiontype":"urlwidget",
"target":"PopupWindow",
"popup_options":{
"title":"复制API到其他上位系统",
"dismiss_events":["cancel","submited"],
"height":"auto",
"width":"500px"
},
"params_mapping":{
"mapping":{
"id":"upappid"
},
"need_other":false
},
"options":{
"method":"GET",
"params":{},
"url":"{{entire_url('../copy_uapi.ui')}}"
}
}
],
"browserfields":{
"exclouded":["ownerid"],
"alters":{}
@ -14,13 +124,13 @@
"subtables":[
{
"field":"upappid",
"subtable": "upappkey",
"title": "APIKEY"
"subtable":"upappkey",
"title":"APIKEY"
},
{
"field":"upappid",
"subtable": "uapi",
"title": "API"
"subtable":"uapi",
"title":"API"
}
]
}

View File

@ -34,12 +34,6 @@
"length": 32,
"nullable": "yes"
},
{
"name": "apisetid",
"title": "api集id",
"type": "str",
"length": 32
},
{
"name": "secretkey",
"title": "加密密钥",

View File

@ -23,6 +23,8 @@ paths = [
("/uapi/minimax_callback.dspy", "any"),
("/uapi/uptask_callback.dspy", "any"),
("/uapi/viducallback", "any"),
("/uapi/copy_uapi.ui", "logined"),
("/uapi/api/copy_uapi.dspy", "logined"),
]

View File

@ -1,4 +1,5 @@
from ahserver.serverenv import ServerEnv
from sqlor.dbpools import get_sor_context
from .appapi import (
UAPI,
deerer,
@ -17,6 +18,19 @@ from .uptask import (
from .uapi import UpAppApi
from .apidata import UAPIData
async def get_upapps_for_copy(request):
"""获取所有upapp供复制API时选择目标排除源upapp"""
source_upappid = (request._run_ns.params_kw or {}).get('upappid', '')
env = ServerEnv()
async with get_sor_context(env, 'uapi') as sor:
sql = "select id as value, name as text from upapp"
ns = {}
if source_upappid:
sql += " where id != ${source_upappid}$"
ns['source_upappid'] = source_upappid
recs = await sor.sqlExe(sql, ns)
return recs
def load_uapi():
g = ServerEnv()
g.UAPI = UAPI
@ -32,6 +46,7 @@ def load_uapi():
g.get_my_uptasks = get_my_uptasks
g.uptask_feedback = uptask_feedback
g.uptask_started = uptask_started
g.get_upapps_for_copy = get_upapps_for_copy
# Bind hot_reload event — instance method, WeakMethod safe (stored on g)
if hasattr(g, 'event_dispatcher'):
g.event_dispatcher.bind('hot_reload', g.uapi_data.on_hot_reload)