diff --git a/.gitignore b/.gitignore
index 7a44437..5c226d8 100644
--- a/.gitignore
+++ b/.gitignore
@@ -10,3 +10,5 @@ pipeline.pid
pkgs/
bricks
pipeline_core/
+pipeline_dist/
+pipeline_ops/
diff --git a/pipeline_dist/init/data.json b/pipeline_dist/init/data.json
deleted file mode 100644
index 34a4c6a..0000000
--- a/pipeline_dist/init/data.json
+++ /dev/null
@@ -1,29 +0,0 @@
-{
- "appcodes": [
- {
- "parentid": "distributor_status",
- "parentname": "分销商状态",
- "items": [
- {"k": "active", "v": "活跃"},
- {"k": "suspended", "v": "暂停"},
- {"k": "terminated", "v": "终止"}
- ]
- },
- {
- "parentid": "markup_type",
- "parentname": "加价方式",
- "items": [
- {"k": "fixed", "v": "固定加价"},
- {"k": "percentage", "v": "百分比加价"}
- ]
- },
- {
- "parentid": "dp_status",
- "parentname": "分销产线状态",
- "items": [
- {"k": "enabled", "v": "已启用"},
- {"k": "disabled", "v": "已停用"}
- ]
- }
- ]
-}
diff --git a/pipeline_dist/json/distributor_pipeline.json b/pipeline_dist/json/distributor_pipeline.json
deleted file mode 100644
index c0a5a65..0000000
--- a/pipeline_dist/json/distributor_pipeline.json
+++ /dev/null
@@ -1,33 +0,0 @@
-{
- "tblname": "distributor_pipeline",
- "title": "分销商产线配置",
- "params": {
- "sortby": "created_at",
- "browserfields": {
- "exclouded": ["id"],
- "cwidth": {},
- "alters": {
- "distributor_id": {"dataurl": "{{entire_url('../api/get_search_distributor_id.dspy')}}"},
- "pipeline_id": {"dataurl": "{{entire_url('../api/get_search_pipeline_id.dspy')}}"}
- }
- },
- "editexclouded": [
- "id", "created_at", "updated_at"
- ],
- "editable": {
- "new_data_url": "{{entire_url('../api/distributor_pipeline_create.dspy')}}",
- "update_data_url": "{{entire_url('../api/distributor_pipeline_update.dspy')}}",
- "delete_data_url": "{{entire_url('../api/distributor_pipeline_delete.dspy')}}"
- },
- "confidential_fields": [],
- "subtables": [
- {"field": "distributor_id", "title": "分销商", "subtable": "distributors"},
- {"field": "pipeline_id", "title": "产线", "subtable": "pipelines"}
- ],
- "data_filter": {
- "distributor_id": "",
- "pipeline_id": "",
- "status": ""
- }
- }
-}
diff --git a/pipeline_dist/json/distributors.json b/pipeline_dist/json/distributors.json
deleted file mode 100644
index 5162c31..0000000
--- a/pipeline_dist/json/distributors.json
+++ /dev/null
@@ -1,24 +0,0 @@
-{
- "tblname": "distributors",
- "title": "分销商管理",
- "params": {
- "sortby": "created_at",
- "browserfields": {
- "exclouded": ["id", "api_key", "remarks"],
- "cwidth": {}
- },
- "editexclouded": [
- "id", "created_at", "updated_at"
- ],
- "editable": {
- "new_data_url": "{{entire_url('../api/distributors_create.dspy')}}",
- "update_data_url": "{{entire_url('../api/distributors_update.dspy')}}",
- "delete_data_url": "{{entire_url('../api/distributors_delete.dspy')}}"
- },
- "confidential_fields": ["api_key"],
- "data_filter": {
- "name": "",
- "status": ""
- }
- }
-}
diff --git a/pipeline_dist/models/distributor_pipeline.json b/pipeline_dist/models/distributor_pipeline.json
deleted file mode 100644
index 96f2245..0000000
--- a/pipeline_dist/models/distributor_pipeline.json
+++ /dev/null
@@ -1,140 +0,0 @@
-{
- "summary": [
- {
- "name": "distributor_pipeline",
- "title": "分销商-产线关联定价表",
- "primary": [
- "id"
- ]
- }
- ],
- "fields": [
- {
- "name": "id",
- "title": "主键",
- "type": "str",
- "length": 32,
- "nullable": "no"
- },
- {
- "name": "distributor_id",
- "title": "分销商ID",
- "type": "str",
- "length": 32,
- "nullable": "no"
- },
- {
- "name": "pipeline_id",
- "title": "产线ID",
- "type": "str",
- "length": 32,
- "nullable": "no"
- },
- {
- "name": "custom_price",
- "title": "自定义单价",
- "type": "double",
- "length": 15,
- "dec": 4
- },
- {
- "name": "markup_type",
- "title": "加价方式",
- "type": "str",
- "length": 20
- },
- {
- "name": "markup_value",
- "title": "加价值",
- "type": "double",
- "length": 10,
- "dec": 2
- },
- {
- "name": "daily_limit",
- "title": "日限额",
- "type": "int",
- "default": "0"
- },
- {
- "name": "monthly_limit",
- "title": "月限额",
- "type": "int",
- "default": "0"
- },
- {
- "name": "today_usage",
- "title": "今日已用",
- "type": "int",
- "default": "0"
- },
- {
- "name": "month_usage",
- "title": "本月已用",
- "type": "int",
- "default": "0"
- },
- {
- "name": "status",
- "title": "状态",
- "type": "str",
- "length": 20,
- "default": "active"
- },
- {
- "name": "created_at",
- "title": "创建时间",
- "type": "timestamp"
- },
- {
- "name": "updated_at",
- "title": "更新时间",
- "type": "timestamp"
- }
- ],
- "indexes": [
- {
- "name": "idx_dp_dist_pipe",
- "idxtype": "unique",
- "idxfields": [
- "distributor_id",
- "pipeline_id"
- ]
- },
- {
- "name": "idx_dp_distributor",
- "idxtype": "index",
- "idxfields": [
- "distributor_id"
- ]
- }
- ],
- "codes": [
- {
- "field": "distributor_id",
- "table": "distributors",
- "valuefield": "id",
- "textfield": "name"
- },
- {
- "field": "pipeline_id",
- "table": "pipelines",
- "valuefield": "id",
- "textfield": "name"
- },
- {
- "field": "markup_type",
- "table": "appcodes_kv",
- "valuefield": "k",
- "textfield": "v",
- "cond": "parentid='markup_type'"
- },
- {
- "field": "status",
- "table": "appcodes_kv",
- "valuefield": "k",
- "textfield": "v",
- "cond": "parentid='dp_status'"
- }
- ]
-}
diff --git a/pipeline_dist/models/distributors.json b/pipeline_dist/models/distributors.json
deleted file mode 100644
index 89e468e..0000000
--- a/pipeline_dist/models/distributors.json
+++ /dev/null
@@ -1,128 +0,0 @@
-{
- "summary": [
- {
- "name": "distributors",
- "title": "分销商表",
- "primary": [
- "id"
- ]
- }
- ],
- "fields": [
- {
- "name": "id",
- "title": "主键",
- "type": "str",
- "length": 32,
- "nullable": "no"
- },
- {
- "name": "name",
- "title": "分销商名称",
- "type": "str",
- "length": 200,
- "nullable": "no"
- },
- {
- "name": "org_id",
- "title": "关联组织ID",
- "type": "str",
- "length": 32
- },
- {
- "name": "contact_name",
- "title": "联系人",
- "type": "str",
- "length": 50
- },
- {
- "name": "contact_phone",
- "title": "联系电话",
- "type": "str",
- "length": 20
- },
- {
- "name": "contact_email",
- "title": "联系邮箱",
- "type": "str",
- "length": 100
- },
- {
- "name": "api_key",
- "title": "API密钥",
- "type": "str",
- "length": 200
- },
- {
- "name": "commission_rate",
- "title": "佣金比例%",
- "type": "double",
- "length": 5,
- "dec": 2,
- "default": "0"
- },
- {
- "name": "status",
- "title": "状态",
- "type": "str",
- "length": 20,
- "default": "active"
- },
- {
- "name": "agreement_start",
- "title": "协议开始日",
- "type": "date"
- },
- {
- "name": "agreement_end",
- "title": "协议结束日",
- "type": "date"
- },
- {
- "name": "remarks",
- "title": "备注",
- "type": "text"
- },
- {
- "name": "created_by",
- "title": "创建人",
- "type": "str",
- "length": 32
- },
- {
- "name": "created_at",
- "title": "创建时间",
- "type": "timestamp"
- },
- {
- "name": "updated_at",
- "title": "更新时间",
- "type": "timestamp"
- }
- ],
- "indexes": [
- {
- "name": "idx_dist_name",
- "idxtype": "index",
- "idxfields": [
- "name"
- ]
- },
- {
- "name": "idx_dist_status",
- "idxtype": "index",
- "idxfields": [
- "status"
- ]
- }
- ],
- "codes": [
- {
- "field": "status",
- "table": "appcodes_kv",
- "valuefield": "k",
- "textfield": "v",
- "cond": "parentid='distributor_status'"
- }
- ]
-}
diff --git a/pipeline_dist/mysql.ddl.sql b/pipeline_dist/mysql.ddl.sql
deleted file mode 100644
index d018d79..0000000
--- a/pipeline_dist/mysql.ddl.sql
+++ /dev/null
@@ -1,83 +0,0 @@
-
--- models/distributors.json
-
-
-
-
-
--- 建库时请用以下语句,支持emoji字符
--- CREATE DATABASE mydb CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
-drop table if exists distributors;
-CREATE TABLE distributors
-(
-
- `id` VARCHAR(32) NOT NULL comment '主键',
- `name` VARCHAR(200) NOT NULL comment '分销商名称',
- `org_id` VARCHAR(32) comment '关联组织ID',
- `contact_name` VARCHAR(50) comment '联系人',
- `contact_phone` VARCHAR(20) comment '联系电话',
- `contact_email` VARCHAR(100) comment '联系邮箱',
- `api_key` VARCHAR(200) comment 'API密钥',
- `commission_rate` double(5,2) DEFAULT '0' comment '佣金比例%',
- `status` VARCHAR(20) DEFAULT 'active' comment '状态',
- `agreement_start` date comment '协议开始日',
- `agreement_end` date comment '协议结束日',
- `remarks` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci comment '备注',
- `created_by` VARCHAR(32) comment '创建人',
- `created_at` TIMESTAMP DEFAULT CURRENT_TIMESTAMP comment '创建时间',
- `updated_at` TIMESTAMP DEFAULT CURRENT_TIMESTAMP comment '更新时间'
-
-
-,primary key(id)
-
-
-)
-CHARACTER SET utf8mb4
-COLLATE utf8mb4_unicode_ci
-engine=innodb
-comment '分销商表'
-;
-
-CREATE INDEX distributors_idx_dist_name ON distributors(name);
-CREATE INDEX distributors_idx_dist_status ON distributors(status);
-
--- models/distributor_pipeline.json
-
-
-
-
-
--- 建库时请用以下语句,支持emoji字符
--- CREATE DATABASE mydb CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
-drop table if exists distributor_pipeline;
-CREATE TABLE distributor_pipeline
-(
-
- `id` VARCHAR(32) NOT NULL comment '主键',
- `distributor_id` VARCHAR(32) NOT NULL comment '分销商ID',
- `pipeline_id` VARCHAR(32) NOT NULL comment '产线ID',
- `custom_price` double(15,4) comment '自定义单价',
- `markup_type` VARCHAR(20) comment '加价方式',
- `markup_value` double(10,2) comment '加价值',
- `daily_limit` int DEFAULT '0' comment '日限额',
- `monthly_limit` int DEFAULT '0' comment '月限额',
- `today_usage` int DEFAULT '0' comment '今日已用',
- `month_usage` int DEFAULT '0' comment '本月已用',
- `status` VARCHAR(20) DEFAULT 'active' comment '状态',
- `created_at` TIMESTAMP DEFAULT CURRENT_TIMESTAMP comment '创建时间',
- `updated_at` TIMESTAMP DEFAULT CURRENT_TIMESTAMP comment '更新时间'
-
-
-,primary key(id)
-
-
-)
-CHARACTER SET utf8mb4
-COLLATE utf8mb4_unicode_ci
-engine=innodb
-comment '分销商-产线关联定价表'
-;
-
-CREATE UNIQUE INDEX distributor_pipeline_idx_dp_dist_pipe ON distributor_pipeline(distributor_id,pipeline_id);
-CREATE INDEX distributor_pipeline_idx_dp_distributor ON distributor_pipeline(distributor_id);
-
diff --git a/pipeline_dist/pipeline_dist/__init__.py b/pipeline_dist/pipeline_dist/__init__.py
deleted file mode 100644
index c584987..0000000
--- a/pipeline_dist/pipeline_dist/__init__.py
+++ /dev/null
@@ -1,13 +0,0 @@
-from .init import (
- MODULE_NAME,
- DBNAME,
- distributors_create,
- distributors_update,
- distributors_delete,
- distributor_pipeline_create,
- distributor_pipeline_update,
- distributor_pipeline_delete,
- generate_api_key,
- calculate_price,
- load_pipeline_dist,
-)
diff --git a/pipeline_dist/pipeline_dist/init.py b/pipeline_dist/pipeline_dist/init.py
deleted file mode 100644
index 1144c50..0000000
--- a/pipeline_dist/pipeline_dist/init.py
+++ /dev/null
@@ -1,229 +0,0 @@
-"""pipeline_dist 模块 - 分销商管理模块"""
-import json
-from appPublic.uniqueID import getID
-from sqlor.dbpools import DBPools
-from ahserver.serverenv import ServerEnv
-from appPublic.log import debug
-
-
-MODULE_NAME = 'pipeline_dist'
-DBNAME = 'pipeline'
-
-
-def _get_sor():
- """Get database pool and dbname for pipeline_dist module."""
- return DBPools(), DBNAME
-
-
-async def distributors_create(params_kw):
- """创建分销商记录"""
- result = {'success': False, 'message': ''}
- try:
- db, dbname = _get_sor()
- async with db.sqlorContext(dbname) as sor:
- data = params_kw.copy()
- data.pop('page', None)
- data.pop('rows', None)
- data.pop('data_filter', None)
- data['id'] = getID()
- await sor.C('distributors', data)
- result['success'] = True
- result['message'] = '创建成功'
- result['id'] = data['id']
- except Exception as e:
- result['message'] = str(e)
- return json.dumps(result, ensure_ascii=False, default=str)
-
-
-async def distributors_update(params_kw):
- """更新分销商记录"""
- result = {'success': False, 'message': ''}
- try:
- db, dbname = _get_sor()
- async with db.sqlorContext(dbname) as sor:
- data = params_kw.copy()
- data.pop('page', None)
- data.pop('rows', None)
- data.pop('data_filter', None)
- if not data.get('id'):
- result['message'] = '缺少id'
- else:
- await sor.U('distributors', data)
- result['success'] = True
- result['message'] = '更新成功'
- except Exception as e:
- result['message'] = str(e)
- return json.dumps(result, ensure_ascii=False, default=str)
-
-
-async def distributors_delete(params_kw):
- """删除分销商记录"""
- result = {'success': False, 'message': ''}
- try:
- db, dbname = _get_sor()
- async with db.sqlorContext(dbname) as sor:
- record_id = params_kw.get('id')
- if not record_id:
- result['message'] = '缺少id'
- else:
- await sor.D('distributors', {'id': record_id})
- result['success'] = True
- result['message'] = '删除成功'
- except Exception as e:
- result['message'] = str(e)
- return json.dumps(result, ensure_ascii=False, default=str)
-
-
-async def distributor_pipeline_create(params_kw):
- """创建分销商-产线关联记录"""
- result = {'success': False, 'message': ''}
- try:
- db, dbname = _get_sor()
- async with db.sqlorContext(dbname) as sor:
- data = params_kw.copy()
- data.pop('page', None)
- data.pop('rows', None)
- data.pop('data_filter', None)
- data['id'] = getID()
- await sor.C('distributor_pipeline', data)
- result['success'] = True
- result['message'] = '创建成功'
- result['id'] = data['id']
- except Exception as e:
- result['message'] = str(e)
- return json.dumps(result, ensure_ascii=False, default=str)
-
-
-async def distributor_pipeline_update(params_kw):
- """更新分销商-产线关联记录"""
- result = {'success': False, 'message': ''}
- try:
- db, dbname = _get_sor()
- async with db.sqlorContext(dbname) as sor:
- data = params_kw.copy()
- data.pop('page', None)
- data.pop('rows', None)
- data.pop('data_filter', None)
- if not data.get('id'):
- result['message'] = '缺少id'
- else:
- await sor.U('distributor_pipeline', data)
- result['success'] = True
- result['message'] = '更新成功'
- except Exception as e:
- result['message'] = str(e)
- return json.dumps(result, ensure_ascii=False, default=str)
-
-
-async def distributor_pipeline_delete(params_kw):
- """删除分销商-产线关联记录"""
- result = {'success': False, 'message': ''}
- try:
- db, dbname = _get_sor()
- async with db.sqlorContext(dbname) as sor:
- record_id = params_kw.get('id')
- if not record_id:
- result['message'] = '缺少id'
- else:
- await sor.D('distributor_pipeline', {'id': record_id})
- result['success'] = True
- result['message'] = '删除成功'
- except Exception as e:
- result['message'] = str(e)
- return json.dumps(result, ensure_ascii=False, default=str)
-
-
-async def generate_api_key(params_kw):
- """Generate a new API key for a distributor"""
- result = {'success': False, 'message': ''}
- try:
- distributor_id = params_kw.get('id') or params_kw.get('distributor_id')
- if not distributor_id:
- result['message'] = '缺少distributor_id'
- return json.dumps(result, ensure_ascii=False, default=str)
-
- new_key = getID() + getID()
- db, dbname = _get_sor()
- async with db.sqlorContext(dbname) as sor:
- await sor.U('distributors', {'id': distributor_id, 'api_key': new_key})
- result['success'] = True
- result['key'] = new_key
- result['distributor_id'] = distributor_id
- except Exception as e:
- result['message'] = str(e)
- return json.dumps(result, ensure_ascii=False, default=str)
-
-
-async def calculate_price(params_kw):
- """Calculate effective price for a distributor-pipeline combination.
-
- Returns the effective price considering custom pricing and markup.
- If no custom pricing exists, returns None (caller should use base price).
- """
- result = {'success': False, 'message': '', 'price': None}
- try:
- distributor_id = params_kw.get('distributor_id')
- pipeline_id = params_kw.get('pipeline_id')
- if not distributor_id or not pipeline_id:
- result['message'] = '缺少distributor_id或pipeline_id'
- return json.dumps(result, ensure_ascii=False, default=str)
-
- db, dbname = _get_sor()
- async with db.sqlorContext(dbname) as sor:
- rows = await sor.sqlExe(
- 'select * from distributor_pipeline where distributor_id = :distributor_id and pipeline_id = :pipeline_id',
- {'distributor_id': distributor_id, 'pipeline_id': pipeline_id}
- )
- if not rows:
- result['success'] = True
- result['price'] = None
- return json.dumps(result, ensure_ascii=False, default=str)
-
- dp = rows[0] if isinstance(rows, list) else rows
-
- # If custom_price is set, use it as base
- base_price = None
- custom_price = dp.get('custom_price') if hasattr(dp, 'get') else getattr(dp, 'custom_price', None)
- if custom_price is not None:
- base_price = custom_price
-
- # Apply markup if configured
- markup_type = dp.get('markup_type') if hasattr(dp, 'get') else getattr(dp, 'markup_type', None)
- markup_value = dp.get('markup_value') if hasattr(dp, 'get') else getattr(dp, 'markup_value', None)
-
- if markup_type and markup_value is not None and base_price is not None:
- if markup_type == 'fixed':
- result['price'] = base_price + markup_value
- elif markup_type == 'percentage':
- result['price'] = base_price * (1 + markup_value / 100)
- else:
- result['price'] = base_price
-
- result['success'] = True
- except Exception as e:
- result['message'] = str(e)
- return json.dumps(result, ensure_ascii=False, default=str)
-
-
-def load_pipeline_dist():
- """注册函数到 ServerEnv"""
- env = ServerEnv()
- # Distributors
- env.distributors_create = distributors_create
- env.distributors_creates = distributors_create
- env.distributors_update = distributors_update
- env.distributors_updates = distributors_update
- env.distributors_delete = distributors_delete
- env.distributors_deletes = distributors_delete
- # Distributor Pipeline
- env.distributor_pipeline_create = distributor_pipeline_create
- env.distributor_pipeline_creates = distributor_pipeline_create
- env.distributor_pipeline_update = distributor_pipeline_update
- env.distributor_pipeline_updates = distributor_pipeline_update
- env.distributor_pipeline_delete = distributor_pipeline_delete
- env.distributor_pipeline_deletes = distributor_pipeline_delete
- # Utility functions
- env.generate_api_key = generate_api_key
- env.calculate_price = calculate_price
- debug(f'[{MODULE_NAME}] module loaded')
- return True
diff --git a/pipeline_dist/pyproject.toml b/pipeline_dist/pyproject.toml
deleted file mode 100644
index af56723..0000000
--- a/pipeline_dist/pyproject.toml
+++ /dev/null
@@ -1,9 +0,0 @@
-[project]
-name = "pipeline_dist"
-version = "0.1.0"
-description = "产线分发模块"
-dependencies = ["sqlor"]
-
-[tool.setuptools.packages.find]
-where = ["."]
-include = ["pipeline_dist*"]
diff --git a/pipeline_dist/scripts/load_path.py b/pipeline_dist/scripts/load_path.py
deleted file mode 100644
index 01f1d0a..0000000
--- a/pipeline_dist/scripts/load_path.py
+++ /dev/null
@@ -1,38 +0,0 @@
-#!/usr/bin/env python3
-"""RBAC path registration for pipeline_dist + showcase modules."""
-import os, sys, subprocess
-
-MODS = [
- ("pipeline_dist", [
- "/pipeline_dist",
- "/pipeline_dist/index.ui",
- "/pipeline_dist/distributors/index.ui",
- "/pipeline_dist/distributor_pipeline/index.ui",
- ]),
- ("showcase", [
- "/showcase",
- "/showcase/index.ui",
- ]),
-]
-
-
-def main():
- root = os.path.expanduser("~/pipeline")
- set_perm = os.path.join(root, "set_role_perm.py")
- if not os.path.isfile(set_perm):
- print("ERROR: pipeline root not found"); sys.exit(1)
- py = sys.executable
- count = 0
- total = 0
- for mod, paths in MODS:
- total += len(paths)
- for path in paths:
- r = subprocess.run([py, set_perm, "logined", path], capture_output=True, text=True, cwd=root)
- if r.returncode == 0: count += 1
- else: print(f" WARN: {path}")
- print(f" {mod}: {len(paths)} paths")
- print(f"Registered {count}/{total}")
-
-
-if __name__ == "__main__":
- main()
diff --git a/pipeline_dist/wwwroot/api/distributor_generate_key.dspy b/pipeline_dist/wwwroot/api/distributor_generate_key.dspy
deleted file mode 100644
index 2bc029f..0000000
--- a/pipeline_dist/wwwroot/api/distributor_generate_key.dspy
+++ /dev/null
@@ -1,2 +0,0 @@
-result = await generate_api_key(params_kw)
-return result
diff --git a/pipeline_dist/wwwroot/api/distributor_pipeline_create.dspy b/pipeline_dist/wwwroot/api/distributor_pipeline_create.dspy
deleted file mode 100644
index 180ea4b..0000000
--- a/pipeline_dist/wwwroot/api/distributor_pipeline_create.dspy
+++ /dev/null
@@ -1,2 +0,0 @@
-result = await distributor_pipeline_create(params_kw)
-return result
diff --git a/pipeline_dist/wwwroot/api/distributor_pipeline_delete.dspy b/pipeline_dist/wwwroot/api/distributor_pipeline_delete.dspy
deleted file mode 100644
index 9d54cc0..0000000
--- a/pipeline_dist/wwwroot/api/distributor_pipeline_delete.dspy
+++ /dev/null
@@ -1,2 +0,0 @@
-result = await distributor_pipeline_delete(params_kw)
-return result
diff --git a/pipeline_dist/wwwroot/api/distributor_pipeline_update.dspy b/pipeline_dist/wwwroot/api/distributor_pipeline_update.dspy
deleted file mode 100644
index 16ee224..0000000
--- a/pipeline_dist/wwwroot/api/distributor_pipeline_update.dspy
+++ /dev/null
@@ -1,2 +0,0 @@
-result = await distributor_pipeline_update(params_kw)
-return result
diff --git a/pipeline_dist/wwwroot/api/distributors_create.dspy b/pipeline_dist/wwwroot/api/distributors_create.dspy
deleted file mode 100644
index 999d8b5..0000000
--- a/pipeline_dist/wwwroot/api/distributors_create.dspy
+++ /dev/null
@@ -1,2 +0,0 @@
-result = await distributors_create(params_kw)
-return result
diff --git a/pipeline_dist/wwwroot/api/distributors_delete.dspy b/pipeline_dist/wwwroot/api/distributors_delete.dspy
deleted file mode 100644
index a666ef2..0000000
--- a/pipeline_dist/wwwroot/api/distributors_delete.dspy
+++ /dev/null
@@ -1,2 +0,0 @@
-result = await distributors_delete(params_kw)
-return result
diff --git a/pipeline_dist/wwwroot/api/distributors_update.dspy b/pipeline_dist/wwwroot/api/distributors_update.dspy
deleted file mode 100644
index 7be53b3..0000000
--- a/pipeline_dist/wwwroot/api/distributors_update.dspy
+++ /dev/null
@@ -1,2 +0,0 @@
-result = await distributors_update(params_kw)
-return result
diff --git a/pipeline_dist/wwwroot/api/get_search_distributor_id.dspy b/pipeline_dist/wwwroot/api/get_search_distributor_id.dspy
deleted file mode 100644
index 238b917..0000000
--- a/pipeline_dist/wwwroot/api/get_search_distributor_id.dspy
+++ /dev/null
@@ -1,8 +0,0 @@
-data = [{'value': '', 'text': '全部'}]
-try:
- async with get_sor_context(request._run_ns, 'pipeline') as sor:
- rows = await sor.sqlExe('select id as value, name as text from distributors order by name', {})
- data.extend(list(rows))
-except Exception as e:
- debug('error: ' + str(e))
-return json.dumps(data, ensure_ascii=False)
diff --git a/pipeline_dist/wwwroot/api/get_search_pipeline_id.dspy b/pipeline_dist/wwwroot/api/get_search_pipeline_id.dspy
deleted file mode 100644
index 5519023..0000000
--- a/pipeline_dist/wwwroot/api/get_search_pipeline_id.dspy
+++ /dev/null
@@ -1,8 +0,0 @@
-data = [{'value': '', 'text': '全部'}]
-try:
- async with get_sor_context(request._run_ns, 'pipeline') as sor:
- rows = await sor.sqlExe('select id as value, name as text from pipelines order by name', {})
- data.extend(list(rows))
-except Exception as e:
- debug('error: ' + str(e))
-return json.dumps(data, ensure_ascii=False)
diff --git a/pipeline_dist/wwwroot/distributor_pipeline/add_distributor_pipeline.dspy b/pipeline_dist/wwwroot/distributor_pipeline/add_distributor_pipeline.dspy
deleted file mode 100644
index adaa5c9..0000000
--- a/pipeline_dist/wwwroot/distributor_pipeline/add_distributor_pipeline.dspy
+++ /dev/null
@@ -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_dist')
-async with db.sqlorContext(dbname) as sor:
- r = await sor.C('distributor_pipeline', 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"
- }
-}
\ No newline at end of file
diff --git a/pipeline_dist/wwwroot/distributor_pipeline/delete_distributor_pipeline.dspy b/pipeline_dist/wwwroot/distributor_pipeline/delete_distributor_pipeline.dspy
deleted file mode 100644
index 5fea630..0000000
--- a/pipeline_dist/wwwroot/distributor_pipeline/delete_distributor_pipeline.dspy
+++ /dev/null
@@ -1,33 +0,0 @@
-
-ns = {
- 'id':params_kw['id'],
-}
-
-
-db = DBPools()
-dbname = get_module_dbname('pipeline_dist')
-async with db.sqlorContext(dbname) as sor:
- r = await sor.D('distributor_pipeline', 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"
- }
-}
\ No newline at end of file
diff --git a/pipeline_dist/wwwroot/distributor_pipeline/get_distributor_pipeline.dspy b/pipeline_dist/wwwroot/distributor_pipeline/get_distributor_pipeline.dspy
deleted file mode 100644
index baf0035..0000000
--- a/pipeline_dist/wwwroot/distributor_pipeline/get_distributor_pipeline.dspy
+++ /dev/null
@@ -1,143 +0,0 @@
-
-ns = params_kw.copy()
-
-
-debug(f'get_distributor_pipeline.dspy:{ns=}')
-if not ns.get('page'):
- ns['page'] = 1
-if not ns.get('sort'):
-
-
- ns['sort'] = 'created_at'
-
-
-
-sql = '''select a.*, b.distributor_id_text, c.pipeline_id_text, d.markup_type_text, e.status_text
-from (select * from distributor_pipeline where 1=1 [[filterstr]]) a left join (select id as distributor_id,
- name as distributor_id_text from distributors where 1 = 1) b on a.distributor_id = b.distributor_id left join (select id as pipeline_id,
- name as pipeline_id_text from pipelines where 1 = 1) c on a.pipeline_id = c.pipeline_id left join (select k as markup_type,
- v as markup_type_text from appcodes_kv where parentid='markup_type') d on a.markup_type = d.markup_type left join (select k as status,
- v as status_text from appcodes_kv where parentid='dp_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": "distributor_id",
- "title": "分销商ID",
- "type": "str",
- "length": 32,
- "nullable": "no"
- },
- {
- "name": "pipeline_id",
- "title": "产线ID",
- "type": "str",
- "length": 32,
- "nullable": "no"
- },
- {
- "name": "custom_price",
- "title": "自定义单价",
- "type": "double",
- "length": 15,
- "dec": 4
- },
- {
- "name": "markup_type",
- "title": "加价方式",
- "type": "str",
- "length": 20
- },
- {
- "name": "markup_value",
- "title": "加价值",
- "type": "double",
- "length": 10,
- "dec": 2
- },
- {
- "name": "daily_limit",
- "title": "日限额",
- "type": "int",
- "default": "0"
- },
- {
- "name": "monthly_limit",
- "title": "月限额",
- "type": "int",
- "default": "0"
- },
- {
- "name": "today_usage",
- "title": "今日已用",
- "type": "int",
- "default": "0"
- },
- {
- "name": "month_usage",
- "title": "本月已用",
- "type": "int",
- "default": "0"
- },
- {
- "name": "status",
- "title": "状态",
- "type": "str",
- "length": 20,
- "default": "active"
- },
- {
- "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)
-
-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_dist')
-async with db.sqlorContext(dbname) as sor:
- r = await sor.sqlPaging(sql, ns)
- return r
-return {
- "total":0,
- "rows":[]
-}
\ No newline at end of file
diff --git a/pipeline_dist/wwwroot/distributor_pipeline/index.ui b/pipeline_dist/wwwroot/distributor_pipeline/index.ui
deleted file mode 100644
index 59a21fe..0000000
--- a/pipeline_dist/wwwroot/distributor_pipeline/index.ui
+++ /dev/null
@@ -1,327 +0,0 @@
-
-{
- "widgettype":"VBox",
- "options":{"cheight":40,"width":"100%"},
- "subwidgets":[{
- "id":"distributor_pipeline_tbl",
- "widgettype":"Tabular",
- "options":{
- "width":"100%",
- "height":"100%",
-
-
- "title":"分销商-产线关联定价表",
-
-
-
-
- "toolbar":{
- "tools": [
- {
- "selected_row": true,
- "name": "distributors",
- "icon": "{{entire_url('/imgs/distributors.svg')}}",
- "label": "分销商"
- },
- {
- "selected_row": true,
- "name": "pipelines",
- "icon": "{{entire_url('/imgs/pipelines.svg')}}",
- "label": "产线"
- }
- ]
-},
-
- "css":"card",
-
-
- "editable":{
-
- "new_data_url":"{{entire_url('add_distributor_pipeline.dspy')}}",
-
-
- "delete_data_url":"{{entire_url('delete_distributor_pipeline.dspy')}}",
-
-
- "update_data_url":"{{entire_url('update_distributor_pipeline.dspy')}}"
-
- },
-
-
- "data_url":"{{entire_url('./get_distributor_pipeline.dspy')}}",
-
- "data_method":"GET",
- "data_params":{{json.dumps(params_kw, indent=4, ensure_ascii=False)}},
- "row_options":{
-
-
-
- "browserfields": {
- "exclouded": [
- "id"
- ],
- "cwidth": {},
- "alters": {
- "distributor_id": {
- "dataurl": "{{entire_url('../api/get_search_distributor_id.dspy')}}"
- },
- "pipeline_id": {
- "dataurl": "{{entire_url('../api/get_search_pipeline_id.dspy')}}"
- }
- }
-},
-
-
- "editexclouded":[
- "id",
- "created_at",
- "updated_at"
-],
-
- "fields":[
- {
- "name": "id",
- "title": "主键",
- "type": "str",
- "length": 32,
- "nullable": "no",
- "cwidth": 18,
- "uitype": "str",
- "datatype": "str",
- "label": "主键"
- },
- {
- "name": "distributor_id",
- "title": "分销商ID",
- "type": "str",
- "length": 32,
- "nullable": "no",
- "label": "分销商ID",
- "uitype": "code",
- "valueField": "distributor_id",
- "textField": "distributor_id_text",
- "params": {
- "dbname": "{{get_module_dbname('pipeline_dist')}}",
- "table": "distributors",
- "tblvalue": "id",
- "tbltext": "name",
- "valueField": "distributor_id",
- "textField": "distributor_id_text"
- },
- "dataurl": "{{entire_url('../api/get_search_distributor_id.dspy')}}"
- },
- {
- "name": "pipeline_id",
- "title": "产线ID",
- "type": "str",
- "length": 32,
- "nullable": "no",
- "label": "产线ID",
- "uitype": "code",
- "valueField": "pipeline_id",
- "textField": "pipeline_id_text",
- "params": {
- "dbname": "{{get_module_dbname('pipeline_dist')}}",
- "table": "pipelines",
- "tblvalue": "id",
- "tbltext": "name",
- "valueField": "pipeline_id",
- "textField": "pipeline_id_text"
- },
- "dataurl": "{{entire_url('../api/get_search_pipeline_id.dspy')}}"
- },
- {
- "name": "custom_price",
- "title": "自定义单价",
- "type": "double",
- "length": 15,
- "dec": 4,
- "cwidth": 15,
- "uitype": "float",
- "datatype": "double",
- "label": "自定义单价"
- },
- {
- "name": "markup_type",
- "title": "加价方式",
- "type": "str",
- "length": 20,
- "label": "加价方式",
- "uitype": "code",
- "valueField": "markup_type",
- "textField": "markup_type_text",
- "params": {
- "dbname": "{{get_module_dbname('pipeline_dist')}}",
- "table": "appcodes_kv",
- "tblvalue": "k",
- "tbltext": "v",
- "valueField": "markup_type",
- "textField": "markup_type_text",
- "cond": "parentid='markup_type'"
- },
- "dataurl": "{{entire_url('/appbase/get_code.dspy')}}"
- },
- {
- "name": "markup_value",
- "title": "加价值",
- "type": "double",
- "length": 10,
- "dec": 2,
- "cwidth": 10,
- "uitype": "float",
- "datatype": "double",
- "label": "加价值"
- },
- {
- "name": "daily_limit",
- "title": "日限额",
- "type": "int",
- "default": "0",
- "length": 0,
- "uitype": "int",
- "datatype": "int",
- "label": "日限额"
- },
- {
- "name": "monthly_limit",
- "title": "月限额",
- "type": "int",
- "default": "0",
- "length": 0,
- "uitype": "int",
- "datatype": "int",
- "label": "月限额"
- },
- {
- "name": "today_usage",
- "title": "今日已用",
- "type": "int",
- "default": "0",
- "length": 0,
- "uitype": "int",
- "datatype": "int",
- "label": "今日已用"
- },
- {
- "name": "month_usage",
- "title": "本月已用",
- "type": "int",
- "default": "0",
- "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": "{{get_module_dbname('pipeline_dist')}}",
- "table": "appcodes_kv",
- "tblvalue": "k",
- "tbltext": "v",
- "valueField": "status",
- "textField": "status_text",
- "cond": "parentid='dp_status'"
- },
- "dataurl": "{{entire_url('/appbase/get_code.dspy')}}"
- },
- {
- "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":{
- "distributor_id": "",
- "pipeline_id": "",
- "status": ""
-},
-
-
-
-
-
- "page_rows":160,
- "cache_limit":5
- }
-
- ,"binds":[
- {
- "wid": "self",
- "event": "distributors",
- "actiontype": "urlwidget",
- "target": "PopupWindow",
- "popup_options": {
- "title": "分销商",
- "icon": "{{entire_url('/appbase/get_icon.dspy')}}?id=distributors",
- "resizable": true,
- "height": "70%",
- "width": "70%"
- },
- "params_mapping": {
- "mapping": {
- "id": "distributor_id",
- "referer_widget": "referer_widget"
- },
- "need_other": false
- },
- "options": {
- "method": "POST",
- "params": {},
- "url": "{{entire_url('../distributors')}}"
- }
- },
- {
- "wid": "self",
- "event": "pipelines",
- "actiontype": "urlwidget",
- "target": "PopupWindow",
- "popup_options": {
- "title": "产线",
- "icon": "{{entire_url('/appbase/get_icon.dspy')}}?id=pipelines",
- "resizable": true,
- "height": "70%",
- "width": "70%"
- },
- "params_mapping": {
- "mapping": {
- "id": "pipeline_id",
- "referer_widget": "referer_widget"
- },
- "need_other": false
- },
- "options": {
- "method": "POST",
- "params": {},
- "url": "{{entire_url('../pipelines')}}"
- }
- }
-]
-
-}]
-}
\ No newline at end of file
diff --git a/pipeline_dist/wwwroot/distributor_pipeline/update_distributor_pipeline.dspy b/pipeline_dist/wwwroot/distributor_pipeline/update_distributor_pipeline.dspy
deleted file mode 100644
index 3569181..0000000
--- a/pipeline_dist/wwwroot/distributor_pipeline/update_distributor_pipeline.dspy
+++ /dev/null
@@ -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_dist')
-async with db.sqlorContext(dbname) as sor:
-
- r = await sor.U('distributor_pipeline', 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"
- }
-}
\ No newline at end of file
diff --git a/pipeline_dist/wwwroot/distributors/add_distributors.dspy b/pipeline_dist/wwwroot/distributors/add_distributors.dspy
deleted file mode 100644
index bb8871f..0000000
--- a/pipeline_dist/wwwroot/distributors/add_distributors.dspy
+++ /dev/null
@@ -1,40 +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
-
-if params_kw.get('api_key'):
- ns['api_key'] = password_encode(params_kw.get('api_key'))
-
-
-
-db = DBPools()
-dbname = get_module_dbname('pipeline_dist')
-async with db.sqlorContext(dbname) as sor:
- r = await sor.C('distributors', 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"
- }
-}
\ No newline at end of file
diff --git a/pipeline_dist/wwwroot/distributors/delete_distributors.dspy b/pipeline_dist/wwwroot/distributors/delete_distributors.dspy
deleted file mode 100644
index 8f8d3e3..0000000
--- a/pipeline_dist/wwwroot/distributors/delete_distributors.dspy
+++ /dev/null
@@ -1,33 +0,0 @@
-
-ns = {
- 'id':params_kw['id'],
-}
-
-
-db = DBPools()
-dbname = get_module_dbname('pipeline_dist')
-async with db.sqlorContext(dbname) as sor:
- r = await sor.D('distributors', 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"
- }
-}
\ No newline at end of file
diff --git a/pipeline_dist/wwwroot/distributors/get_distributors.dspy b/pipeline_dist/wwwroot/distributors/get_distributors.dspy
deleted file mode 100644
index d5f7ea7..0000000
--- a/pipeline_dist/wwwroot/distributors/get_distributors.dspy
+++ /dev/null
@@ -1,148 +0,0 @@
-
-ns = params_kw.copy()
-
-
-debug(f'get_distributors.dspy:{ns=}')
-if not ns.get('page'):
- ns['page'] = 1
-if not ns.get('sort'):
-
-
- ns['sort'] = 'created_at'
-
-
-
-sql = '''select a.*, b.status_text
-from (select * from distributors where 1=1 [[filterstr]]) a left join (select k as status,
- v as status_text from appcodes_kv where parentid='distributor_status') b on a.status = b.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": "name",
- "title": "分销商名称",
- "type": "str",
- "length": 200,
- "nullable": "no"
- },
- {
- "name": "org_id",
- "title": "关联组织ID",
- "type": "str",
- "length": 32
- },
- {
- "name": "contact_name",
- "title": "联系人",
- "type": "str",
- "length": 50
- },
- {
- "name": "contact_phone",
- "title": "联系电话",
- "type": "str",
- "length": 20
- },
- {
- "name": "contact_email",
- "title": "联系邮箱",
- "type": "str",
- "length": 100
- },
- {
- "name": "api_key",
- "title": "API密钥",
- "type": "str",
- "length": 200
- },
- {
- "name": "commission_rate",
- "title": "佣金比例%",
- "type": "double",
- "length": 5,
- "dec": 2,
- "default": "0"
- },
- {
- "name": "status",
- "title": "状态",
- "type": "str",
- "length": 20,
- "default": "active"
- },
- {
- "name": "agreement_start",
- "title": "协议开始日",
- "type": "date"
- },
- {
- "name": "agreement_end",
- "title": "协议结束日",
- "type": "date"
- },
- {
- "name": "remarks",
- "title": "备注",
- "type": "text"
- },
- {
- "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)
-
-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_dist')
-async with db.sqlorContext(dbname) as sor:
- r = await sor.sqlPaging(sql, ns)
- return r
-return {
- "total":0,
- "rows":[]
-}
\ No newline at end of file
diff --git a/pipeline_dist/wwwroot/distributors/index.ui b/pipeline_dist/wwwroot/distributors/index.ui
deleted file mode 100644
index 844faf7..0000000
--- a/pipeline_dist/wwwroot/distributors/index.ui
+++ /dev/null
@@ -1,240 +0,0 @@
-
-{
- "widgettype":"VBox",
- "options":{"cheight":40,"width":"100%"},
- "subwidgets":[{
- "id":"distributors_tbl",
- "widgettype":"Tabular",
- "options":{
- "width":"100%",
- "height":"100%",
-
-
- "title":"分销商表",
-
-
-
-
- "css":"card",
-
-
- "editable":{
-
- "new_data_url":"{{entire_url('add_distributors.dspy')}}",
-
-
- "delete_data_url":"{{entire_url('delete_distributors.dspy')}}",
-
-
- "update_data_url":"{{entire_url('update_distributors.dspy')}}"
-
- },
-
-
- "data_url":"{{entire_url('./get_distributors.dspy')}}",
-
- "data_method":"GET",
- "data_params":{{json.dumps(params_kw, indent=4, ensure_ascii=False)}},
- "row_options":{
-
-
-
- "browserfields": {
- "exclouded": [
- "id",
- "api_key",
- "remarks"
- ],
- "cwidth": {}
-},
-
-
- "editexclouded":[
- "id",
- "created_at",
- "updated_at"
-],
-
- "fields":[
- {
- "name": "id",
- "title": "主键",
- "type": "str",
- "length": 32,
- "nullable": "no",
- "cwidth": 18,
- "uitype": "str",
- "datatype": "str",
- "label": "主键"
- },
- {
- "name": "name",
- "title": "分销商名称",
- "type": "str",
- "length": 200,
- "nullable": "no",
- "cwidth": 18,
- "uitype": "str",
- "datatype": "str",
- "label": "分销商名称"
- },
- {
- "name": "org_id",
- "title": "关联组织ID",
- "type": "str",
- "length": 32,
- "cwidth": 18,
- "uitype": "str",
- "datatype": "str",
- "label": "关联组织ID"
- },
- {
- "name": "contact_name",
- "title": "联系人",
- "type": "str",
- "length": 50,
- "cwidth": 18,
- "uitype": "str",
- "datatype": "str",
- "label": "联系人"
- },
- {
- "name": "contact_phone",
- "title": "联系电话",
- "type": "str",
- "length": 20,
- "cwidth": 18,
- "uitype": "str",
- "datatype": "str",
- "label": "联系电话"
- },
- {
- "name": "contact_email",
- "title": "联系邮箱",
- "type": "str",
- "length": 100,
- "cwidth": 18,
- "uitype": "str",
- "datatype": "str",
- "label": "联系邮箱"
- },
- {
- "name": "api_key",
- "title": "API密钥",
- "type": "str",
- "length": 200,
- "cwidth": 18,
- "uitype": "password",
- "datatype": "str",
- "label": "API密钥"
- },
- {
- "name": "commission_rate",
- "title": "佣金比例%",
- "type": "double",
- "length": 5,
- "dec": 2,
- "default": "0",
- "cwidth": 5,
- "uitype": "float",
- "datatype": "double",
- "label": "佣金比例%"
- },
- {
- "name": "status",
- "title": "状态",
- "type": "str",
- "length": 20,
- "default": "active",
- "label": "状态",
- "uitype": "code",
- "valueField": "status",
- "textField": "status_text",
- "params": {
- "dbname": "{{get_module_dbname('pipeline_dist')}}",
- "table": "appcodes_kv",
- "tblvalue": "k",
- "tbltext": "v",
- "valueField": "status",
- "textField": "status_text",
- "cond": "parentid='distributor_status'"
- },
- "dataurl": "{{entire_url('/appbase/get_code.dspy')}}"
- },
- {
- "name": "agreement_start",
- "title": "协议开始日",
- "type": "date",
- "length": 0,
- "uitype": "date",
- "datatype": "date",
- "label": "协议开始日"
- },
- {
- "name": "agreement_end",
- "title": "协议结束日",
- "type": "date",
- "length": 0,
- "uitype": "date",
- "datatype": "date",
- "label": "协议结束日"
- },
- {
- "name": "remarks",
- "title": "备注",
- "type": "text",
- "length": 0,
- "uitype": "text",
- "datatype": "text",
- "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":{
- "name": "",
- "status": ""
-},
-
-
-
-
-
- "page_rows":160,
- "cache_limit":5
- }
-
- ,"binds":[]
-
-}]
-}
\ No newline at end of file
diff --git a/pipeline_dist/wwwroot/distributors/update_distributors.dspy b/pipeline_dist/wwwroot/distributors/update_distributors.dspy
deleted file mode 100644
index f348d31..0000000
--- a/pipeline_dist/wwwroot/distributors/update_distributors.dspy
+++ /dev/null
@@ -1,39 +0,0 @@
-
-ns = params_kw.copy()
-for k,v in ns.items():
- if v == 'NaN' or v == 'null':
- ns[k] = None
-
-
-
-if params_kw.get('api_key'):
- ns['api_key'] = password_encode(params_kw.get('api_key'))
-
-
-db = DBPools()
-dbname = get_module_dbname('pipeline_dist')
-async with db.sqlorContext(dbname) as sor:
-
- r = await sor.U('distributors', 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"
- }
-}
\ No newline at end of file
diff --git a/pipeline_dist/wwwroot/index.ui b/pipeline_dist/wwwroot/index.ui
deleted file mode 100644
index 8a814e5..0000000
--- a/pipeline_dist/wwwroot/index.ui
+++ /dev/null
@@ -1,37 +0,0 @@
-{
- "widgettype": "VBox",
- "options": {"width": "100%", "height": "100%", "padding": "24px", "spacing": "20px"},
- "subwidgets": [
- {"widgettype": "Title2", "options": {"text": "分销管理"}},
- {
- "widgettype": "ResponsableBox",
- "options": {"gap": "24px", "minWidth": "260px"},
- "subwidgets": [
- {
- "widgettype": "VBox",
- "options": {"css": "card", "cwidth": 23, "cheight": 11, "padding": "24px", "cursor": "pointer", "bgcolor": "#fff"},
- "binds": [{"wid": "self", "event": "click", "actiontype": "urlwidget", "target": "app.main_content", "options": {"url": "{{entire_url('distributor_pipeline/')}}"}, "mode": "replace"}],
- "subwidgets": [
- {"widgettype": "VBox", "options": {"width": "44px", "height": "44px", "bgcolor": "#ECFDF5", "borderRadius": "12px", "alignItems": "center", "justifyContent": "center", "marginBottom": "12px"}, "subwidgets": [
- {"widgettype": "Svg", "options": {"svg": "", "width": "24px", "height": "24px"}}
- ]},
- {"widgettype": "Title3", "options": {"text": "分销商产线配置", "marginBottom": "4px"}},
- {"widgettype": "Text", "options": {"text": "管理分销商与产线绑定关系", "cfontsize": 0.9}}
- ]
- },
- {
- "widgettype": "VBox",
- "options": {"css": "card", "cwidth": 23, "cheight": 11, "padding": "24px", "cursor": "pointer", "bgcolor": "#fff"},
- "binds": [{"wid": "self", "event": "click", "actiontype": "urlwidget", "target": "app.main_content", "options": {"url": "{{entire_url('distributors/')}}"}, "mode": "replace"}],
- "subwidgets": [
- {"widgettype": "VBox", "options": {"width": "44px", "height": "44px", "bgcolor": "#FFF7ED", "borderRadius": "12px", "alignItems": "center", "justifyContent": "center", "marginBottom": "12px"}, "subwidgets": [
- {"widgettype": "Svg", "options": {"svg": "", "width": "24px", "height": "24px"}}
- ]},
- {"widgettype": "Title3", "options": {"text": "分销商管理", "marginBottom": "4px"}},
- {"widgettype": "Text", "options": {"text": "管理分销商账号与基本信息", "cfontsize": 0.9}}
- ]
- }
- ]
- }
- ]
-}
diff --git a/pipeline_ops/init/data.json b/pipeline_ops/init/data.json
deleted file mode 100644
index d29845c..0000000
--- a/pipeline_ops/init/data.json
+++ /dev/null
@@ -1,48 +0,0 @@
-{
- "appcodes": [
- {
- "parentid": "pricing_type",
- "parentname": "计费类型",
- "items": [
- {"k": "per_call", "v": "按次计费"},
- {"k": "per_token", "v": "按Token计费"},
- {"k": "subscription", "v": "订阅制"}
- ]
- },
- {
- "parentid": "pricing_status",
- "parentname": "定价状态",
- "items": [
- {"k": "active", "v": "生效中"},
- {"k": "expired", "v": "已过期"},
- {"k": "pending", "v": "待生效"}
- ]
- },
- {
- "parentid": "capacity_status",
- "parentname": "供应量状态",
- "items": [
- {"k": "active", "v": "正常"},
- {"k": "paused", "v": "已暂停"},
- {"k": "exhausted", "v": "已耗尽"}
- ]
- },
- {
- "parentid": "usage_status",
- "parentname": "使用状态",
- "items": [
- {"k": "success", "v": "成功"},
- {"k": "failed", "v": "失败"},
- {"k": "timeout", "v": "超时"}
- ]
- },
- {
- "parentid": "currency",
- "parentname": "货币类型",
- "items": [
- {"k": "CNY", "v": "人民币"},
- {"k": "USD", "v": "美元"}
- ]
- }
- ]
-}
diff --git a/pipeline_ops/json/pipeline_capacity.json b/pipeline_ops/json/pipeline_capacity.json
deleted file mode 100644
index 9ab6b41..0000000
--- a/pipeline_ops/json/pipeline_capacity.json
+++ /dev/null
@@ -1,32 +0,0 @@
-{
- "tblname": "pipeline_capacity",
- "title": "产线容量管理",
- "params": {
- "sortby": ["pipeline_id"],
- "logined_userorgid": "org_id",
- "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": "已停用"}]
- }
- }
- },
- "editable": {
- "new_data_url": "{{entire_url('../api/pipeline_capacity_create.dspy')}}",
- "update_data_url": "{{entire_url('../api/pipeline_capacity_update.dspy')}}",
- "delete_data_url": "{{entire_url('../api/pipeline_capacity_delete.dspy')}}"
- },
- "data_filter": {
- "AND": [
- {"field": "pipeline_id", "op": "=", "var": "filter_pipeline_id"},
- {"field": "status", "op": "=", "var": "filter_status"}
- ]
- }
- }
-}
diff --git a/pipeline_ops/json/pipeline_pricing.json b/pipeline_ops/json/pipeline_pricing.json
deleted file mode 100644
index 3dfbeb1..0000000
--- a/pipeline_ops/json/pipeline_pricing.json
+++ /dev/null
@@ -1,36 +0,0 @@
-{
- "tblname": "pipeline_pricing",
- "title": "产线定价管理",
- "params": {
- "sortby": ["effective_date desc"],
- "logined_userorgid": "org_id",
- "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": "已停用"}]
- }
- }
- },
- "editable": {
- "new_data_url": "{{entire_url('../api/pipeline_pricing_create.dspy')}}",
- "update_data_url": "{{entire_url('../api/pipeline_pricing_update.dspy')}}",
- "delete_data_url": "{{entire_url('../api/pipeline_pricing_delete.dspy')}}"
- },
- "data_filter": {
- "AND": [
- {"field": "pipeline_id", "op": "=", "var": "filter_pipeline_id"},
- {"field": "status", "op": "=", "var": "filter_status"}
- ]
- }
- }
-}
diff --git a/pipeline_ops/json/pipeline_usage_log.json b/pipeline_ops/json/pipeline_usage_log.json
deleted file mode 100644
index e7307af..0000000
--- a/pipeline_ops/json/pipeline_usage_log.json
+++ /dev/null
@@ -1,35 +0,0 @@
-{
- "tblname": "pipeline_usage_log",
- "title": "产线调用日志",
- "params": {
- "sortby": ["called_at desc"],
- "logined_userorgid": "",
- "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"],
- "editable": {
- "new_data_url": "",
- "update_data_url": "",
- "delete_data_url": ""
- },
- "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"}
- ]
- }
- }
-}
diff --git a/pipeline_ops/models/pipeline_capacity.json b/pipeline_ops/models/pipeline_capacity.json
deleted file mode 100644
index d69a7af..0000000
--- a/pipeline_ops/models/pipeline_capacity.json
+++ /dev/null
@@ -1,95 +0,0 @@
-{
- "summary": [
- {
- "name": "pipeline_capacity",
- "title": "产线容量表",
- "primary": [
- "id"
- ]
- }
- ],
- "fields": [
- {
- "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"
- }
- ],
- "indexes": [
- {
- "name": "uk_capacity_pipeline",
- "idxtype": "unique",
- "idxfields": [
- "pipeline_id"
- ]
- }
- ],
- "codes": [
- {
- "field": "pipeline_id",
- "table": "pipelines",
- "valuefield": "id",
- "textfield": "name"
- },
- {
- "field": "status",
- "table": "appcodes_kv",
- "valuefield": "k",
- "textfield": "v",
- "cond": "parentid='capacity_status'"
- }
- ]
-}
diff --git a/pipeline_ops/models/pipeline_pricing.json b/pipeline_ops/models/pipeline_pricing.json
deleted file mode 100644
index 812cdae..0000000
--- a/pipeline_ops/models/pipeline_pricing.json
+++ /dev/null
@@ -1,141 +0,0 @@
-{
- "summary": [
- {
- "name": "pipeline_pricing",
- "title": "产线定价表",
- "primary": [
- "id"
- ]
- }
- ],
- "fields": [
- {
- "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"
- }
- ],
- "indexes": [
- {
- "name": "idx_pricing_pipeline",
- "idxtype": "index",
- "idxfields": [
- "pipeline_id"
- ]
- },
- {
- "name": "idx_pricing_status_date",
- "idxtype": "index",
- "idxfields": [
- "status",
- "effective_date"
- ]
- }
- ],
- "codes": [
- {
- "field": "pipeline_id",
- "table": "pipelines",
- "valuefield": "id",
- "textfield": "name"
- },
- {
- "field": "pricing_type",
- "table": "appcodes_kv",
- "valuefield": "k",
- "textfield": "v",
- "cond": "parentid='pricing_type'"
- },
- {
- "field": "currency",
- "table": "appcodes_kv",
- "valuefield": "k",
- "textfield": "v",
- "cond": "parentid='currency'"
- },
- {
- "field": "status",
- "table": "appcodes_kv",
- "valuefield": "k",
- "textfield": "v",
- "cond": "parentid='pricing_status'"
- }
- ]
-}
diff --git a/pipeline_ops/models/pipeline_usage_log.json b/pipeline_ops/models/pipeline_usage_log.json
deleted file mode 100644
index 1920af7..0000000
--- a/pipeline_ops/models/pipeline_usage_log.json
+++ /dev/null
@@ -1,119 +0,0 @@
-{
- "summary": [
- {
- "name": "pipeline_usage_log",
- "title": "产线调用日志表",
- "primary": [
- "id"
- ]
- }
- ],
- "fields": [
- {
- "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"
- }
- ],
- "indexes": [
- {
- "name": "idx_usagelog_pipeline",
- "idxtype": "index",
- "idxfields": [
- "pipeline_id"
- ]
- },
- {
- "name": "idx_usagelog_called_at",
- "idxtype": "index",
- "idxfields": [
- "called_at"
- ]
- },
- {
- "name": "idx_usagelog_distributor",
- "idxtype": "index",
- "idxfields": [
- "distributor_id"
- ]
- }
- ],
- "codes": [
- {
- "field": "pipeline_id",
- "table": "pipelines",
- "valuefield": "id",
- "textfield": "name"
- },
- {
- "field": "status",
- "table": "appcodes_kv",
- "valuefield": "k",
- "textfield": "v",
- "cond": "parentid='usage_status'"
- }
- ]
-}
diff --git a/pipeline_ops/mysql.ddl.sql b/pipeline_ops/mysql.ddl.sql
deleted file mode 100644
index b5f697d..0000000
--- a/pipeline_ops/mysql.ddl.sql
+++ /dev/null
@@ -1,116 +0,0 @@
-
--- models/pipeline_capacity.json
-
-
-
-
-
--- 建库时请用以下语句,支持emoji字符
--- CREATE DATABASE mydb CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
-drop table if exists pipeline_capacity;
-CREATE TABLE pipeline_capacity
-(
-
- `id` VARCHAR(32) NOT NULL comment '主键',
- `pipeline_id` VARCHAR(32) NOT NULL comment '产线ID',
- `max_concurrent` int comment '最大并发数',
- `daily_limit` int comment '每日限额',
- `monthly_limit` int comment '每月限额',
- `today_usage` int comment '今日用量',
- `month_usage` int comment '本月用量',
- `status` VARCHAR(20) DEFAULT 'active' comment '状态',
- `org_id` VARCHAR(32) DEFAULT '0' comment '所属组织',
- `updated_at` TIMESTAMP DEFAULT CURRENT_TIMESTAMP comment '更新时间'
-
-
-,primary key(id)
-
-
-)
-CHARACTER SET utf8mb4
-COLLATE utf8mb4_unicode_ci
-engine=innodb
-comment '产线容量表'
-;
-
-CREATE UNIQUE INDEX pipeline_capacity_uk_capacity_pipeline ON pipeline_capacity(pipeline_id);
-
--- models/pipeline_pricing.json
-
-
-
-
-
--- 建库时请用以下语句,支持emoji字符
--- CREATE DATABASE mydb CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
-drop table if exists pipeline_pricing;
-CREATE TABLE pipeline_pricing
-(
-
- `id` VARCHAR(32) NOT NULL comment '主键',
- `pipeline_id` VARCHAR(32) NOT NULL comment '产线ID',
- `pricing_type` VARCHAR(20) NOT NULL comment '计费方式',
- `unit_price` double(15,4) NOT NULL DEFAULT '0' comment '单价',
- `currency` VARCHAR(10) DEFAULT 'CNY' comment '货币',
- `pricing_config` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci comment '定价配置JSON',
- `effective_date` date comment '生效日期',
- `expiry_date` date comment '失效日期',
- `status` VARCHAR(20) DEFAULT 'active' comment '状态',
- `org_id` VARCHAR(32) DEFAULT '0' comment '所属组织',
- `created_by` VARCHAR(32) comment '创建人',
- `created_at` TIMESTAMP DEFAULT CURRENT_TIMESTAMP comment '创建时间',
- `updated_at` TIMESTAMP DEFAULT CURRENT_TIMESTAMP comment '更新时间'
-
-
-,primary key(id)
-
-
-)
-CHARACTER SET utf8mb4
-COLLATE utf8mb4_unicode_ci
-engine=innodb
-comment '产线定价表'
-;
-
-CREATE INDEX pipeline_pricing_idx_pricing_pipeline ON pipeline_pricing(pipeline_id);
-CREATE INDEX pipeline_pricing_idx_pricing_status_date ON pipeline_pricing(status,effective_date);
-
--- models/pipeline_usage_log.json
-
-
-
-
-
--- 建库时请用以下语句,支持emoji字符
--- CREATE DATABASE mydb CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
-drop table if exists pipeline_usage_log;
-CREATE TABLE pipeline_usage_log
-(
-
- `id` VARCHAR(32) NOT NULL comment '主键',
- `pipeline_id` VARCHAR(32) NOT NULL comment '产线ID',
- `user_id` VARCHAR(32) comment '用户ID',
- `distributor_id` VARCHAR(32) comment '分销商ID',
- `call_count` int DEFAULT '1' comment '调用次数',
- `token_input` int DEFAULT '0' comment '输入Token数',
- `token_output` int DEFAULT '0' comment '输出Token数',
- `amount` double(15,4) DEFAULT '0' comment '金额',
- `status` VARCHAR(20) comment '状态',
- `error_message` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci comment '错误信息',
- `called_at` TIMESTAMP DEFAULT CURRENT_TIMESTAMP comment '调用时间'
-
-
-,primary key(id)
-
-
-)
-CHARACTER SET utf8mb4
-COLLATE utf8mb4_unicode_ci
-engine=innodb
-comment '产线调用日志表'
-;
-
-CREATE INDEX pipeline_usage_log_idx_usagelog_pipeline ON pipeline_usage_log(pipeline_id);
-CREATE INDEX pipeline_usage_log_idx_usagelog_called_at ON pipeline_usage_log(called_at);
-CREATE INDEX pipeline_usage_log_idx_usagelog_distributor ON pipeline_usage_log(distributor_id);
-
diff --git a/pipeline_ops/pipeline_ops/__init__.py b/pipeline_ops/pipeline_ops/__init__.py
deleted file mode 100644
index f5538d3..0000000
--- a/pipeline_ops/pipeline_ops/__init__.py
+++ /dev/null
@@ -1,13 +0,0 @@
-from .init import (
- create_pipeline_pricing,
- update_pipeline_pricing,
- delete_pipeline_pricing,
- create_pipeline_capacity,
- update_pipeline_capacity,
- delete_pipeline_capacity,
- create_pipeline_usage_log,
- update_pipeline_usage_log,
- delete_pipeline_usage_log,
- increment_usage,
- load_pipeline_ops,
-)
diff --git a/pipeline_ops/pipeline_ops/init.py b/pipeline_ops/pipeline_ops/init.py
deleted file mode 100644
index b12e32f..0000000
--- a/pipeline_ops/pipeline_ops/init.py
+++ /dev/null
@@ -1,213 +0,0 @@
-import json
-from appPublic.uniqueID import getID
-from sqlor.dbpools import DBPools
-from ahserver.serverenv import ServerEnv
-from appPublic.log import debug
-from datetime import datetime
-
-MODULE_NAME = 'pipeline_ops'
-DBNAME = 'pipeline'
-
-
-def _get_sor():
- return DBPools(), DBNAME
-
-
-# ==================== pipeline_pricing ====================
-
-async def create_pipeline_pricing(params_kw):
- try:
- db, dbname = _get_sor()
- async with db.sqlorContext(dbname) as sor:
- data = params_kw.copy()
- data.pop('page', None)
- data.pop('rows', None)
- data.pop('data_filter', None)
- data['id'] = getID()
- data['created_at'] = datetime.now().strftime('%Y-%m-%d %H:%M:%S')
- data['updated_at'] = datetime.now().strftime('%Y-%m-%d %H:%M:%S')
- await sor.C('pipeline_pricing', data)
- return json.dumps({'status': 'ok', 'data': data, 'message': '创建成功'})
- except Exception as e:
- return json.dumps({'status': 'error', 'message': str(e)})
-
-
-async def update_pipeline_pricing(params_kw):
- try:
- db, dbname = _get_sor()
- async with db.sqlorContext(dbname) as sor:
- data = params_kw.copy()
- data.pop('page', None)
- data.pop('rows', None)
- data.pop('data_filter', None)
- data['updated_at'] = datetime.now().strftime('%Y-%m-%d %H:%M:%S')
- await sor.U('pipeline_pricing', data)
- return json.dumps({'status': 'ok', 'message': '更新成功'})
- except Exception as e:
- return json.dumps({'status': 'error', 'message': str(e)})
-
-
-async def delete_pipeline_pricing(params_kw):
- try:
- db, dbname = _get_sor()
- async with db.sqlorContext(dbname) as sor:
- await sor.D('pipeline_pricing', {'id': params_kw['id']})
- return json.dumps({'status': 'ok', 'message': '删除成功'})
- except Exception as e:
- return json.dumps({'status': 'error', 'message': str(e)})
-
-
-# ==================== pipeline_capacity ====================
-
-async def create_pipeline_capacity(params_kw):
- try:
- db, dbname = _get_sor()
- async with db.sqlorContext(dbname) as sor:
- data = params_kw.copy()
- data.pop('page', None)
- data.pop('rows', None)
- data.pop('data_filter', None)
- data['id'] = getID()
- data['created_at'] = datetime.now().strftime('%Y-%m-%d %H:%M:%S')
- data['updated_at'] = datetime.now().strftime('%Y-%m-%d %H:%M:%S')
- await sor.C('pipeline_capacity', data)
- return json.dumps({'status': 'ok', 'data': data, 'message': '创建成功'})
- except Exception as e:
- return json.dumps({'status': 'error', 'message': str(e)})
-
-
-async def update_pipeline_capacity(params_kw):
- try:
- db, dbname = _get_sor()
- async with db.sqlorContext(dbname) as sor:
- data = params_kw.copy()
- data.pop('page', None)
- data.pop('rows', None)
- data.pop('data_filter', None)
- data['updated_at'] = datetime.now().strftime('%Y-%m-%d %H:%M:%S')
- await sor.U('pipeline_capacity', data)
- return json.dumps({'status': 'ok', 'message': '更新成功'})
- except Exception as e:
- return json.dumps({'status': 'error', 'message': str(e)})
-
-
-async def delete_pipeline_capacity(params_kw):
- try:
- db, dbname = _get_sor()
- async with db.sqlorContext(dbname) as sor:
- await sor.D('pipeline_capacity', {'id': params_kw['id']})
- return json.dumps({'status': 'ok', 'message': '删除成功'})
- except Exception as e:
- return json.dumps({'status': 'error', 'message': str(e)})
-
-
-# ==================== pipeline_usage_log ====================
-
-async def create_pipeline_usage_log(params_kw):
- try:
- db, dbname = _get_sor()
- async with db.sqlorContext(dbname) as sor:
- data = params_kw.copy()
- data.pop('page', None)
- data.pop('rows', None)
- data.pop('data_filter', None)
- data['id'] = getID()
- data['created_at'] = datetime.now().strftime('%Y-%m-%d %H:%M:%S')
- data['updated_at'] = datetime.now().strftime('%Y-%m-%d %H:%M:%S')
- await sor.C('pipeline_usage_log', data)
- return json.dumps({'status': 'ok', 'data': data, 'message': '创建成功'})
- except Exception as e:
- return json.dumps({'status': 'error', 'message': str(e)})
-
-
-async def update_pipeline_usage_log(params_kw):
- try:
- db, dbname = _get_sor()
- async with db.sqlorContext(dbname) as sor:
- data = params_kw.copy()
- data.pop('page', None)
- data.pop('rows', None)
- data.pop('data_filter', None)
- data['updated_at'] = datetime.now().strftime('%Y-%m-%d %H:%M:%S')
- await sor.U('pipeline_usage_log', data)
- return json.dumps({'status': 'ok', 'message': '更新成功'})
- except Exception as e:
- return json.dumps({'status': 'error', 'message': str(e)})
-
-
-async def delete_pipeline_usage_log(params_kw):
- try:
- db, dbname = _get_sor()
- async with db.sqlorContext(dbname) as sor:
- await sor.D('pipeline_usage_log', {'id': params_kw['id']})
- return json.dumps({'status': 'ok', 'message': '删除成功'})
- except Exception as e:
- return json.dumps({'status': 'error', 'message': str(e)})
-
-
-# ==================== Special: increment_usage ====================
-
-async def increment_usage(params_kw):
- """Increment usage for a pipeline. Increments the usage_count field."""
- try:
- db, dbname = _get_sor()
- async with db.sqlorContext(dbname) as sor:
- pipeline_id = params_kw.get('pipeline_id', '')
- if not pipeline_id:
- return json.dumps({'status': 'error', 'message': 'pipeline_id is required'})
- # Get current usage
- rows = await sor.sqlExe(
- 'select usage_count from pipeline_usage_log where pipeline_id = :pipeline_id order by created_at desc limit 1',
- {'pipeline_id': pipeline_id}
- )
- current_count = 0
- if rows and len(rows) > 0:
- current_count = rows[0].get('usage_count', 0) or 0
- new_count = current_count + 1
- data = {
- 'id': getID(),
- 'pipeline_id': pipeline_id,
- 'usage_count': new_count,
- 'created_at': datetime.now().strftime('%Y-%m-%d %H:%M:%S'),
- 'updated_at': datetime.now().strftime('%Y-%m-%d %H:%M:%S')
- }
- await sor.C('pipeline_usage_log', data)
- return json.dumps({'status': 'ok', 'data': data, 'message': '使用次数已增加'})
- except Exception as e:
- return json.dumps({'status': 'error', 'message': str(e)})
-
-
-# ==================== Module Loader ====================
-
-def load_pipeline_ops():
- env = ServerEnv()
-
- # pipeline_pricing
- env.create_pipeline_pricing = create_pipeline_pricing
- env.create_pipeline_pricings = create_pipeline_pricing
- env.update_pipeline_pricing = update_pipeline_pricing
- env.update_pipeline_pricings = update_pipeline_pricing
- env.delete_pipeline_pricing = delete_pipeline_pricing
- env.delete_pipeline_pricings = delete_pipeline_pricing
-
- # pipeline_capacity
- env.create_pipeline_capacity = create_pipeline_capacity
- env.create_pipeline_capacitys = create_pipeline_capacity
- env.update_pipeline_capacity = update_pipeline_capacity
- env.update_pipeline_capacitys = update_pipeline_capacity
- env.delete_pipeline_capacity = delete_pipeline_capacity
- env.delete_pipeline_capacitys = delete_pipeline_capacity
-
- # pipeline_usage_log
- env.create_pipeline_usage_log = create_pipeline_usage_log
- env.create_pipeline_usage_logs = create_pipeline_usage_log
- env.update_pipeline_usage_log = update_pipeline_usage_log
- env.update_pipeline_usage_logs = update_pipeline_usage_log
- env.delete_pipeline_usage_log = delete_pipeline_usage_log
- env.delete_pipeline_usage_logs = delete_pipeline_usage_log
-
- # special functions
- env.increment_usage = increment_usage
-
- debug(f'{MODULE_NAME} loaded successfully')
- return True
diff --git a/pipeline_ops/pyproject.toml b/pipeline_ops/pyproject.toml
deleted file mode 100644
index 5e54f12..0000000
--- a/pipeline_ops/pyproject.toml
+++ /dev/null
@@ -1,9 +0,0 @@
-[project]
-name = "pipeline_ops"
-version = "0.1.0"
-description = "产线运维模块"
-dependencies = ["sqlor"]
-
-[tool.setuptools.packages.find]
-where = ["."]
-include = ["pipeline_ops*"]
diff --git a/pipeline_ops/scripts/load_path.py b/pipeline_ops/scripts/load_path.py
deleted file mode 100644
index 69cf30d..0000000
--- a/pipeline_ops/scripts/load_path.py
+++ /dev/null
@@ -1,62 +0,0 @@
-#!/usr/bin/env python3
-"""RBAC path registration for pipeline_ops module."""
-import os, sys, subprocess
-
-MOD = "pipeline_ops"
-
-PATHS_ANY = [
- f"/{MOD}/index.ui",
-]
-
-PATHS_LOGINED = [
- f"/{MOD}",
- f"/{MOD}/api/ops_dashboard_data.dspy",
- # Pricing
- f"/{MOD}/pipeline_pricing/index.ui",
- f"/{MOD}/pipeline_pricing/get_pipeline_pricing.dspy",
- f"/{MOD}/pipeline_pricing/add_pipeline_pricing.dspy",
- f"/{MOD}/pipeline_pricing/update_pipeline_pricing.dspy",
- f"/{MOD}/pipeline_pricing/delete_pipeline_pricing.dspy",
- # Capacity
- f"/{MOD}/pipeline_capacity/index.ui",
- f"/{MOD}/pipeline_capacity/get_pipeline_capacity.dspy",
- f"/{MOD}/pipeline_capacity/add_pipeline_capacity.dspy",
- f"/{MOD}/pipeline_capacity/update_pipeline_capacity.dspy",
- f"/{MOD}/pipeline_capacity/delete_pipeline_capacity.dspy",
- # Usage Log
- f"/{MOD}/pipeline_usage_log/index.ui",
- f"/{MOD}/pipeline_usage_log/get_pipeline_usage_log.dspy",
- f"/{MOD}/pipeline_usage_log/add_pipeline_usage_log.dspy",
- f"/{MOD}/pipeline_usage_log/update_pipeline_usage_log.dspy",
- f"/{MOD}/pipeline_usage_log/delete_pipeline_usage_log.dspy",
- # API
- f"/{MOD}/api/pipeline_pricing_create.dspy",
- f"/{MOD}/api/pipeline_pricing_update.dspy",
- f"/{MOD}/api/pipeline_pricing_delete.dspy",
- f"/{MOD}/api/pipeline_capacity_create.dspy",
- f"/{MOD}/api/pipeline_capacity_update.dspy",
- f"/{MOD}/api/pipeline_capacity_delete.dspy",
- f"/{MOD}/api/pipeline_usage_log_create.dspy",
- f"/{MOD}/api/pipeline_usage_log_update.dspy",
- f"/{MOD}/api/pipeline_usage_log_delete.dspy",
- f"/{MOD}/api/get_search_pipeline_id.dspy",
-]
-
-
-def main():
- root = os.path.expanduser("~/pipeline")
- set_perm = os.path.join(root, "set_role_perm.py")
- if not os.path.isfile(set_perm):
- print("ERROR: pipeline root not found"); sys.exit(1)
- py = sys.executable
- count = 0
- for role, paths in [("any", PATHS_ANY), ("logined", PATHS_LOGINED)]:
- for path in paths:
- r = subprocess.run([py, set_perm, role, path], capture_output=True, text=True, cwd=root)
- if r.returncode == 0: count += 1
- else: print(f" WARN: {path}")
- print(f"Registered {count}/{len(PATHS_ANY)+len(PATHS_LOGINED)} paths for {MOD}")
-
-
-if __name__ == "__main__":
- main()
diff --git a/pipeline_ops/wwwroot/api/get_search_pipeline_id.dspy b/pipeline_ops/wwwroot/api/get_search_pipeline_id.dspy
deleted file mode 100644
index 6573cb4..0000000
--- a/pipeline_ops/wwwroot/api/get_search_pipeline_id.dspy
+++ /dev/null
@@ -1,8 +0,0 @@
-data = [{'value': '', 'text': '全部'}]
-try:
- async with get_sor_context(request._run_ns, 'pipeline') as sor:
- rows = await sor.sqlExe('select id as value, name as text from pipelines order by name', {})
- data.extend(list(rows))
-except Exception as e:
- debug('get_search_pipeline_id error: ' + str(e))
-return json.dumps(data, ensure_ascii=False)
\ No newline at end of file
diff --git a/pipeline_ops/wwwroot/api/ops_dashboard_data.dspy b/pipeline_ops/wwwroot/api/ops_dashboard_data.dspy
deleted file mode 100644
index 2ddae22..0000000
--- a/pipeline_ops/wwwroot/api/ops_dashboard_data.dspy
+++ /dev/null
@@ -1,61 +0,0 @@
-"""
-Operations Dashboard Data: task queue, human tasks, stats
-"""
-from sqlor.dbpools import DBPools
-
-async def main():
- dbname = get_module_dbname('pipeline_core')
-
- async with DBPools().sqlorContext(dbname) as sor:
- # Task stats by state
- task_stats = await sor.sqlExe("""
- SELECT state, COUNT(*) as cnt FROM pipeline_tasks
- GROUP BY state ORDER BY cnt DESC
- """, {})
-
- stats = {'submitted':0, 'running':0, 'completed':0, 'failed':0, 'cancelled':0}
- for r in task_stats:
- stats[r.state] = r.cnt
-
- # Recent tasks (last 20)
- tasks = await sor.sqlExe("""
- SELECT t.id, t.title, t.state, t.pipeline_id, t.created_at
- FROM pipeline_tasks t
- ORDER BY t.created_at DESC LIMIT 20
- """, {})
- task_list = []
- for r in tasks:
- task_list.append({
- 'id': r.id, 'title': r.title, 'state': r.state,
- 'pipeline_id': r.pipeline_id, 'created_at': str(r.created_at)[:19]
- })
-
- # Pending human tasks
- human_tasks = await sor.sqlExe("""
- SELECT h.id, h.task_id, h.task_type, h.step_name, h.status,
- h.assignee_role, h.created_at, h.expired_at,
- t.title as task_title
- FROM pipeline_human_tasks h
- LEFT JOIN pipeline_tasks t ON h.task_id = t.id
- WHERE h.status IN ('pending', 'in_progress')
- ORDER BY h.created_at DESC LIMIT 20
- """, {})
-
- human_list = []
- for r in human_tasks:
- human_list.append({
- 'id': r.id, 'task_id': r.task_id, 'task_type': r.task_type,
- 'step_name': r.step_name, 'status': r.status,
- 'assignee_role': r.assignee_role, 'task_title': r.task_title,
- 'created_at': str(r.created_at)[:19],
- 'expired_at': str(r.expired_at)[:19] if r.expired_at else None
- })
-
- return {
- 'stats': stats,
- 'tasks': task_list,
- 'human_tasks': human_list,
- 'total_tasks': sum(stats.values()),
- 'active_tasks': stats['running'],
- 'pending_reviews': len(human_list)
- }
diff --git a/pipeline_ops/wwwroot/api/pipeline_capacity_create.dspy b/pipeline_ops/wwwroot/api/pipeline_capacity_create.dspy
deleted file mode 100644
index ce950ae..0000000
--- a/pipeline_ops/wwwroot/api/pipeline_capacity_create.dspy
+++ /dev/null
@@ -1,5 +0,0 @@
-func = create_pipeline_capacity
-if func is None:
- return json.dumps({'status': 'error', 'message': 'function not found'})
-result = await func(params_kw)
-return result
\ No newline at end of file
diff --git a/pipeline_ops/wwwroot/api/pipeline_capacity_delete.dspy b/pipeline_ops/wwwroot/api/pipeline_capacity_delete.dspy
deleted file mode 100644
index 0c2c567..0000000
--- a/pipeline_ops/wwwroot/api/pipeline_capacity_delete.dspy
+++ /dev/null
@@ -1,5 +0,0 @@
-func = delete_pipeline_capacity
-if func is None:
- return json.dumps({'status': 'error', 'message': 'function not found'})
-result = await func(params_kw)
-return result
\ No newline at end of file
diff --git a/pipeline_ops/wwwroot/api/pipeline_capacity_update.dspy b/pipeline_ops/wwwroot/api/pipeline_capacity_update.dspy
deleted file mode 100644
index d3bd146..0000000
--- a/pipeline_ops/wwwroot/api/pipeline_capacity_update.dspy
+++ /dev/null
@@ -1,5 +0,0 @@
-func = update_pipeline_capacity
-if func is None:
- return json.dumps({'status': 'error', 'message': 'function not found'})
-result = await func(params_kw)
-return result
\ No newline at end of file
diff --git a/pipeline_ops/wwwroot/api/pipeline_pricing_create.dspy b/pipeline_ops/wwwroot/api/pipeline_pricing_create.dspy
deleted file mode 100644
index 43a148f..0000000
--- a/pipeline_ops/wwwroot/api/pipeline_pricing_create.dspy
+++ /dev/null
@@ -1,5 +0,0 @@
-func = create_pipeline_pricing
-if func is None:
- return json.dumps({'status': 'error', 'message': 'function not found'})
-result = await func(params_kw)
-return result
\ No newline at end of file
diff --git a/pipeline_ops/wwwroot/api/pipeline_pricing_delete.dspy b/pipeline_ops/wwwroot/api/pipeline_pricing_delete.dspy
deleted file mode 100644
index ff40702..0000000
--- a/pipeline_ops/wwwroot/api/pipeline_pricing_delete.dspy
+++ /dev/null
@@ -1,5 +0,0 @@
-func = delete_pipeline_pricing
-if func is None:
- return json.dumps({'status': 'error', 'message': 'function not found'})
-result = await func(params_kw)
-return result
\ No newline at end of file
diff --git a/pipeline_ops/wwwroot/api/pipeline_pricing_update.dspy b/pipeline_ops/wwwroot/api/pipeline_pricing_update.dspy
deleted file mode 100644
index e066fe8..0000000
--- a/pipeline_ops/wwwroot/api/pipeline_pricing_update.dspy
+++ /dev/null
@@ -1,5 +0,0 @@
-func = update_pipeline_pricing
-if func is None:
- return json.dumps({'status': 'error', 'message': 'function not found'})
-result = await func(params_kw)
-return result
\ No newline at end of file
diff --git a/pipeline_ops/wwwroot/api/pipeline_usage_log_create.dspy b/pipeline_ops/wwwroot/api/pipeline_usage_log_create.dspy
deleted file mode 100644
index 53018d9..0000000
--- a/pipeline_ops/wwwroot/api/pipeline_usage_log_create.dspy
+++ /dev/null
@@ -1,5 +0,0 @@
-func = create_pipeline_usage_log
-if func is None:
- return json.dumps({'status': 'error', 'message': 'function not found'})
-result = await func(params_kw)
-return result
\ No newline at end of file
diff --git a/pipeline_ops/wwwroot/api/pipeline_usage_log_delete.dspy b/pipeline_ops/wwwroot/api/pipeline_usage_log_delete.dspy
deleted file mode 100644
index 1ea0380..0000000
--- a/pipeline_ops/wwwroot/api/pipeline_usage_log_delete.dspy
+++ /dev/null
@@ -1,5 +0,0 @@
-func = delete_pipeline_usage_log
-if func is None:
- return json.dumps({'status': 'error', 'message': 'function not found'})
-result = await func(params_kw)
-return result
\ No newline at end of file
diff --git a/pipeline_ops/wwwroot/api/pipeline_usage_log_update.dspy b/pipeline_ops/wwwroot/api/pipeline_usage_log_update.dspy
deleted file mode 100644
index 6e5b2f4..0000000
--- a/pipeline_ops/wwwroot/api/pipeline_usage_log_update.dspy
+++ /dev/null
@@ -1,5 +0,0 @@
-func = update_pipeline_usage_log
-if func is None:
- return json.dumps({'status': 'error', 'message': 'function not found'})
-result = await func(params_kw)
-return result
\ No newline at end of file
diff --git a/pipeline_ops/wwwroot/index.ui b/pipeline_ops/wwwroot/index.ui
deleted file mode 100644
index e3387a0..0000000
--- a/pipeline_ops/wwwroot/index.ui
+++ /dev/null
@@ -1,123 +0,0 @@
-{
- "widgettype": "VBox",
- "options": {"width": "100%", "height": "100%", "padding": "24px", "gap": "20px"},
- "subwidgets": [
- {
- "widgettype": "HBox",
- "options": {"alignItems": "center", "gap": "12px"},
- "subwidgets": [
- {"widgettype": "Title2", "options": {"text": "产线运营中心"}},
- {"widgettype": "Text", "options": {"text": "任务队列、审批管理、执行监控", "cfontsize": 1.1, "color": "#888"}}
- ]
- },
- {
- "widgettype": "ResponsableBox",
- "options": {"gap": "16px", "minWidth": "150px"},
- "subwidgets": [
- {
- "widgettype": "VBox",
- "options": {"bgcolor": "#1e293b", "padding": "20px", "borderRadius": "12px", "gap": "4px", "border": "1px solid #334155", "cwidth": 16, "alignItems": "center"},
- "subwidgets": [
- {"widgettype": "Text", "options": {"text": "-", "cfontsize": 2, "color": "#60a5fa", "fontWeight": "bold"}},
- {"widgettype": "Text", "options": {"text": "已提交", "cfontsize": 0.9, "color": "#94a3b8"}}
- ]
- },
- {
- "widgettype": "VBox",
- "options": {"bgcolor": "#1e293b", "padding": "20px", "borderRadius": "12px", "gap": "4px", "border": "1px solid #334155", "cwidth": 16, "alignItems": "center"},
- "subwidgets": [
- {"widgettype": "Text", "options": {"text": "-", "cfontsize": 2, "color": "#fbbf24", "fontWeight": "bold"}},
- {"widgettype": "Text", "options": {"text": "运行中", "cfontsize": 0.9, "color": "#94a3b8"}}
- ]
- },
- {
- "widgettype": "VBox",
- "options": {"bgcolor": "#1e293b", "padding": "20px", "borderRadius": "12px", "gap": "4px", "border": "1px solid #334155", "cwidth": 16, "alignItems": "center"},
- "subwidgets": [
- {"widgettype": "Text", "options": {"text": "-", "cfontsize": 2, "color": "#4ade80", "fontWeight": "bold"}},
- {"widgettype": "Text", "options": {"text": "已完成", "cfontsize": 0.9, "color": "#94a3b8"}}
- ]
- },
- {
- "widgettype": "VBox",
- "options": {"bgcolor": "#1e293b", "padding": "20px", "borderRadius": "12px", "gap": "4px", "border": "1px solid #334155", "cwidth": 16, "alignItems": "center"},
- "subwidgets": [
- {"widgettype": "Text", "options": {"text": "-", "cfontsize": 2, "color": "#f87171", "fontWeight": "bold"}},
- {"widgettype": "Text", "options": {"text": "失败", "cfontsize": 0.9, "color": "#94a3b8"}}
- ]
- },
- {
- "widgettype": "VBox",
- "options": {"bgcolor": "#1e293b", "padding": "20px", "borderRadius": "12px", "gap": "4px", "border": "1px solid #334155", "cwidth": 16, "alignItems": "center"},
- "subwidgets": [
- {"widgettype": "Text", "options": {"text": "-", "cfontsize": 2, "color": "#a78bfa", "fontWeight": "bold"}},
- {"widgettype": "Text", "options": {"text": "待审批", "cfontsize": 0.9, "color": "#94a3b8"}}
- ]
- },
- {
- "widgettype": "VBox",
- "options": {"bgcolor": "#1e293b", "padding": "20px", "borderRadius": "12px", "gap": "4px", "border": "1px solid #334155", "cwidth": 16, "alignItems": "center"},
- "subwidgets": [
- {"widgettype": "Text", "options": {"text": "-", "cfontsize": 2, "color": "#e2e8f0", "fontWeight": "bold"}},
- {"widgettype": "Text", "options": {"text": "总任务", "cfontsize": 0.9, "color": "#94a3b8"}}
- ]
- }
- ]
- },
- {
- "widgettype": "ResponsableBox",
- "options": {"gap": "16px", "minWidth": "400px"},
- "subwidgets": [
- {
- "widgettype": "VBox",
- "options": {"bgcolor": "#1e293b", "padding": "20px", "borderRadius": "12px", "gap": "12px", "border": "1px solid #334155", "cwidth": 60},
- "subwidgets": [
- {"widgettype": "Title3", "options": {"text": "近期任务"}},
- {"widgettype": "Text", "options": {"text": "暂无任务,提交产线任务后将在此显示", "cfontsize": 0.9, "color": "#64748b", "padding": "20px 0"}}
- ]
- },
- {
- "widgettype": "VBox",
- "options": {"bgcolor": "#1e293b", "padding": "20px", "borderRadius": "12px", "gap": "12px", "border": "1px solid #334155", "cwidth": 40},
- "subwidgets": [
- {"widgettype": "Title3", "options": {"text": "待审批队列"}},
- {"widgettype": "Text", "options": {"text": "暂无审批任务", "cfontsize": 0.9, "color": "#64748b", "padding": "20px 0"}}
- ]
- }
- ]
- },
- {
- "widgettype": "ResponsableBox",
- "options": {"gap": "16px", "minWidth": "180px"},
- "subwidgets": [
- {
- "widgettype": "VBox",
- "options": {"css": "card", "cwidth": 23, "cheight": 10, "padding": "24px", "cursor": "pointer", "bgcolor": "#1e293b", "border": "1px solid #334155"},
- "binds": [{"wid": "self", "event": "click", "actiontype": "urlwidget", "target": "app.main_content", "options": {"url": "{{entire_url('/pipeline_ops/pipeline_pricing/')}}"}, "mode": "replace"}],
- "subwidgets": [
- {"widgettype": "Title3", "options": {"text": "定价管理", "marginBottom": "4px"}},
- {"widgettype": "Text", "options": {"text": "管理产线计费方式和价格", "cfontsize": 0.9, "color": "#94a3b8"}}
- ]
- },
- {
- "widgettype": "VBox",
- "options": {"css": "card", "cwidth": 23, "cheight": 10, "padding": "24px", "cursor": "pointer", "bgcolor": "#1e293b", "border": "1px solid #334155"},
- "binds": [{"wid": "self", "event": "click", "actiontype": "urlwidget", "target": "app.main_content", "options": {"url": "{{entire_url('/pipeline_ops/pipeline_capacity/')}}"}, "mode": "replace"}],
- "subwidgets": [
- {"widgettype": "Title3", "options": {"text": "供应量管理", "marginBottom": "4px"}},
- {"widgettype": "Text", "options": {"text": "配置产线并发和调用限额", "cfontsize": 0.9, "color": "#94a3b8"}}
- ]
- },
- {
- "widgettype": "VBox",
- "options": {"css": "card", "cwidth": 23, "cheight": 10, "padding": "24px", "cursor": "pointer", "bgcolor": "#1e293b", "border": "1px solid #334155"},
- "binds": [{"wid": "self", "event": "click", "actiontype": "urlwidget", "target": "app.main_content", "options": {"url": "{{entire_url('/pipeline_ops/pipeline_usage_log/')}}"}, "mode": "replace"}],
- "subwidgets": [
- {"widgettype": "Title3", "options": {"text": "使用记录", "marginBottom": "4px"}},
- {"widgettype": "Text", "options": {"text": "查看产线调用和消费记录", "cfontsize": 0.9, "color": "#94a3b8"}}
- ]
- }
- ]
- }
- ]
-}
diff --git a/pipeline_ops/wwwroot/pipeline_capacity/add_pipeline_capacity.dspy b/pipeline_ops/wwwroot/pipeline_capacity/add_pipeline_capacity.dspy
deleted file mode 100644
index 488d631..0000000
--- a/pipeline_ops/wwwroot/pipeline_capacity/add_pipeline_capacity.dspy
+++ /dev/null
@@ -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"
- }
-}
\ No newline at end of file
diff --git a/pipeline_ops/wwwroot/pipeline_capacity/delete_pipeline_capacity.dspy b/pipeline_ops/wwwroot/pipeline_capacity/delete_pipeline_capacity.dspy
deleted file mode 100644
index 9ab1448..0000000
--- a/pipeline_ops/wwwroot/pipeline_capacity/delete_pipeline_capacity.dspy
+++ /dev/null
@@ -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"
- }
-}
\ No newline at end of file
diff --git a/pipeline_ops/wwwroot/pipeline_capacity/get_pipeline_capacity.dspy b/pipeline_ops/wwwroot/pipeline_capacity/get_pipeline_capacity.dspy
deleted file mode 100644
index bbb9db4..0000000
--- a/pipeline_ops/wwwroot/pipeline_capacity/get_pipeline_capacity.dspy
+++ /dev/null
@@ -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":[]
-}
\ No newline at end of file
diff --git a/pipeline_ops/wwwroot/pipeline_capacity/index.ui b/pipeline_ops/wwwroot/pipeline_capacity/index.ui
deleted file mode 100644
index b23b9fe..0000000
--- a/pipeline_ops/wwwroot/pipeline_capacity/index.ui
+++ /dev/null
@@ -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":[]
-
-}]
-}
\ No newline at end of file
diff --git a/pipeline_ops/wwwroot/pipeline_capacity/update_pipeline_capacity.dspy b/pipeline_ops/wwwroot/pipeline_capacity/update_pipeline_capacity.dspy
deleted file mode 100644
index 68f644b..0000000
--- a/pipeline_ops/wwwroot/pipeline_capacity/update_pipeline_capacity.dspy
+++ /dev/null
@@ -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"
- }
-}
\ No newline at end of file
diff --git a/pipeline_ops/wwwroot/pipeline_pricing/add_pipeline_pricing.dspy b/pipeline_ops/wwwroot/pipeline_pricing/add_pipeline_pricing.dspy
deleted file mode 100644
index f0c8e09..0000000
--- a/pipeline_ops/wwwroot/pipeline_pricing/add_pipeline_pricing.dspy
+++ /dev/null
@@ -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"
- }
-}
\ No newline at end of file
diff --git a/pipeline_ops/wwwroot/pipeline_pricing/delete_pipeline_pricing.dspy b/pipeline_ops/wwwroot/pipeline_pricing/delete_pipeline_pricing.dspy
deleted file mode 100644
index 426926c..0000000
--- a/pipeline_ops/wwwroot/pipeline_pricing/delete_pipeline_pricing.dspy
+++ /dev/null
@@ -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"
- }
-}
\ No newline at end of file
diff --git a/pipeline_ops/wwwroot/pipeline_pricing/get_pipeline_pricing.dspy b/pipeline_ops/wwwroot/pipeline_pricing/get_pipeline_pricing.dspy
deleted file mode 100644
index a5d4dcb..0000000
--- a/pipeline_ops/wwwroot/pipeline_pricing/get_pipeline_pricing.dspy
+++ /dev/null
@@ -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":[]
-}
\ No newline at end of file
diff --git a/pipeline_ops/wwwroot/pipeline_pricing/index.ui b/pipeline_ops/wwwroot/pipeline_pricing/index.ui
deleted file mode 100644
index 924fd5d..0000000
--- a/pipeline_ops/wwwroot/pipeline_pricing/index.ui
+++ /dev/null
@@ -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":[]
-
-}]
-}
\ No newline at end of file
diff --git a/pipeline_ops/wwwroot/pipeline_pricing/update_pipeline_pricing.dspy b/pipeline_ops/wwwroot/pipeline_pricing/update_pipeline_pricing.dspy
deleted file mode 100644
index d19427c..0000000
--- a/pipeline_ops/wwwroot/pipeline_pricing/update_pipeline_pricing.dspy
+++ /dev/null
@@ -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"
- }
-}
\ No newline at end of file
diff --git a/pipeline_ops/wwwroot/pipeline_usage_log/add_pipeline_usage_log.dspy b/pipeline_ops/wwwroot/pipeline_usage_log/add_pipeline_usage_log.dspy
deleted file mode 100644
index 86ac26d..0000000
--- a/pipeline_ops/wwwroot/pipeline_usage_log/add_pipeline_usage_log.dspy
+++ /dev/null
@@ -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"
- }
-}
\ No newline at end of file
diff --git a/pipeline_ops/wwwroot/pipeline_usage_log/delete_pipeline_usage_log.dspy b/pipeline_ops/wwwroot/pipeline_usage_log/delete_pipeline_usage_log.dspy
deleted file mode 100644
index b93f388..0000000
--- a/pipeline_ops/wwwroot/pipeline_usage_log/delete_pipeline_usage_log.dspy
+++ /dev/null
@@ -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"
- }
-}
\ No newline at end of file
diff --git a/pipeline_ops/wwwroot/pipeline_usage_log/get_pipeline_usage_log.dspy b/pipeline_ops/wwwroot/pipeline_usage_log/get_pipeline_usage_log.dspy
deleted file mode 100644
index fdd682c..0000000
--- a/pipeline_ops/wwwroot/pipeline_usage_log/get_pipeline_usage_log.dspy
+++ /dev/null
@@ -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":[]
-}
\ No newline at end of file
diff --git a/pipeline_ops/wwwroot/pipeline_usage_log/index.ui b/pipeline_ops/wwwroot/pipeline_usage_log/index.ui
deleted file mode 100644
index 52c8778..0000000
--- a/pipeline_ops/wwwroot/pipeline_usage_log/index.ui
+++ /dev/null
@@ -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":[]
-
-}]
-}
\ No newline at end of file
diff --git a/pipeline_ops/wwwroot/pipeline_usage_log/update_pipeline_usage_log.dspy b/pipeline_ops/wwwroot/pipeline_usage_log/update_pipeline_usage_log.dspy
deleted file mode 100644
index 4f88a2e..0000000
--- a/pipeline_ops/wwwroot/pipeline_usage_log/update_pipeline_usage_log.dspy
+++ /dev/null
@@ -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"
- }
-}
\ No newline at end of file