更新地址 更新后端

This commit is contained in:
super
2026-05-29 22:53:44 +08:00
parent 080625567b
commit 9835831415
10 changed files with 220 additions and 8 deletions

View File

@@ -1306,6 +1306,46 @@ def search_product_categories():
})
@admin_api.route('/product-categories/export')
@login_required
def export_product_categories():
_ensure_product_category_schema()
_, _, denied = _ensure_product_category_access()
if denied:
return denied
keyword = (request.args.get('keyword') or '').strip()
params = {}
if keyword:
params['keyword'] = keyword
url = f"{backend_java_base_url}/api/admin/product-categories/export"
try:
resp = _get_backend_java_session().get(url, params=params, timeout=60)
except requests.RequestException:
return jsonify({'success': False, 'error': 'backend-java 服务不可用'}), 502
if resp.status_code >= 400:
try:
data = resp.json()
error = data.get('message') or data.get('error') or '导出失败'
except ValueError:
error = '导出失败'
return jsonify({'success': False, 'error': error}), resp.status_code
headers = {}
disposition = resp.headers.get('Content-Disposition')
if disposition:
headers['Content-Disposition'] = disposition
return Response(
resp.content,
status=resp.status_code,
headers=headers,
content_type=resp.headers.get(
'Content-Type',
'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
),
)
@admin_api.route('/product-category', methods=['POST'])
@login_required
def create_product_category():