chore: gitignore xls2ui CRUD 产物(pipeline_capacity/pipeline_pricing/pipeline_usage_log) + build/egg-info,停止跟踪构建产物
This commit is contained in:
parent
3367da879f
commit
2719391feb
@ -1,51 +0,0 @@
|
||||
|
||||
ns = params_kw.copy()
|
||||
for k,v in ns.items():
|
||||
if v == 'NaN' or v == 'null':
|
||||
ns[k] = None
|
||||
id = params_kw.id
|
||||
if not id or len(id) > 32:
|
||||
id = uuid()
|
||||
ns['id'] = id
|
||||
|
||||
|
||||
|
||||
userorgid = await get_userorgid()
|
||||
if not userorgid:
|
||||
return {
|
||||
"widgettype":"Error",
|
||||
"options":{
|
||||
"title":"Authorization Error",
|
||||
"timeout":3,
|
||||
"cwidth":16,
|
||||
"cheight":9,
|
||||
"message":"Please login"
|
||||
}
|
||||
}
|
||||
ns['org_id'] = userorgid
|
||||
|
||||
db = DBPools()
|
||||
dbname = get_module_dbname('pipeline_ops')
|
||||
async with db.sqlorContext(dbname) as sor:
|
||||
r = await sor.C('pipeline_capacity', ns.copy())
|
||||
return {
|
||||
"widgettype":"Message",
|
||||
"options":{
|
||||
"cwidth":16,
|
||||
"cheight":9,
|
||||
"title":"Add Success",
|
||||
"timeout":3,
|
||||
"message":"ok"
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
"widgettype":"Error",
|
||||
"options":{
|
||||
"title":"Add Error",
|
||||
"cwidth":16,
|
||||
"cheight":9,
|
||||
"timeout":3,
|
||||
"message":"failed"
|
||||
}
|
||||
}
|
||||
@ -1,47 +0,0 @@
|
||||
|
||||
ns = {
|
||||
'id':params_kw['id'],
|
||||
}
|
||||
|
||||
|
||||
userorgid = await get_userorgid()
|
||||
if not userorgid:
|
||||
return {
|
||||
"widgettype":"Error",
|
||||
"options":{
|
||||
"title":"Authorization Error",
|
||||
"timeout":3,
|
||||
"cwidth":16,
|
||||
"cheight":9,
|
||||
"message":"Please login"
|
||||
}
|
||||
}
|
||||
ns['org_id'] = userorgid
|
||||
|
||||
db = DBPools()
|
||||
dbname = get_module_dbname('pipeline_ops')
|
||||
async with db.sqlorContext(dbname) as sor:
|
||||
r = await sor.D('pipeline_capacity', ns)
|
||||
debug('delete success');
|
||||
return {
|
||||
"widgettype":"Message",
|
||||
"options":{
|
||||
"title":"Delete Success",
|
||||
"timeout":3,
|
||||
"cwidth":16,
|
||||
"cheight":9,
|
||||
"message":"ok"
|
||||
}
|
||||
}
|
||||
|
||||
debug('Delete failed');
|
||||
return {
|
||||
"widgettype":"Error",
|
||||
"options":{
|
||||
"title":"Delete Error",
|
||||
"timeout":3,
|
||||
"cwidth":16,
|
||||
"cheight":9,
|
||||
"message":"failed"
|
||||
}
|
||||
}
|
||||
@ -1,142 +0,0 @@
|
||||
|
||||
ns = params_kw.copy()
|
||||
|
||||
|
||||
userorgid = await get_userorgid()
|
||||
if not userorgid:
|
||||
return {
|
||||
"widgettype":"Error",
|
||||
"options":{
|
||||
"title":"Authorization Error",
|
||||
"timeout":3,
|
||||
"cwidth":16,
|
||||
"cheight":9,
|
||||
"message":"Please login"
|
||||
}
|
||||
}
|
||||
ns['org_id'] = userorgid
|
||||
ns['userorgid'] = userorgid
|
||||
|
||||
debug(f'get_pipeline_capacity.dspy:{ns=}')
|
||||
if not ns.get('page'):
|
||||
ns['page'] = 1
|
||||
if not ns.get('sort'):
|
||||
|
||||
|
||||
ns['sort'] = ["pipeline_id"]
|
||||
|
||||
|
||||
|
||||
sql = '''select a.*, b.pipeline_id_text, c.status_text
|
||||
from (select * from pipeline_capacity where 1=1 [[filterstr]]) a left join (select id as pipeline_id,
|
||||
name as pipeline_id_text from pipelines where 1 = 1) b on a.pipeline_id = b.pipeline_id left join (select k as status,
|
||||
v as status_text from appcodes_kv where parentid='capacity_status') c on a.status = c.status'''
|
||||
|
||||
filterjson = params_kw.get('data_filter')
|
||||
if filterjson and isinstance(filterjson, str):
|
||||
try:
|
||||
filterjson = json.loads(filterjson)
|
||||
except (json.JSONDecodeError, TypeError):
|
||||
filterjson = None
|
||||
fields_str=r'''[
|
||||
{
|
||||
"name": "id",
|
||||
"title": "主键",
|
||||
"type": "str",
|
||||
"length": 32,
|
||||
"nullable": "no"
|
||||
},
|
||||
{
|
||||
"name": "pipeline_id",
|
||||
"title": "产线ID",
|
||||
"type": "str",
|
||||
"length": 32,
|
||||
"nullable": "no"
|
||||
},
|
||||
{
|
||||
"name": "max_concurrent",
|
||||
"title": "最大并发数",
|
||||
"type": "int"
|
||||
},
|
||||
{
|
||||
"name": "daily_limit",
|
||||
"title": "每日限额",
|
||||
"type": "int"
|
||||
},
|
||||
{
|
||||
"name": "monthly_limit",
|
||||
"title": "每月限额",
|
||||
"type": "int"
|
||||
},
|
||||
{
|
||||
"name": "today_usage",
|
||||
"title": "今日用量",
|
||||
"type": "int"
|
||||
},
|
||||
{
|
||||
"name": "month_usage",
|
||||
"title": "本月用量",
|
||||
"type": "int"
|
||||
},
|
||||
{
|
||||
"name": "status",
|
||||
"title": "状态",
|
||||
"type": "str",
|
||||
"length": 20,
|
||||
"default": "active"
|
||||
},
|
||||
{
|
||||
"name": "org_id",
|
||||
"title": "所属组织",
|
||||
"type": "str",
|
||||
"length": 32,
|
||||
"default": "0"
|
||||
},
|
||||
{
|
||||
"name": "updated_at",
|
||||
"title": "更新时间",
|
||||
"type": "timestamp"
|
||||
}
|
||||
]'''
|
||||
ori_fields = json.loads(fields_str)
|
||||
if not filterjson:
|
||||
fields = [ f['name'] for f in ori_fields ]
|
||||
filterjson = default_filterjson(fields, ns)
|
||||
|
||||
# 确保 logined 过滤条件始终生效
|
||||
if filterjson:
|
||||
if not isinstance(filterjson, dict) or 'AND' not in filterjson:
|
||||
filterjson = {'AND': [filterjson] if filterjson else []}
|
||||
|
||||
filterjson['AND'].append({'field': 'org_id', 'op': '=', 'var': '__logined_orgid__'})
|
||||
ns['__logined_orgid__'] = userorgid
|
||||
|
||||
|
||||
|
||||
filterdic = ns.copy()
|
||||
filterdic['filterstr'] = ''
|
||||
filterdic['userorgid'] = '${userorgid}$'
|
||||
filterdic['userid'] = '${userid}$'
|
||||
if filterjson:
|
||||
dbf = DBFilter(filterjson)
|
||||
conds = dbf.gen(ns)
|
||||
if conds:
|
||||
ns.update(dbf.consts)
|
||||
conds = f' and {conds}'
|
||||
filterdic['filterstr'] = conds
|
||||
ac = ArgsConvert('[[', ']]')
|
||||
vars = ac.findAllVariables(sql)
|
||||
NameSpace = {v:'${' + v + '}$' for v in vars if v != 'filterstr' }
|
||||
filterdic.update(NameSpace)
|
||||
sql = ac.convert(sql, filterdic)
|
||||
|
||||
debug(f'{sql=}')
|
||||
db = DBPools()
|
||||
dbname = get_module_dbname('pipeline_ops')
|
||||
async with db.sqlorContext(dbname) as sor:
|
||||
r = await sor.sqlPaging(sql, ns)
|
||||
return r
|
||||
return {
|
||||
"total":0,
|
||||
"rows":[]
|
||||
}
|
||||
@ -1,227 +0,0 @@
|
||||
|
||||
{
|
||||
"widgettype":"VBox",
|
||||
"options":{"cheight":40,"width":"100%"},
|
||||
"subwidgets":[{
|
||||
"id":"pipeline_capacity_tbl",
|
||||
"widgettype":"Tabular",
|
||||
"options":{
|
||||
"width":"100%",
|
||||
"height":"100%",
|
||||
|
||||
|
||||
"title":"产线容量表",
|
||||
|
||||
|
||||
|
||||
|
||||
"css":"card",
|
||||
|
||||
|
||||
"editable":{
|
||||
|
||||
"new_data_url":"{{entire_url('add_pipeline_capacity.dspy')}}",
|
||||
|
||||
|
||||
"delete_data_url":"{{entire_url('delete_pipeline_capacity.dspy')}}",
|
||||
|
||||
|
||||
"update_data_url":"{{entire_url('update_pipeline_capacity.dspy')}}"
|
||||
|
||||
},
|
||||
|
||||
|
||||
"data_url":"{{entire_url('./get_pipeline_capacity.dspy')}}",
|
||||
|
||||
"data_method":"GET",
|
||||
"data_params":{{json.dumps(params_kw, indent=4, ensure_ascii=False)}},
|
||||
"row_options":{
|
||||
|
||||
|
||||
|
||||
"browserfields": {
|
||||
"exclouded": [
|
||||
"id"
|
||||
],
|
||||
"alters": {
|
||||
"pipeline_id": {
|
||||
"uitype": "code",
|
||||
"dataurl": "{{entire_url('../api/get_search_pipeline_id.dspy')}}"
|
||||
},
|
||||
"status": {
|
||||
"uitype": "code",
|
||||
"data": [
|
||||
{
|
||||
"value": "active",
|
||||
"text": "生效中"
|
||||
},
|
||||
{
|
||||
"value": "disabled",
|
||||
"text": "已停用"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
"fields":[
|
||||
{
|
||||
"name": "id",
|
||||
"title": "主键",
|
||||
"type": "str",
|
||||
"length": 32,
|
||||
"nullable": "no",
|
||||
"cwidth": 18,
|
||||
"uitype": "str",
|
||||
"datatype": "str",
|
||||
"label": "主键"
|
||||
},
|
||||
{
|
||||
"name": "pipeline_id",
|
||||
"title": "产线ID",
|
||||
"type": "str",
|
||||
"length": 32,
|
||||
"nullable": "no",
|
||||
"label": "产线ID",
|
||||
"uitype": "code",
|
||||
"valueField": "pipeline_id",
|
||||
"textField": "pipeline_id_text",
|
||||
"params": {
|
||||
"dbname": "{{'sage'}}",
|
||||
"table": "pipelines",
|
||||
"tblvalue": "id",
|
||||
"tbltext": "name",
|
||||
"valueField": "pipeline_id",
|
||||
"textField": "pipeline_id_text"
|
||||
},
|
||||
"dataurl": "{{entire_url('../api/get_search_pipeline_id.dspy')}}"
|
||||
},
|
||||
{
|
||||
"name": "max_concurrent",
|
||||
"title": "最大并发数",
|
||||
"type": "int",
|
||||
"length": 0,
|
||||
"uitype": "int",
|
||||
"datatype": "int",
|
||||
"label": "最大并发数"
|
||||
},
|
||||
{
|
||||
"name": "daily_limit",
|
||||
"title": "每日限额",
|
||||
"type": "int",
|
||||
"length": 0,
|
||||
"uitype": "int",
|
||||
"datatype": "int",
|
||||
"label": "每日限额"
|
||||
},
|
||||
{
|
||||
"name": "monthly_limit",
|
||||
"title": "每月限额",
|
||||
"type": "int",
|
||||
"length": 0,
|
||||
"uitype": "int",
|
||||
"datatype": "int",
|
||||
"label": "每月限额"
|
||||
},
|
||||
{
|
||||
"name": "today_usage",
|
||||
"title": "今日用量",
|
||||
"type": "int",
|
||||
"length": 0,
|
||||
"uitype": "int",
|
||||
"datatype": "int",
|
||||
"label": "今日用量"
|
||||
},
|
||||
{
|
||||
"name": "month_usage",
|
||||
"title": "本月用量",
|
||||
"type": "int",
|
||||
"length": 0,
|
||||
"uitype": "int",
|
||||
"datatype": "int",
|
||||
"label": "本月用量"
|
||||
},
|
||||
{
|
||||
"name": "status",
|
||||
"title": "状态",
|
||||
"type": "str",
|
||||
"length": 20,
|
||||
"default": "active",
|
||||
"label": "状态",
|
||||
"uitype": "code",
|
||||
"valueField": "status",
|
||||
"textField": "status_text",
|
||||
"params": {
|
||||
"dbname": "{{'sage'}}",
|
||||
"table": "appcodes_kv",
|
||||
"tblvalue": "k",
|
||||
"tbltext": "v",
|
||||
"valueField": "status",
|
||||
"textField": "status_text",
|
||||
"cond": "parentid='capacity_status'"
|
||||
},
|
||||
"dataurl": "{{entire_url('/appbase/get_code.dspy')}}",
|
||||
"data": [
|
||||
{
|
||||
"value": "active",
|
||||
"text": "生效中"
|
||||
},
|
||||
{
|
||||
"value": "disabled",
|
||||
"text": "已停用"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "org_id",
|
||||
"title": "所属组织",
|
||||
"type": "str",
|
||||
"length": 32,
|
||||
"default": "0",
|
||||
"cwidth": 18,
|
||||
"uitype": "str",
|
||||
"datatype": "str",
|
||||
"label": "所属组织"
|
||||
},
|
||||
{
|
||||
"name": "updated_at",
|
||||
"title": "更新时间",
|
||||
"type": "timestamp",
|
||||
"length": 0,
|
||||
"uitype": "str",
|
||||
"datatype": "timestamp",
|
||||
"label": "更新时间"
|
||||
}
|
||||
]
|
||||
},
|
||||
|
||||
|
||||
|
||||
"data_filter":{
|
||||
"AND": [
|
||||
{
|
||||
"field": "pipeline_id",
|
||||
"op": "=",
|
||||
"var": "filter_pipeline_id"
|
||||
},
|
||||
{
|
||||
"field": "status",
|
||||
"op": "=",
|
||||
"var": "filter_status"
|
||||
}
|
||||
]
|
||||
},
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
"page_rows":160,
|
||||
"cache_limit":5
|
||||
}
|
||||
|
||||
,"binds":[]
|
||||
|
||||
}]
|
||||
}
|
||||
@ -1,70 +0,0 @@
|
||||
|
||||
ns = params_kw.copy()
|
||||
for k,v in ns.items():
|
||||
if v == 'NaN' or v == 'null':
|
||||
ns[k] = None
|
||||
|
||||
|
||||
userorgid = await get_userorgid()
|
||||
if not userorgid:
|
||||
return {
|
||||
"widgettype":"Error",
|
||||
"options":{
|
||||
"title":"Authorization Error",
|
||||
"timeout":3,
|
||||
"cwidth":16,
|
||||
"cheight":9,
|
||||
"message":"Please login"
|
||||
}
|
||||
}
|
||||
ns['org_id'] = userorgid
|
||||
|
||||
|
||||
|
||||
db = DBPools()
|
||||
dbname = get_module_dbname('pipeline_ops')
|
||||
async with db.sqlorContext(dbname) as sor:
|
||||
|
||||
ns1 = {
|
||||
|
||||
"org_id": userorgid,
|
||||
|
||||
|
||||
"id": params_kw.id
|
||||
}
|
||||
recs = await sor.R('pipeline_capacity', ns1)
|
||||
if len(recs) < 1:
|
||||
return {
|
||||
"widgettype":"Error",
|
||||
"options":{
|
||||
"title":"Update Error",
|
||||
"cwidth":16,
|
||||
"cheight":9,
|
||||
"timeout":3,
|
||||
"message":"Record no exist or with wrong ownership"
|
||||
}
|
||||
}
|
||||
|
||||
r = await sor.U('pipeline_capacity', ns)
|
||||
debug('update success');
|
||||
return {
|
||||
"widgettype":"Message",
|
||||
"options":{
|
||||
"title":"Update Success",
|
||||
"cwidth":16,
|
||||
"cheight":9,
|
||||
"timeout":3,
|
||||
"message":"ok"
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
"widgettype":"Error",
|
||||
"options":{
|
||||
"title":"Update Error",
|
||||
"cwidth":16,
|
||||
"cheight":9,
|
||||
"timeout":3,
|
||||
"message":"failed"
|
||||
}
|
||||
}
|
||||
@ -1,51 +0,0 @@
|
||||
|
||||
ns = params_kw.copy()
|
||||
for k,v in ns.items():
|
||||
if v == 'NaN' or v == 'null':
|
||||
ns[k] = None
|
||||
id = params_kw.id
|
||||
if not id or len(id) > 32:
|
||||
id = uuid()
|
||||
ns['id'] = id
|
||||
|
||||
|
||||
|
||||
userorgid = await get_userorgid()
|
||||
if not userorgid:
|
||||
return {
|
||||
"widgettype":"Error",
|
||||
"options":{
|
||||
"title":"Authorization Error",
|
||||
"timeout":3,
|
||||
"cwidth":16,
|
||||
"cheight":9,
|
||||
"message":"Please login"
|
||||
}
|
||||
}
|
||||
ns['org_id'] = userorgid
|
||||
|
||||
db = DBPools()
|
||||
dbname = get_module_dbname('pipeline_ops')
|
||||
async with db.sqlorContext(dbname) as sor:
|
||||
r = await sor.C('pipeline_pricing', ns.copy())
|
||||
return {
|
||||
"widgettype":"Message",
|
||||
"options":{
|
||||
"cwidth":16,
|
||||
"cheight":9,
|
||||
"title":"Add Success",
|
||||
"timeout":3,
|
||||
"message":"ok"
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
"widgettype":"Error",
|
||||
"options":{
|
||||
"title":"Add Error",
|
||||
"cwidth":16,
|
||||
"cheight":9,
|
||||
"timeout":3,
|
||||
"message":"failed"
|
||||
}
|
||||
}
|
||||
@ -1,47 +0,0 @@
|
||||
|
||||
ns = {
|
||||
'id':params_kw['id'],
|
||||
}
|
||||
|
||||
|
||||
userorgid = await get_userorgid()
|
||||
if not userorgid:
|
||||
return {
|
||||
"widgettype":"Error",
|
||||
"options":{
|
||||
"title":"Authorization Error",
|
||||
"timeout":3,
|
||||
"cwidth":16,
|
||||
"cheight":9,
|
||||
"message":"Please login"
|
||||
}
|
||||
}
|
||||
ns['org_id'] = userorgid
|
||||
|
||||
db = DBPools()
|
||||
dbname = get_module_dbname('pipeline_ops')
|
||||
async with db.sqlorContext(dbname) as sor:
|
||||
r = await sor.D('pipeline_pricing', ns)
|
||||
debug('delete success');
|
||||
return {
|
||||
"widgettype":"Message",
|
||||
"options":{
|
||||
"title":"Delete Success",
|
||||
"timeout":3,
|
||||
"cwidth":16,
|
||||
"cheight":9,
|
||||
"message":"ok"
|
||||
}
|
||||
}
|
||||
|
||||
debug('Delete failed');
|
||||
return {
|
||||
"widgettype":"Error",
|
||||
"options":{
|
||||
"title":"Delete Error",
|
||||
"timeout":3,
|
||||
"cwidth":16,
|
||||
"cheight":9,
|
||||
"message":"failed"
|
||||
}
|
||||
}
|
||||
@ -1,168 +0,0 @@
|
||||
|
||||
ns = params_kw.copy()
|
||||
|
||||
|
||||
userorgid = await get_userorgid()
|
||||
if not userorgid:
|
||||
return {
|
||||
"widgettype":"Error",
|
||||
"options":{
|
||||
"title":"Authorization Error",
|
||||
"timeout":3,
|
||||
"cwidth":16,
|
||||
"cheight":9,
|
||||
"message":"Please login"
|
||||
}
|
||||
}
|
||||
ns['org_id'] = userorgid
|
||||
ns['userorgid'] = userorgid
|
||||
|
||||
debug(f'get_pipeline_pricing.dspy:{ns=}')
|
||||
if not ns.get('page'):
|
||||
ns['page'] = 1
|
||||
if not ns.get('sort'):
|
||||
|
||||
|
||||
ns['sort'] = ["effective_date desc"]
|
||||
|
||||
|
||||
|
||||
sql = '''select a.*, b.pipeline_id_text, c.pricing_type_text, d.currency_text, e.status_text
|
||||
from (select * from pipeline_pricing where 1=1 [[filterstr]]) a left join (select id as pipeline_id,
|
||||
name as pipeline_id_text from pipelines where 1 = 1) b on a.pipeline_id = b.pipeline_id left join (select k as pricing_type,
|
||||
v as pricing_type_text from appcodes_kv where parentid='pricing_type') c on a.pricing_type = c.pricing_type left join (select k as currency,
|
||||
v as currency_text from appcodes_kv where parentid='currency') d on a.currency = d.currency left join (select k as status,
|
||||
v as status_text from appcodes_kv where parentid='pricing_status') e on a.status = e.status'''
|
||||
|
||||
filterjson = params_kw.get('data_filter')
|
||||
if filterjson and isinstance(filterjson, str):
|
||||
try:
|
||||
filterjson = json.loads(filterjson)
|
||||
except (json.JSONDecodeError, TypeError):
|
||||
filterjson = None
|
||||
fields_str=r'''[
|
||||
{
|
||||
"name": "id",
|
||||
"title": "主键",
|
||||
"type": "str",
|
||||
"length": 32,
|
||||
"nullable": "no"
|
||||
},
|
||||
{
|
||||
"name": "pipeline_id",
|
||||
"title": "产线ID",
|
||||
"type": "str",
|
||||
"length": 32,
|
||||
"nullable": "no"
|
||||
},
|
||||
{
|
||||
"name": "pricing_type",
|
||||
"title": "计费方式",
|
||||
"type": "str",
|
||||
"length": 20,
|
||||
"nullable": "no"
|
||||
},
|
||||
{
|
||||
"name": "unit_price",
|
||||
"title": "单价",
|
||||
"type": "double",
|
||||
"length": 15,
|
||||
"dec": 4,
|
||||
"nullable": "no",
|
||||
"default": "0"
|
||||
},
|
||||
{
|
||||
"name": "currency",
|
||||
"title": "货币",
|
||||
"type": "str",
|
||||
"length": 10,
|
||||
"default": "CNY"
|
||||
},
|
||||
{
|
||||
"name": "pricing_config",
|
||||
"title": "定价配置JSON",
|
||||
"type": "text"
|
||||
},
|
||||
{
|
||||
"name": "effective_date",
|
||||
"title": "生效日期",
|
||||
"type": "date"
|
||||
},
|
||||
{
|
||||
"name": "expiry_date",
|
||||
"title": "失效日期",
|
||||
"type": "date"
|
||||
},
|
||||
{
|
||||
"name": "status",
|
||||
"title": "状态",
|
||||
"type": "str",
|
||||
"length": 20,
|
||||
"default": "active"
|
||||
},
|
||||
{
|
||||
"name": "org_id",
|
||||
"title": "所属组织",
|
||||
"type": "str",
|
||||
"length": 32,
|
||||
"default": "0"
|
||||
},
|
||||
{
|
||||
"name": "created_by",
|
||||
"title": "创建人",
|
||||
"type": "str",
|
||||
"length": 32
|
||||
},
|
||||
{
|
||||
"name": "created_at",
|
||||
"title": "创建时间",
|
||||
"type": "timestamp"
|
||||
},
|
||||
{
|
||||
"name": "updated_at",
|
||||
"title": "更新时间",
|
||||
"type": "timestamp"
|
||||
}
|
||||
]'''
|
||||
ori_fields = json.loads(fields_str)
|
||||
if not filterjson:
|
||||
fields = [ f['name'] for f in ori_fields ]
|
||||
filterjson = default_filterjson(fields, ns)
|
||||
|
||||
# 确保 logined 过滤条件始终生效
|
||||
if filterjson:
|
||||
if not isinstance(filterjson, dict) or 'AND' not in filterjson:
|
||||
filterjson = {'AND': [filterjson] if filterjson else []}
|
||||
|
||||
filterjson['AND'].append({'field': 'org_id', 'op': '=', 'var': '__logined_orgid__'})
|
||||
ns['__logined_orgid__'] = userorgid
|
||||
|
||||
|
||||
|
||||
filterdic = ns.copy()
|
||||
filterdic['filterstr'] = ''
|
||||
filterdic['userorgid'] = '${userorgid}$'
|
||||
filterdic['userid'] = '${userid}$'
|
||||
if filterjson:
|
||||
dbf = DBFilter(filterjson)
|
||||
conds = dbf.gen(ns)
|
||||
if conds:
|
||||
ns.update(dbf.consts)
|
||||
conds = f' and {conds}'
|
||||
filterdic['filterstr'] = conds
|
||||
ac = ArgsConvert('[[', ']]')
|
||||
vars = ac.findAllVariables(sql)
|
||||
NameSpace = {v:'${' + v + '}$' for v in vars if v != 'filterstr' }
|
||||
filterdic.update(NameSpace)
|
||||
sql = ac.convert(sql, filterdic)
|
||||
|
||||
debug(f'{sql=}')
|
||||
db = DBPools()
|
||||
dbname = get_module_dbname('pipeline_ops')
|
||||
async with db.sqlorContext(dbname) as sor:
|
||||
r = await sor.sqlPaging(sql, ns)
|
||||
return r
|
||||
return {
|
||||
"total":0,
|
||||
"rows":[]
|
||||
}
|
||||
@ -1,322 +0,0 @@
|
||||
|
||||
{
|
||||
"widgettype":"VBox",
|
||||
"options":{"cheight":40,"width":"100%"},
|
||||
"subwidgets":[{
|
||||
"id":"pipeline_pricing_tbl",
|
||||
"widgettype":"Tabular",
|
||||
"options":{
|
||||
"width":"100%",
|
||||
"height":"100%",
|
||||
|
||||
|
||||
"title":"产线定价表",
|
||||
|
||||
|
||||
|
||||
|
||||
"css":"card",
|
||||
|
||||
|
||||
"editable":{
|
||||
|
||||
"new_data_url":"{{entire_url('add_pipeline_pricing.dspy')}}",
|
||||
|
||||
|
||||
"delete_data_url":"{{entire_url('delete_pipeline_pricing.dspy')}}",
|
||||
|
||||
|
||||
"update_data_url":"{{entire_url('update_pipeline_pricing.dspy')}}"
|
||||
|
||||
},
|
||||
|
||||
|
||||
"data_url":"{{entire_url('./get_pipeline_pricing.dspy')}}",
|
||||
|
||||
"data_method":"GET",
|
||||
"data_params":{{json.dumps(params_kw, indent=4, ensure_ascii=False)}},
|
||||
"row_options":{
|
||||
|
||||
|
||||
|
||||
"browserfields": {
|
||||
"exclouded": [
|
||||
"id"
|
||||
],
|
||||
"alters": {
|
||||
"pipeline_id": {
|
||||
"uitype": "code",
|
||||
"dataurl": "{{entire_url('../api/get_search_pipeline_id.dspy')}}"
|
||||
},
|
||||
"pricing_type": {
|
||||
"uitype": "code",
|
||||
"data": [
|
||||
{
|
||||
"value": "per_call",
|
||||
"text": "按次计费"
|
||||
},
|
||||
{
|
||||
"value": "per_token",
|
||||
"text": "按token计费"
|
||||
},
|
||||
{
|
||||
"value": "subscription",
|
||||
"text": "订阅制"
|
||||
}
|
||||
]
|
||||
},
|
||||
"status": {
|
||||
"uitype": "code",
|
||||
"data": [
|
||||
{
|
||||
"value": "active",
|
||||
"text": "生效中"
|
||||
},
|
||||
{
|
||||
"value": "expired",
|
||||
"text": "已过期"
|
||||
},
|
||||
{
|
||||
"value": "disabled",
|
||||
"text": "已停用"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
"fields":[
|
||||
{
|
||||
"name": "id",
|
||||
"title": "主键",
|
||||
"type": "str",
|
||||
"length": 32,
|
||||
"nullable": "no",
|
||||
"cwidth": 18,
|
||||
"uitype": "str",
|
||||
"datatype": "str",
|
||||
"label": "主键"
|
||||
},
|
||||
{
|
||||
"name": "pipeline_id",
|
||||
"title": "产线ID",
|
||||
"type": "str",
|
||||
"length": 32,
|
||||
"nullable": "no",
|
||||
"label": "产线ID",
|
||||
"uitype": "code",
|
||||
"valueField": "pipeline_id",
|
||||
"textField": "pipeline_id_text",
|
||||
"params": {
|
||||
"dbname": "{{'sage'}}",
|
||||
"table": "pipelines",
|
||||
"tblvalue": "id",
|
||||
"tbltext": "name",
|
||||
"valueField": "pipeline_id",
|
||||
"textField": "pipeline_id_text"
|
||||
},
|
||||
"dataurl": "{{entire_url('../api/get_search_pipeline_id.dspy')}}"
|
||||
},
|
||||
{
|
||||
"name": "pricing_type",
|
||||
"title": "计费方式",
|
||||
"type": "str",
|
||||
"length": 20,
|
||||
"nullable": "no",
|
||||
"label": "计费方式",
|
||||
"uitype": "code",
|
||||
"valueField": "pricing_type",
|
||||
"textField": "pricing_type_text",
|
||||
"params": {
|
||||
"dbname": "{{'sage'}}",
|
||||
"table": "appcodes_kv",
|
||||
"tblvalue": "k",
|
||||
"tbltext": "v",
|
||||
"valueField": "pricing_type",
|
||||
"textField": "pricing_type_text",
|
||||
"cond": "parentid='pricing_type'"
|
||||
},
|
||||
"dataurl": "{{entire_url('/appbase/get_code.dspy')}}",
|
||||
"data": [
|
||||
{
|
||||
"value": "per_call",
|
||||
"text": "按次计费"
|
||||
},
|
||||
{
|
||||
"value": "per_token",
|
||||
"text": "按token计费"
|
||||
},
|
||||
{
|
||||
"value": "subscription",
|
||||
"text": "订阅制"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "unit_price",
|
||||
"title": "单价",
|
||||
"type": "double",
|
||||
"length": 15,
|
||||
"dec": 4,
|
||||
"nullable": "no",
|
||||
"default": "0",
|
||||
"cwidth": 15,
|
||||
"uitype": "float",
|
||||
"datatype": "double",
|
||||
"label": "单价"
|
||||
},
|
||||
{
|
||||
"name": "currency",
|
||||
"title": "货币",
|
||||
"type": "str",
|
||||
"length": 10,
|
||||
"default": "CNY",
|
||||
"label": "货币",
|
||||
"uitype": "code",
|
||||
"valueField": "currency",
|
||||
"textField": "currency_text",
|
||||
"params": {
|
||||
"dbname": "{{'sage'}}",
|
||||
"table": "appcodes_kv",
|
||||
"tblvalue": "k",
|
||||
"tbltext": "v",
|
||||
"valueField": "currency",
|
||||
"textField": "currency_text",
|
||||
"cond": "parentid='currency'"
|
||||
},
|
||||
"dataurl": "{{entire_url('/appbase/get_code.dspy')}}"
|
||||
},
|
||||
{
|
||||
"name": "pricing_config",
|
||||
"title": "定价配置JSON",
|
||||
"type": "text",
|
||||
"length": 0,
|
||||
"uitype": "text",
|
||||
"datatype": "text",
|
||||
"label": "定价配置JSON"
|
||||
},
|
||||
{
|
||||
"name": "effective_date",
|
||||
"title": "生效日期",
|
||||
"type": "date",
|
||||
"length": 0,
|
||||
"uitype": "date",
|
||||
"datatype": "date",
|
||||
"label": "生效日期"
|
||||
},
|
||||
{
|
||||
"name": "expiry_date",
|
||||
"title": "失效日期",
|
||||
"type": "date",
|
||||
"length": 0,
|
||||
"uitype": "date",
|
||||
"datatype": "date",
|
||||
"label": "失效日期"
|
||||
},
|
||||
{
|
||||
"name": "status",
|
||||
"title": "状态",
|
||||
"type": "str",
|
||||
"length": 20,
|
||||
"default": "active",
|
||||
"label": "状态",
|
||||
"uitype": "code",
|
||||
"valueField": "status",
|
||||
"textField": "status_text",
|
||||
"params": {
|
||||
"dbname": "{{'sage'}}",
|
||||
"table": "appcodes_kv",
|
||||
"tblvalue": "k",
|
||||
"tbltext": "v",
|
||||
"valueField": "status",
|
||||
"textField": "status_text",
|
||||
"cond": "parentid='pricing_status'"
|
||||
},
|
||||
"dataurl": "{{entire_url('/appbase/get_code.dspy')}}",
|
||||
"data": [
|
||||
{
|
||||
"value": "active",
|
||||
"text": "生效中"
|
||||
},
|
||||
{
|
||||
"value": "expired",
|
||||
"text": "已过期"
|
||||
},
|
||||
{
|
||||
"value": "disabled",
|
||||
"text": "已停用"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "org_id",
|
||||
"title": "所属组织",
|
||||
"type": "str",
|
||||
"length": 32,
|
||||
"default": "0",
|
||||
"cwidth": 18,
|
||||
"uitype": "str",
|
||||
"datatype": "str",
|
||||
"label": "所属组织"
|
||||
},
|
||||
{
|
||||
"name": "created_by",
|
||||
"title": "创建人",
|
||||
"type": "str",
|
||||
"length": 32,
|
||||
"cwidth": 18,
|
||||
"uitype": "str",
|
||||
"datatype": "str",
|
||||
"label": "创建人"
|
||||
},
|
||||
{
|
||||
"name": "created_at",
|
||||
"title": "创建时间",
|
||||
"type": "timestamp",
|
||||
"length": 0,
|
||||
"uitype": "str",
|
||||
"datatype": "timestamp",
|
||||
"label": "创建时间"
|
||||
},
|
||||
{
|
||||
"name": "updated_at",
|
||||
"title": "更新时间",
|
||||
"type": "timestamp",
|
||||
"length": 0,
|
||||
"uitype": "str",
|
||||
"datatype": "timestamp",
|
||||
"label": "更新时间"
|
||||
}
|
||||
]
|
||||
},
|
||||
|
||||
|
||||
|
||||
"data_filter":{
|
||||
"AND": [
|
||||
{
|
||||
"field": "pipeline_id",
|
||||
"op": "=",
|
||||
"var": "filter_pipeline_id"
|
||||
},
|
||||
{
|
||||
"field": "status",
|
||||
"op": "=",
|
||||
"var": "filter_status"
|
||||
}
|
||||
]
|
||||
},
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
"page_rows":160,
|
||||
"cache_limit":5
|
||||
}
|
||||
|
||||
,"binds":[]
|
||||
|
||||
}]
|
||||
}
|
||||
@ -1,70 +0,0 @@
|
||||
|
||||
ns = params_kw.copy()
|
||||
for k,v in ns.items():
|
||||
if v == 'NaN' or v == 'null':
|
||||
ns[k] = None
|
||||
|
||||
|
||||
userorgid = await get_userorgid()
|
||||
if not userorgid:
|
||||
return {
|
||||
"widgettype":"Error",
|
||||
"options":{
|
||||
"title":"Authorization Error",
|
||||
"timeout":3,
|
||||
"cwidth":16,
|
||||
"cheight":9,
|
||||
"message":"Please login"
|
||||
}
|
||||
}
|
||||
ns['org_id'] = userorgid
|
||||
|
||||
|
||||
|
||||
db = DBPools()
|
||||
dbname = get_module_dbname('pipeline_ops')
|
||||
async with db.sqlorContext(dbname) as sor:
|
||||
|
||||
ns1 = {
|
||||
|
||||
"org_id": userorgid,
|
||||
|
||||
|
||||
"id": params_kw.id
|
||||
}
|
||||
recs = await sor.R('pipeline_pricing', ns1)
|
||||
if len(recs) < 1:
|
||||
return {
|
||||
"widgettype":"Error",
|
||||
"options":{
|
||||
"title":"Update Error",
|
||||
"cwidth":16,
|
||||
"cheight":9,
|
||||
"timeout":3,
|
||||
"message":"Record no exist or with wrong ownership"
|
||||
}
|
||||
}
|
||||
|
||||
r = await sor.U('pipeline_pricing', ns)
|
||||
debug('update success');
|
||||
return {
|
||||
"widgettype":"Message",
|
||||
"options":{
|
||||
"title":"Update Success",
|
||||
"cwidth":16,
|
||||
"cheight":9,
|
||||
"timeout":3,
|
||||
"message":"ok"
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
"widgettype":"Error",
|
||||
"options":{
|
||||
"title":"Update Error",
|
||||
"cwidth":16,
|
||||
"cheight":9,
|
||||
"timeout":3,
|
||||
"message":"failed"
|
||||
}
|
||||
}
|
||||
@ -1,37 +0,0 @@
|
||||
|
||||
ns = params_kw.copy()
|
||||
for k,v in ns.items():
|
||||
if v == 'NaN' or v == 'null':
|
||||
ns[k] = None
|
||||
id = params_kw.id
|
||||
if not id or len(id) > 32:
|
||||
id = uuid()
|
||||
ns['id'] = id
|
||||
|
||||
|
||||
|
||||
db = DBPools()
|
||||
dbname = get_module_dbname('pipeline_ops')
|
||||
async with db.sqlorContext(dbname) as sor:
|
||||
r = await sor.C('pipeline_usage_log', ns.copy())
|
||||
return {
|
||||
"widgettype":"Message",
|
||||
"options":{
|
||||
"cwidth":16,
|
||||
"cheight":9,
|
||||
"title":"Add Success",
|
||||
"timeout":3,
|
||||
"message":"ok"
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
"widgettype":"Error",
|
||||
"options":{
|
||||
"title":"Add Error",
|
||||
"cwidth":16,
|
||||
"cheight":9,
|
||||
"timeout":3,
|
||||
"message":"failed"
|
||||
}
|
||||
}
|
||||
@ -1,33 +0,0 @@
|
||||
|
||||
ns = {
|
||||
'id':params_kw['id'],
|
||||
}
|
||||
|
||||
|
||||
db = DBPools()
|
||||
dbname = get_module_dbname('pipeline_ops')
|
||||
async with db.sqlorContext(dbname) as sor:
|
||||
r = await sor.D('pipeline_usage_log', ns)
|
||||
debug('delete success');
|
||||
return {
|
||||
"widgettype":"Message",
|
||||
"options":{
|
||||
"title":"Delete Success",
|
||||
"timeout":3,
|
||||
"cwidth":16,
|
||||
"cheight":9,
|
||||
"message":"ok"
|
||||
}
|
||||
}
|
||||
|
||||
debug('Delete failed');
|
||||
return {
|
||||
"widgettype":"Error",
|
||||
"options":{
|
||||
"title":"Delete Error",
|
||||
"timeout":3,
|
||||
"cwidth":16,
|
||||
"cheight":9,
|
||||
"message":"failed"
|
||||
}
|
||||
}
|
||||
@ -1,127 +0,0 @@
|
||||
|
||||
ns = params_kw.copy()
|
||||
|
||||
|
||||
debug(f'get_pipeline_usage_log.dspy:{ns=}')
|
||||
if not ns.get('page'):
|
||||
ns['page'] = 1
|
||||
if not ns.get('sort'):
|
||||
|
||||
|
||||
ns['sort'] = ["called_at desc"]
|
||||
|
||||
|
||||
|
||||
sql = '''select a.*, b.pipeline_id_text, c.status_text
|
||||
from (select * from pipeline_usage_log where 1=1 [[filterstr]]) a left join (select id as pipeline_id,
|
||||
name as pipeline_id_text from pipelines where 1 = 1) b on a.pipeline_id = b.pipeline_id left join (select k as status,
|
||||
v as status_text from appcodes_kv where parentid='usage_status') c on a.status = c.status'''
|
||||
|
||||
filterjson = params_kw.get('data_filter')
|
||||
if filterjson and isinstance(filterjson, str):
|
||||
try:
|
||||
filterjson = json.loads(filterjson)
|
||||
except (json.JSONDecodeError, TypeError):
|
||||
filterjson = None
|
||||
fields_str=r'''[
|
||||
{
|
||||
"name": "id",
|
||||
"title": "主键",
|
||||
"type": "str",
|
||||
"length": 32,
|
||||
"nullable": "no"
|
||||
},
|
||||
{
|
||||
"name": "pipeline_id",
|
||||
"title": "产线ID",
|
||||
"type": "str",
|
||||
"length": 32,
|
||||
"nullable": "no"
|
||||
},
|
||||
{
|
||||
"name": "user_id",
|
||||
"title": "用户ID",
|
||||
"type": "str",
|
||||
"length": 32
|
||||
},
|
||||
{
|
||||
"name": "distributor_id",
|
||||
"title": "分销商ID",
|
||||
"type": "str",
|
||||
"length": 32
|
||||
},
|
||||
{
|
||||
"name": "call_count",
|
||||
"title": "调用次数",
|
||||
"type": "int",
|
||||
"default": "1"
|
||||
},
|
||||
{
|
||||
"name": "token_input",
|
||||
"title": "输入Token数",
|
||||
"type": "int",
|
||||
"default": "0"
|
||||
},
|
||||
{
|
||||
"name": "token_output",
|
||||
"title": "输出Token数",
|
||||
"type": "int",
|
||||
"default": "0"
|
||||
},
|
||||
{
|
||||
"name": "amount",
|
||||
"title": "金额",
|
||||
"type": "double",
|
||||
"length": 15,
|
||||
"dec": 4,
|
||||
"default": "0"
|
||||
},
|
||||
{
|
||||
"name": "status",
|
||||
"title": "状态",
|
||||
"type": "str",
|
||||
"length": 20
|
||||
},
|
||||
{
|
||||
"name": "error_message",
|
||||
"title": "错误信息",
|
||||
"type": "text"
|
||||
},
|
||||
{
|
||||
"name": "called_at",
|
||||
"title": "调用时间",
|
||||
"type": "timestamp"
|
||||
}
|
||||
]'''
|
||||
ori_fields = json.loads(fields_str)
|
||||
if not filterjson:
|
||||
fields = [ f['name'] for f in ori_fields ]
|
||||
filterjson = default_filterjson(fields, ns)
|
||||
|
||||
filterdic = ns.copy()
|
||||
filterdic['filterstr'] = ''
|
||||
filterdic['userorgid'] = '${userorgid}$'
|
||||
filterdic['userid'] = '${userid}$'
|
||||
if filterjson:
|
||||
dbf = DBFilter(filterjson)
|
||||
conds = dbf.gen(ns)
|
||||
if conds:
|
||||
ns.update(dbf.consts)
|
||||
conds = f' and {conds}'
|
||||
filterdic['filterstr'] = conds
|
||||
ac = ArgsConvert('[[', ']]')
|
||||
vars = ac.findAllVariables(sql)
|
||||
NameSpace = {v:'${' + v + '}$' for v in vars if v != 'filterstr' }
|
||||
filterdic.update(NameSpace)
|
||||
sql = ac.convert(sql, filterdic)
|
||||
|
||||
debug(f'{sql=}')
|
||||
db = DBPools()
|
||||
dbname = get_module_dbname('pipeline_ops')
|
||||
async with db.sqlorContext(dbname) as sor:
|
||||
r = await sor.sqlPaging(sql, ns)
|
||||
return r
|
||||
return {
|
||||
"total":0,
|
||||
"rows":[]
|
||||
}
|
||||
@ -1,265 +0,0 @@
|
||||
|
||||
{
|
||||
"widgettype":"VBox",
|
||||
"options":{"cheight":40,"width":"100%"},
|
||||
"subwidgets":[{
|
||||
"id":"pipeline_usage_log_tbl",
|
||||
"widgettype":"Tabular",
|
||||
"options":{
|
||||
"width":"100%",
|
||||
"height":"100%",
|
||||
|
||||
|
||||
"title":"产线调用日志表",
|
||||
|
||||
|
||||
|
||||
|
||||
"css":"card",
|
||||
|
||||
|
||||
"editable":{
|
||||
|
||||
"new_data_url":"{{entire_url('add_pipeline_usage_log.dspy')}}",
|
||||
|
||||
|
||||
"delete_data_url":"{{entire_url('delete_pipeline_usage_log.dspy')}}",
|
||||
|
||||
|
||||
"update_data_url":"{{entire_url('update_pipeline_usage_log.dspy')}}"
|
||||
|
||||
},
|
||||
|
||||
|
||||
"data_url":"{{entire_url('./get_pipeline_usage_log.dspy')}}",
|
||||
|
||||
"data_method":"GET",
|
||||
"data_params":{{json.dumps(params_kw, indent=4, ensure_ascii=False)}},
|
||||
"row_options":{
|
||||
|
||||
|
||||
|
||||
"browserfields": {
|
||||
"exclouded": [
|
||||
"id"
|
||||
],
|
||||
"alters": {
|
||||
"pipeline_id": {
|
||||
"uitype": "code",
|
||||
"dataurl": "{{entire_url('../api/get_search_pipeline_id.dspy')}}"
|
||||
},
|
||||
"status": {
|
||||
"uitype": "code",
|
||||
"data": [
|
||||
{
|
||||
"value": "success",
|
||||
"text": "成功"
|
||||
},
|
||||
{
|
||||
"value": "failed",
|
||||
"text": "失败"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
"editexclouded":[
|
||||
"id",
|
||||
"pipeline_id",
|
||||
"user_id",
|
||||
"distributor_id",
|
||||
"call_count",
|
||||
"token_input",
|
||||
"token_output",
|
||||
"amount",
|
||||
"status",
|
||||
"error_message",
|
||||
"called_at"
|
||||
],
|
||||
|
||||
"fields":[
|
||||
{
|
||||
"name": "id",
|
||||
"title": "主键",
|
||||
"type": "str",
|
||||
"length": 32,
|
||||
"nullable": "no",
|
||||
"cwidth": 18,
|
||||
"uitype": "str",
|
||||
"datatype": "str",
|
||||
"label": "主键"
|
||||
},
|
||||
{
|
||||
"name": "pipeline_id",
|
||||
"title": "产线ID",
|
||||
"type": "str",
|
||||
"length": 32,
|
||||
"nullable": "no",
|
||||
"label": "产线ID",
|
||||
"uitype": "code",
|
||||
"valueField": "pipeline_id",
|
||||
"textField": "pipeline_id_text",
|
||||
"params": {
|
||||
"dbname": "{{'sage'}}",
|
||||
"table": "pipelines",
|
||||
"tblvalue": "id",
|
||||
"tbltext": "name",
|
||||
"valueField": "pipeline_id",
|
||||
"textField": "pipeline_id_text"
|
||||
},
|
||||
"dataurl": "{{entire_url('../api/get_search_pipeline_id.dspy')}}"
|
||||
},
|
||||
{
|
||||
"name": "user_id",
|
||||
"title": "用户ID",
|
||||
"type": "str",
|
||||
"length": 32,
|
||||
"cwidth": 18,
|
||||
"uitype": "str",
|
||||
"datatype": "str",
|
||||
"label": "用户ID"
|
||||
},
|
||||
{
|
||||
"name": "distributor_id",
|
||||
"title": "分销商ID",
|
||||
"type": "str",
|
||||
"length": 32,
|
||||
"cwidth": 18,
|
||||
"uitype": "str",
|
||||
"datatype": "str",
|
||||
"label": "分销商ID"
|
||||
},
|
||||
{
|
||||
"name": "call_count",
|
||||
"title": "调用次数",
|
||||
"type": "int",
|
||||
"default": "1",
|
||||
"length": 0,
|
||||
"uitype": "int",
|
||||
"datatype": "int",
|
||||
"label": "调用次数"
|
||||
},
|
||||
{
|
||||
"name": "token_input",
|
||||
"title": "输入Token数",
|
||||
"type": "int",
|
||||
"default": "0",
|
||||
"length": 0,
|
||||
"uitype": "int",
|
||||
"datatype": "int",
|
||||
"label": "输入Token数"
|
||||
},
|
||||
{
|
||||
"name": "token_output",
|
||||
"title": "输出Token数",
|
||||
"type": "int",
|
||||
"default": "0",
|
||||
"length": 0,
|
||||
"uitype": "int",
|
||||
"datatype": "int",
|
||||
"label": "输出Token数"
|
||||
},
|
||||
{
|
||||
"name": "amount",
|
||||
"title": "金额",
|
||||
"type": "double",
|
||||
"length": 15,
|
||||
"dec": 4,
|
||||
"default": "0",
|
||||
"cwidth": 15,
|
||||
"uitype": "float",
|
||||
"datatype": "double",
|
||||
"label": "金额"
|
||||
},
|
||||
{
|
||||
"name": "status",
|
||||
"title": "状态",
|
||||
"type": "str",
|
||||
"length": 20,
|
||||
"label": "状态",
|
||||
"uitype": "code",
|
||||
"valueField": "status",
|
||||
"textField": "status_text",
|
||||
"params": {
|
||||
"dbname": "{{'sage'}}",
|
||||
"table": "appcodes_kv",
|
||||
"tblvalue": "k",
|
||||
"tbltext": "v",
|
||||
"valueField": "status",
|
||||
"textField": "status_text",
|
||||
"cond": "parentid='usage_status'"
|
||||
},
|
||||
"dataurl": "{{entire_url('/appbase/get_code.dspy')}}",
|
||||
"data": [
|
||||
{
|
||||
"value": "success",
|
||||
"text": "成功"
|
||||
},
|
||||
{
|
||||
"value": "failed",
|
||||
"text": "失败"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "error_message",
|
||||
"title": "错误信息",
|
||||
"type": "text",
|
||||
"length": 0,
|
||||
"uitype": "text",
|
||||
"datatype": "text",
|
||||
"label": "错误信息"
|
||||
},
|
||||
{
|
||||
"name": "called_at",
|
||||
"title": "调用时间",
|
||||
"type": "timestamp",
|
||||
"length": 0,
|
||||
"uitype": "str",
|
||||
"datatype": "timestamp",
|
||||
"label": "调用时间"
|
||||
}
|
||||
]
|
||||
},
|
||||
|
||||
|
||||
|
||||
"data_filter":{
|
||||
"AND": [
|
||||
{
|
||||
"field": "pipeline_id",
|
||||
"op": "=",
|
||||
"var": "filter_pipeline_id"
|
||||
},
|
||||
{
|
||||
"field": "called_at",
|
||||
"op": ">=",
|
||||
"var": "filter_called_at_start"
|
||||
},
|
||||
{
|
||||
"field": "called_at",
|
||||
"op": "<=",
|
||||
"var": "filter_called_at_end"
|
||||
},
|
||||
{
|
||||
"field": "status",
|
||||
"op": "=",
|
||||
"var": "filter_status"
|
||||
}
|
||||
]
|
||||
},
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
"page_rows":160,
|
||||
"cache_limit":5
|
||||
}
|
||||
|
||||
,"binds":[]
|
||||
|
||||
}]
|
||||
}
|
||||
@ -1,36 +0,0 @@
|
||||
|
||||
ns = params_kw.copy()
|
||||
for k,v in ns.items():
|
||||
if v == 'NaN' or v == 'null':
|
||||
ns[k] = None
|
||||
|
||||
|
||||
|
||||
|
||||
db = DBPools()
|
||||
dbname = get_module_dbname('pipeline_ops')
|
||||
async with db.sqlorContext(dbname) as sor:
|
||||
|
||||
r = await sor.U('pipeline_usage_log', ns)
|
||||
debug('update success');
|
||||
return {
|
||||
"widgettype":"Message",
|
||||
"options":{
|
||||
"title":"Update Success",
|
||||
"cwidth":16,
|
||||
"cheight":9,
|
||||
"timeout":3,
|
||||
"message":"ok"
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
"widgettype":"Error",
|
||||
"options":{
|
||||
"title":"Update Error",
|
||||
"cwidth":16,
|
||||
"cheight":9,
|
||||
"timeout":3,
|
||||
"message":"failed"
|
||||
}
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user