bugfix
This commit is contained in:
parent
e453883b61
commit
df212ea40d
@ -17,11 +17,6 @@
|
|||||||
"field":"userid",
|
"field":"userid",
|
||||||
"title":"用户角色",
|
"title":"用户角色",
|
||||||
"subtable":"userrole"
|
"subtable":"userrole"
|
||||||
},
|
|
||||||
{
|
|
||||||
"field":"userid",
|
|
||||||
"title":"APIKEY",
|
|
||||||
"subtable":"userapp"
|
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
@ -84,6 +84,7 @@ async with db.sqlorContext(dbname) as sor:
|
|||||||
"widgettype":"Message",
|
"widgettype":"Message",
|
||||||
"options":{
|
"options":{
|
||||||
"timeout":3,
|
"timeout":3,
|
||||||
|
"anchor": "cc",
|
||||||
"auto_open":True,
|
"auto_open":True,
|
||||||
"title":"Login",
|
"title":"Login",
|
||||||
"message":f"{r[0].username} Welcome back"
|
"message":f"{r[0].username} Welcome back"
|
||||||
|
|||||||
@ -1,25 +0,0 @@
|
|||||||
|
|
||||||
ns = params_kw.copy()
|
|
||||||
id = params_kw.id
|
|
||||||
if not id or len(id) > 32:
|
|
||||||
id = uuid()
|
|
||||||
ns['id'] = id
|
|
||||||
db = DBPools()
|
|
||||||
async with db.sqlorContext('sage') as sor:
|
|
||||||
r = await sor.C('userapikey', ns.copy())
|
|
||||||
return {
|
|
||||||
"widgettype":"Message",
|
|
||||||
"options":{
|
|
||||||
"user_data":ns,
|
|
||||||
"title":"Add Success",
|
|
||||||
"message":"ok"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return {
|
|
||||||
"widgettype":"Error",
|
|
||||||
"options":{
|
|
||||||
"title":"Add Error",
|
|
||||||
"message":"failed"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,24 +0,0 @@
|
|||||||
|
|
||||||
ns = {
|
|
||||||
'id':params_kw['id'],
|
|
||||||
}
|
|
||||||
db = DBPools()
|
|
||||||
async with db.sqlorContext('sage') as sor:
|
|
||||||
r = await sor.D('userapikey', ns)
|
|
||||||
print('delete success');
|
|
||||||
return {
|
|
||||||
"widgettype":"Message",
|
|
||||||
"options":{
|
|
||||||
"title":"Delete Success",
|
|
||||||
"message":"ok"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
print('Delete failed');
|
|
||||||
return {
|
|
||||||
"widgettype":"Error",
|
|
||||||
"options":{
|
|
||||||
"title":"Delete Error",
|
|
||||||
"message":"failed"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,74 +0,0 @@
|
|||||||
|
|
||||||
ns = params_kw.copy()
|
|
||||||
print(f'get_userapikey.dspy:{ns=}')
|
|
||||||
if not ns.get('page'):
|
|
||||||
ns['page'] = 1
|
|
||||||
if not ns.get('sort'):
|
|
||||||
|
|
||||||
ns['sort'] = 'id'
|
|
||||||
|
|
||||||
filterjson = params_kw.get('data_filter')
|
|
||||||
userid = await get_user()
|
|
||||||
ns['userid'] = userid
|
|
||||||
if not filterjson:
|
|
||||||
fields = [ f['name'] for f in [
|
|
||||||
{
|
|
||||||
"name": "id",
|
|
||||||
"title": "id",
|
|
||||||
"type": "str",
|
|
||||||
"length": 32
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "providerid",
|
|
||||||
"title": "\u4f9b\u5e94\u5546id",
|
|
||||||
"type": "str",
|
|
||||||
"length": 200
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "customerid",
|
|
||||||
"title": "\u7528\u6237id",
|
|
||||||
"type": "str",
|
|
||||||
"length": 32,
|
|
||||||
"default": "0"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "apikey",
|
|
||||||
"title": "api\u5bc6\u94a5",
|
|
||||||
"type": "str",
|
|
||||||
"length": 4000,
|
|
||||||
"default": "0"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "secretkey",
|
|
||||||
"title": "\u9644\u5c5e\u5bc6\u94a5",
|
|
||||||
"type": "str",
|
|
||||||
"length": 4000
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "rfname",
|
|
||||||
"title": "\u51fd\u6570\u540d",
|
|
||||||
"type": "str",
|
|
||||||
"length": 400
|
|
||||||
}
|
|
||||||
] ]
|
|
||||||
filterjson = default_filterjson(fields, ns)
|
|
||||||
sql = '''select a.*, b.providerid_text, c.customerid_text
|
|
||||||
from (select y.* from users x, userapikey y where x.id=${userid}$ and x.orgid = y.customerid) a left join (select id as providerid,
|
|
||||||
orgname as providerid_text from organization where 1 = 1) b on a.providerid = b.providerid left join (select id as customerid,
|
|
||||||
orgname as customerid_text from organization where 1 = 1) c on a.customerid = c.customerid'''
|
|
||||||
|
|
||||||
if filterjson:
|
|
||||||
dbf = DBFilter(filterjson)
|
|
||||||
conds = dbf.gen(ns)
|
|
||||||
if conds:
|
|
||||||
ns.update(dbf.consts)
|
|
||||||
sql += ' and ' + conds
|
|
||||||
info(f'{ns=},{sql=}')
|
|
||||||
db = DBPools()
|
|
||||||
async with db.sqlorContext('sage') as sor:
|
|
||||||
r = await sor.sqlPaging(sql, ns)
|
|
||||||
return r
|
|
||||||
return {
|
|
||||||
"total":0,
|
|
||||||
"rows":[]
|
|
||||||
}
|
|
||||||
@ -1,134 +0,0 @@
|
|||||||
{
|
|
||||||
"widgettype": "VBox",
|
|
||||||
"options": {
|
|
||||||
"css": "filler", "height": "100%",
|
|
||||||
"width": "100%"
|
|
||||||
},
|
|
||||||
"subwidgets": [
|
|
||||||
{
|
|
||||||
"widgettype":"Tabular",
|
|
||||||
"options":{
|
|
||||||
|
|
||||||
|
|
||||||
"editable":{
|
|
||||||
"new_data_url":"{{entire_url('add_userapikey.dspy')}}",
|
|
||||||
"delete_data_url":"{{entire_url('delete_userapikey.dspy')}}",
|
|
||||||
"update_data_url":"{{entire_url('update_userapikey.dspy')}}"
|
|
||||||
},
|
|
||||||
|
|
||||||
"data_url":"{{entire_url('./get_userapikey.dspy')}}",
|
|
||||||
"data_method":"GET",
|
|
||||||
"data_params":{{json.dumps(params_kw, indent=4)}},
|
|
||||||
"row_options":{
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
"browserfields":{
|
|
||||||
"excloud": [],
|
|
||||||
"cwidth": {}
|
|
||||||
},
|
|
||||||
|
|
||||||
|
|
||||||
"editexclouded":[
|
|
||||||
"id"
|
|
||||||
],
|
|
||||||
|
|
||||||
"fields":[
|
|
||||||
{
|
|
||||||
"name": "id",
|
|
||||||
"title": "id",
|
|
||||||
"type": "str",
|
|
||||||
"length": 32,
|
|
||||||
"cwidth": 18,
|
|
||||||
"uitype": "str",
|
|
||||||
"datatype": "str",
|
|
||||||
"label": "id"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "providerid",
|
|
||||||
"title": "\u4f9b\u5e94\u5546id",
|
|
||||||
"type": "str",
|
|
||||||
"length": 200,
|
|
||||||
"label": "\u4f9b\u5e94\u5546id",
|
|
||||||
"cwidth":16,
|
|
||||||
"uitype": "code",
|
|
||||||
"cwidth":18,
|
|
||||||
"valueField": "providerid",
|
|
||||||
"textField": "providerid_text",
|
|
||||||
"params": {
|
|
||||||
"dbname": "sage",
|
|
||||||
"table": "organization",
|
|
||||||
"tblvalue": "id",
|
|
||||||
"tbltext": "orgname",
|
|
||||||
"valueField": "providerid",
|
|
||||||
"textField": "providerid_text"
|
|
||||||
},
|
|
||||||
"dataurl": "\/get_code.dspy"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "customerid",
|
|
||||||
"title": "\u7528\u6237id",
|
|
||||||
"type": "str",
|
|
||||||
"length": 32,
|
|
||||||
"cwidth":18,
|
|
||||||
"default": "0",
|
|
||||||
"label": "\u7528\u6237id",
|
|
||||||
"cwidth":16,
|
|
||||||
"uitype": "code",
|
|
||||||
"valueField": "customerid",
|
|
||||||
"textField": "customerid_text",
|
|
||||||
"params": {
|
|
||||||
"dbname": "sage",
|
|
||||||
"table": "organization",
|
|
||||||
"tblvalue": "id",
|
|
||||||
"tbltext": "orgname",
|
|
||||||
"valueField": "customerid",
|
|
||||||
"textField": "customerid_text"
|
|
||||||
},
|
|
||||||
"dataurl": "\/get_code.dspy"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "apikey",
|
|
||||||
"title": "api\u5bc6\u94a5",
|
|
||||||
"type": "str",
|
|
||||||
"length": 4000,
|
|
||||||
"default": "0",
|
|
||||||
"cwidth": 18,
|
|
||||||
"uitype": "text",
|
|
||||||
"rows": 4,
|
|
||||||
"datatype": "str",
|
|
||||||
"label": "api\u5bc6\u94a5"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "secretkey",
|
|
||||||
"title": "\u9644\u5c5e\u5bc6\u94a5",
|
|
||||||
"type": "str",
|
|
||||||
"length": 4000,
|
|
||||||
"cwidth": 18,
|
|
||||||
"uitype": "text",
|
|
||||||
"rows": 4,
|
|
||||||
"datatype": "str",
|
|
||||||
"label": "\u9644\u5c5e\u5bc6\u94a5"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "rfname",
|
|
||||||
"title": "\u51fd\u6570\u540d",
|
|
||||||
"type": "str",
|
|
||||||
"length": 400,
|
|
||||||
"cwidth": 18,
|
|
||||||
"uitype": "text",
|
|
||||||
"rows": 4,
|
|
||||||
"datatype": "str",
|
|
||||||
"label": "\u51fd\u6570\u540d"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
|
|
||||||
"page_rows":160,
|
|
||||||
"cache_limit":5
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
@ -1,22 +0,0 @@
|
|||||||
|
|
||||||
ns = params_kw.copy()
|
|
||||||
db = DBPools()
|
|
||||||
async with db.sqlorContext('sage') as sor:
|
|
||||||
r = await sor.U('userapikey', ns)
|
|
||||||
print('update success');
|
|
||||||
return {
|
|
||||||
"widgettype":"Message",
|
|
||||||
"options":{
|
|
||||||
"title":"Update Success",
|
|
||||||
"message":"ok"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
print('update failed');
|
|
||||||
return {
|
|
||||||
"widgettype":"Error",
|
|
||||||
"options":{
|
|
||||||
"title":"Update Error",
|
|
||||||
"message":"failed"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Loading…
x
Reference in New Issue
Block a user