fix: CRUD endpoint return format - remove json.dumps, use widgettype format

This commit is contained in:
yumoqing 2026-07-03 14:53:32 +08:00
parent ed1282e59e
commit e59c7b1f6c
12 changed files with 12 additions and 24 deletions

View File

@ -1,4 +1,3 @@
import json
data = {}
for key in ['template_id', 'customer_id', 'code', 'source', 'remark', 'valid_from', 'valid_to']:
@ -7,4 +6,4 @@ for key in ['template_id', 'customer_id', 'code', 'source', 'remark', 'valid_fro
data[key] = val
result = await create_voucher_instance(data)
return json.dumps(result)
return result

View File

@ -1,5 +1,4 @@
import json
conditions = {'id': params_kw.get('id', '')}
result = await delete_voucher_instance(conditions)
return json.dumps(result)
return result

View File

@ -1,4 +1,3 @@
import json
conditions = {'id': params_kw.get('id', '')}
data = {}
@ -8,4 +7,4 @@ for key in ['template_id', 'customer_id', 'code', 'status', 'source', 'remark']:
data[key] = val
result = await update_voucher_instance(conditions, data)
return json.dumps(result)
return result

View File

@ -1,4 +1,3 @@
import json
data = {}
for key in ['template_id', 'rule_type', 'rule_config', 'enabled', 'sort_order', 'remark']:
@ -7,4 +6,4 @@ for key in ['template_id', 'rule_type', 'rule_config', 'enabled', 'sort_order',
data[key] = val
result = await create_voucher_rule(data)
return json.dumps(result)
return result

View File

@ -1,5 +1,4 @@
import json
conditions = {'id': params_kw.get('id', '')}
result = await delete_voucher_rule(conditions)
return json.dumps(result)
return result

View File

@ -1,4 +1,3 @@
import json
conditions = {'id': params_kw.get('id', '')}
data = {}
@ -8,4 +7,4 @@ for key in ['template_id', 'rule_type', 'rule_config', 'enabled', 'sort_order',
data[key] = val
result = await update_voucher_rule(conditions, data)
return json.dumps(result)
return result

View File

@ -1,4 +1,3 @@
import json
params = params_kw if hasattr(params_kw, '__getitem__') else {}
data = {}
@ -8,4 +7,4 @@ for key in ['name', 'code', 'face_value', 'total_count', 'valid_days', 'status',
data[key] = val
result = await create_voucher_template(data)
return json.dumps(result)
return result

View File

@ -1,5 +1,4 @@
import json
conditions = {'id': params_kw.get('id', '')}
result = await delete_voucher_template(conditions)
return json.dumps(result)
return result

View File

@ -1,4 +1,3 @@
import json
conditions = {'id': params_kw.get('id', '')}
data = {}
@ -8,4 +7,4 @@ for key in ['name', 'code', 'face_value', 'total_count', 'valid_days', 'status',
data[key] = val
result = await update_voucher_template(conditions, data)
return json.dumps(result)
return result

View File

@ -1,4 +1,3 @@
import json
data = {}
for key in ['instance_id', 'customer_id', 'order_id', 'face_value', 'deducted_amount', 'used_at', 'used_by', 'product_type', 'product_name']:
@ -7,4 +6,4 @@ for key in ['instance_id', 'customer_id', 'order_id', 'face_value', 'deducted_am
data[key] = val
result = await create_voucher_usage_log(data)
return json.dumps(result)
return result

View File

@ -1,5 +1,4 @@
import json
conditions = {'id': params_kw.get('id', '')}
result = await delete_voucher_usage_log(conditions)
return json.dumps(result)
return result

View File

@ -1,4 +1,3 @@
import json
conditions = {'id': params_kw.get('id', '')}
data = {}
@ -8,4 +7,4 @@ for key in ['instance_id', 'customer_id', 'order_id', 'face_value', 'deducted_am
data[key] = val
result = await update_voucher_usage_log(conditions, data)
return json.dumps(result)
return result