diff --git a/wwwroot/api/.product_category_create.dspy.swp b/wwwroot/api/.product_category_create.dspy.swp new file mode 100644 index 0000000..7dbbec7 Binary files /dev/null and b/wwwroot/api/.product_category_create.dspy.swp differ diff --git a/wwwroot/api/product_category_create.dspy b/wwwroot/api/product_category_create.dspy index 65561ca..698bce6 100644 --- a/wwwroot/api/product_category_create.dspy +++ b/wwwroot/api/product_category_create.dspy @@ -1,6 +1,7 @@ result = {'widgettype': 'Message', 'options': {'title': 'Error', 'message': 'Invalid', 'type': 'error'}} try: + debug(f'product_category_create.dspy: START params_kw={dict(params_kw)}') user_id = await get_user() org_id = (await get_userorgid()) or '0' @@ -43,14 +44,19 @@ try: else: fields[k] = '' + debug(f'product_category_create.dspy: fields keys={list(fields.keys())}, id={data.get("id")}') + async with DBPools().sqlorContext(dbname) as sor: + debug(f'product_category_create.dspy: BEFORE sor.C, fields={ {k:v for k,v in fields.items() if v} }') await sor.C('product_category', fields) + debug(f'product_category_create.dspy: AFTER sor.C OK, querying id={data["id"]}') _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', 'user_data': _user_data}} except Exception as e: + debug(f'product_category_create.dspy: EXCEPTION {format_exc()}') result['options'] = {'title': 'Error', 'message': '创建失败: ' + str(e), 'type': 'error'} return result