- Updated core.py - Updated base.ui - Added new API files: check_tables, customer_pool_list, customers CRUD, handover_list - Added new UI/DSPY files: customer_edit, customer_list, customer_pool, handover_list
20 lines
759 B
Python
20 lines
759 B
Python
#!/usr/bin/env python3
|
|
# -*- coding: utf-8 -*-
|
|
import json
|
|
result = {'keys': [], 'rows': []}
|
|
try:
|
|
dbname = get_module_dbname('customer_management')
|
|
async with DBPools().sqlorContext(dbname) as sor:
|
|
ns = {'page': 1, 'rows': 50, 'sort': 'TABLE_NAME'}
|
|
sql = "SELECT TABLE_NAME FROM information_schema.TABLES WHERE TABLE_SCHEMA='crm_db'"
|
|
rows = await sor.sqlExe(sql, ns)
|
|
if isinstance(rows, dict):
|
|
rows = rows.get('rows', [])
|
|
if rows:
|
|
result['keys'] = list(dict(rows[0]).keys())
|
|
result['rows'] = [list(dict(r).values()) for r in rows]
|
|
result['success'] = True
|
|
except Exception as e:
|
|
result['error'] = str(e)
|
|
return json.dumps(result, ensure_ascii=False, default=str)
|