diff --git a/wwwroot/api/product_category_create.dspy b/wwwroot/api/product_category_create.dspy index b83071d..cceb746 100644 --- a/wwwroot/api/product_category_create.dspy +++ b/wwwroot/api/product_category_create.dspy @@ -34,8 +34,10 @@ try: async with DBPools().sqlorContext(dbname) as sor: await sor.C('product_category', data) + _new_rows = await sor.sqlExe("SELECT * FROM product_category WHERE id = ${id}$", {'id': data['id']}) + _user_data = _new_rows[0] if _new_rows else data - result = {'widgettype': 'Message', 'options': {'title': 'Success', 'message': '类别创建成功', 'type': 'success'}} + result = {'widgettype': 'Message', 'options': {'title': 'Success', 'message': '类别创建成功', 'type': 'success', 'user_data': _user_data}} except Exception as e: result['options'] = {'title': 'Error', 'message': '创建失败: ' + str(e), 'type': 'error'} diff --git a/wwwroot/product_category_tree/new_product_category.dspy b/wwwroot/product_category_tree/new_product_category.dspy index 1b67e6e..fec2c87 100644 --- a/wwwroot/product_category_tree/new_product_category.dspy +++ b/wwwroot/product_category_tree/new_product_category.dspy @@ -34,6 +34,8 @@ db = DBPools() dbname = get_module_dbname('product_management') async with db.sqlorContext(dbname) as sor: r = await sor.C('product_category', ns.copy()) + _new_rows = await sor.sqlExe("SELECT * FROM product_category WHERE id = ${id}$", {'id': id}) + _user_data = _new_rows[0] if _new_rows else ns return { "widgettype":"Message", "options":{ @@ -41,7 +43,8 @@ async with db.sqlorContext(dbname) as sor: "cheight":9, "title":"Add Success", "timeout":3, - "message":"ok" + "message":"ok", + "user_data": _user_data } }