fix: product_category create/update/delete去除json.dumps和import; create补充resource_module
This commit is contained in:
parent
7bdcb8cf5f
commit
5d77e6e20a
@ -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
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user