diff --git a/wwwroot/api/product_category_create.dspy b/wwwroot/api/product_category_create.dspy index b7806d3..65561ca 100644 --- a/wwwroot/api/product_category_create.dspy +++ b/wwwroot/api/product_category_create.dspy @@ -34,7 +34,7 @@ try: # Ensure all table fields have values, filter out unknown fields all_fields = ['id', 'parent_id', 'name', 'description', 'has_product', - 'product_type', 'product_type_title', 'sort_order', 'icon', + 'product_type', 'product_type_title', 'resource_module', 'sort_order', 'icon', 'status', 'org_id', 'created_by', 'created_at', 'updated_at'] fields = {} for k in all_fields: @@ -53,4 +53,4 @@ try: except Exception as e: result['options'] = {'title': 'Error', 'message': '创建失败: ' + str(e), 'type': 'error'} -return json.dumps(result, ensure_ascii=False) +return result diff --git a/wwwroot/api/product_category_delete.dspy b/wwwroot/api/product_category_delete.dspy index 993dd72..bf1253e 100644 --- a/wwwroot/api/product_category_delete.dspy +++ b/wwwroot/api/product_category_delete.dspy @@ -1,6 +1,3 @@ -#!/usr/bin/env python3 -import json - result = {'widgettype': 'Message', 'options': {'title': 'Error', 'message': 'Invalid', 'type': 'error'}} try: @@ -28,8 +25,8 @@ try: {'id': record_id, 'org_id': org_id} ) if children and children[0]['cnt'] > 0: - result = {'widgettype': 'Message', 'options': {'title': 'Error', 'message': '该类别下有子类别,无法删除', 'type': 'error'}} - return json.dumps(result, ensure_ascii=False) + result = {'widgettype': 'Error', 'options': {'title': 'Error', 'message': '该类别下有子类别,无法删除', 'timeout': 3, 'cwidth': 16, 'cheight': 9}} + return result # Check products products = await sor.sqlExe( @@ -37,8 +34,8 @@ try: {'id': record_id, 'org_id': org_id} ) if products and products[0]['cnt'] > 0: - result = {'widgettype': 'Message', 'options': {'title': 'Error', 'message': '该类别下有产品,无法删除', 'type': 'error'}} - return json.dumps(result, ensure_ascii=False) + result = {'widgettype': 'Error', 'options': {'title': 'Error', 'message': '该类别下有产品,无法删除', 'timeout': 3, 'cwidth': 16, 'cheight': 9}} + return result await sor.D('product_category', {'id': record_id, 'org_id': org_id}) @@ -47,4 +44,4 @@ try: except Exception as e: result['options'] = {'title': 'Error', 'message': '删除失败: ' + str(e), 'type': 'error'} -return json.dumps(result, ensure_ascii=False) +return result diff --git a/wwwroot/api/product_category_update.dspy b/wwwroot/api/product_category_update.dspy index 1402547..20258d1 100644 --- a/wwwroot/api/product_category_update.dspy +++ b/wwwroot/api/product_category_update.dspy @@ -40,4 +40,4 @@ try: except Exception as e: result['options'] = {'title': 'Error', 'message': '更新失败: ' + str(e), 'type': 'error'} -return json.dumps(result, ensure_ascii=False) +return result