Compare commits

...

3 Commits

7 changed files with 439 additions and 3 deletions

153
models/uapi.json Normal file
View File

@ -0,0 +1,153 @@
{
"summary": [
{
"name": "uapi",
"title": "API接口",
"primary": [
"id"
],
"catelog": "entity"
}
],
"fields": [
{
"name": "id",
"title": "id",
"type": "str",
"length": 32
},
{
"name": "upappid",
"title": "上位系统ID",
"type": "str",
"length": 32
},
{
"name": "name",
"title": "api名称",
"type": "str",
"length": 200
},
{
"name": "title",
"title": "API标题",
"type": "str",
"length": 100
},
{
"name": "description",
"title": "接口描述",
"type": "text"
},
{
"name": "need_auth",
"title": "需要鉴权",
"type": "str",
"length": 1,
"default": "0"
},
{
"name": "stream",
"title": "流式输出",
"type": "str",
"length": 20
},
{
"name": "path",
"title": "path",
"type": "str",
"length": 4000
},
{
"name": "httpmethod",
"title": "http方法",
"type": "str",
"length": 20,
"nullable": "yes",
"default": "GET"
},
{
"name": "chunk_match",
"title": "流式匹配串",
"type": "str",
"length": 100
},
{
"name": "headers",
"title": "headers模版",
"type": "text",
"nullable": "yes"
},
{
"name": "params",
"title": "参数模版",
"type": "text",
"nullable": "yes"
},
{
"name": "data",
"title": "数据模版",
"type": "text",
"nullable": "yes"
},
{
"name": "response",
"title": "响应模版",
"type": "text",
"nullable": "yes"
},
{
"name": "ioid",
"title": "输入输出id",
"type": "str",
"length": 32,
"nullable": "yes"
},
{
"name": "callbackurl",
"title": "回调url",
"type": "str",
"length": 1000,
"nullable": "yes"
}
],
"indexes": [
{
"name": "idx1",
"idxtype": "unique",
"idxfields": [
"upappid",
"name"
]
}
],
"codes": [
{
"field": "httpmethod",
"table": "appcodes_kv",
"valuefield": "k",
"textfield": "v",
"cond": "parentid='httpmethod'"
},
{
"field": "need_auth",
"table": "appcodes_kv",
"valuefield": "k",
"textfield": "v",
"cond": "parentid='yesno'"
},
{
"field": "stream",
"table": "appcodes_kv",
"valuefield": "k",
"textfield": "v",
"cond": "parentid='resp_mode'"
},
{
"field": "ioid",
"table": "uapiio",
"valuefield": "id",
"textfield": "name"
}
]
}

36
models/uapiio.json Normal file
View File

@ -0,0 +1,36 @@
{
"summary": [
{
"name": "uapiio",
"title": "输入输出",
"primary": [
"id"
],
"catelog": "entity"
}
],
"fields": [
{
"name": "id",
"title": "id",
"type": "str",
"length": 32
},
{
"name": "name",
"title": "类型名",
"type": "str",
"length": 100
},
{
"name": "description",
"title": "类型说明",
"type": "text"
},
{
"name": "input_fields",
"title": "输入字段",
"type": "text"
}
]
}

83
models/upapp.json Normal file
View File

@ -0,0 +1,83 @@
{
"summary": [
{
"name": "upapp",
"title": "外部系统",
"primary": [
"id"
]
}
],
"fields": [
{
"name": "id",
"title": "id",
"type": "str",
"length": 32
},
{
"name": "name",
"title": "上位应用名",
"type": "str",
"length": 200
},
{
"name": "description",
"title": "描述",
"type": "text",
"default": "0"
},
{
"name": "ownerid",
"title": "所属机构",
"type": "str",
"length": 32,
"nullable": "yes"
},
{
"name": "apisetid",
"title": "api集id",
"type": "str",
"length": 32
},
{
"name": "secretkey",
"title": "加密密钥",
"type": "str",
"length": 100
},
{
"name": "baseurl",
"title": "系统url",
"type": "str",
"length": 500
},
{
"name": "myappid",
"title": "我的appid",
"type": "str",
"length": 100
},
{
"name": "dynamic_func",
"title": "动态headers函数",
"type": "str",
"length": 255
},
{
"name": "auth_apiname",
"title": "认证API名",
"type": "str",
"length": 200,
"nullable": "yes"
}
],
"codes": [
{
"field": "ownerid",
"table": "organization",
"valuefield": "id",
"textfield": "orgname"
}
]
}

90
models/upappkey.json Normal file
View File

@ -0,0 +1,90 @@
{
"summary": [
{
"name": "upappkey",
"title": "上位系统密码表",
"primary": [
"id"
]
}
],
"fields": [
{
"name": "id",
"title": "id",
"type": "str",
"length": 32
},
{
"name": "upappid",
"title": "应用id",
"type": "str",
"length": 32
},
{
"name": "ownerid",
"title": "属主id",
"type": "str",
"length": 32,
"default": "0"
},
{
"name": "apikey",
"title": "api密钥",
"type": "str",
"length": 4000,
"default": "0"
},
{
"name": "apiuser",
"title": "api用户",
"type": "str",
"length": 100
},
{
"name": "apipasswd",
"title": "api密码",
"type": "str",
"length": 100
},
{
"name": "orgid",
"title": "属主机构id",
"type": "str",
"length": 32
},
{
"name": "is_first",
"title": "是否第一用户",
"type": "str",
"length": 1
}
],
"codes": [
{
"field": "ownerid",
"table": "users",
"valuefield": "id",
"textfield": "username"
},
{
"field": "upappid",
"table": "upapp",
"valuefield": "id",
"textfield": "name"
},
{
"field": "orgid",
"table": "organization",
"valuefield": "id",
"textfield": "orgname"
},
{
"field": "is_first",
"table": "appcodes_kv",
"valuefield": "k",
"textfield": "v",
"cond": "parentid='yesno'"
}
]
}

74
models/uptask.json Normal file
View File

@ -0,0 +1,74 @@
{
"summary": [
{
"name": "uptask",
"title": "上游任务",
"primary": [
"id"
],
"catelog": "entity"
}
],
"fields": [
{
"name": "id",
"title": "id",
"type": "str",
"length": 32
},
{
"name": "userid",
"title": "用户id",
"type": "str",
"length": 32
},
{
"name": "executor_taskid",
"title": "执行方任务id",
"type": "str",
"length": 64
},
{
"name": "convert_func_name",
"title": "响应转换函数名",
"type": "str",
"length": 128
},
{
"name": "local_bizid",
"title": "本地业务id",
"type": "str",
"length": 32
},
{
"name": "status",
"title": "状态",
"type": "str",
"length": 24
},
{
"name": "response_data",
"title": "相应数据",
"type": "text"
},
{
"name": "start_timestamp",
"title": "开始时间",
"type": "time"
},
{
"name": "end_timestamp",
"title": "结束时间",
"type": "time"
}
],
"indexes": [
{
"name": "idx1",
"idxtype": "unique",
"idxfields": [
"executor_taskid"
]
}
]
}

View File

@ -27,7 +27,7 @@ async def sor_get_uapi(sor, upappid, apiname):
sql = """select a.*,
b.auth_apiname
from uapi a, upapp b
where a.apisetid = b.apisetid
where a.upappid = b.id
and a.name = ${apiname}$
and b.id = ${upappid}$"""
recs = await sor.sqlExe(sql, {'upappid': upappid, 'apiname': apiname})

View File

@ -20,7 +20,7 @@ async def get_callerid(orgid):
async def sor_get_uapi_by_appname_apiname(sor, appname, apiname):
sql = """select a.* from uapi a, upapp b
where a.apisetid = b.apisetid
where a.upappid = b.id
and b.name = ${appname}$
and a.name = ${apiname}$"""
recs = await sor.sqlExe(sql, {'apiname': apiname, 'appname': appname})
@ -92,7 +92,7 @@ async def sor_get_uapi(sor, upappid, apiname):
sql = """select a.*,
b.auth_apiname
from uapi a, upapp b
where a.apisetid = b.apisetid
where a.upappid = b.id
and a.name = ${apiname}$
and b.id = ${upappid}$"""
recs = await sor.sqlExe(sql, {'upappid': upappid, 'apiname': apiname})