优化接口;质量检查wizard添加发布按钮
This commit is contained in:
@@ -8,8 +8,8 @@ import json
|
||||
|
||||
class QualityController(http.Controller):
|
||||
|
||||
@http.route('/api/quality/report/download/<string:retrospect_ref>', type='http', auth='public', csrf=False)
|
||||
def get_quality_report(self, retrospect_ref, **kwargs):
|
||||
@http.route(['/api/quality/report/download'], type='http', auth='public', csrf=False, website=False) # 移除 cors="*"
|
||||
def get_quality_report(self, retrospect_ref=None, **kwargs):
|
||||
"""获取质检报告的下载接口
|
||||
|
||||
Args:
|
||||
@@ -19,6 +19,10 @@ class QualityController(http.Controller):
|
||||
直接返回文件下载响应
|
||||
"""
|
||||
try:
|
||||
# 如果retrospect_ref为None,尝试从查询参数获取
|
||||
if not retrospect_ref:
|
||||
retrospect_ref = kwargs.get('retrospect_ref')
|
||||
|
||||
# 参数验证
|
||||
if not retrospect_ref:
|
||||
return self._json_response({
|
||||
@@ -63,7 +67,9 @@ class QualityController(http.Controller):
|
||||
headers=[
|
||||
('Content-Type', 'application/pdf'),
|
||||
('Content-Disposition', f'attachment; filename="{filename}"'),
|
||||
('Access-Control-Allow-Origin', '*')
|
||||
('Access-Control-Allow-Origin', '*'),
|
||||
('Access-Control-Allow-Methods', 'GET, OPTIONS'),
|
||||
('Access-Control-Allow-Headers', 'Content-Type, Authorization')
|
||||
]
|
||||
)
|
||||
|
||||
@@ -78,5 +84,9 @@ class QualityController(http.Controller):
|
||||
return Response(
|
||||
json.dumps(data, ensure_ascii=False),
|
||||
mimetype='application/json;charset=utf-8',
|
||||
headers=[('Access-Control-Allow-Origin', '*')]
|
||||
headers=[
|
||||
('Access-Control-Allow-Origin', '*'),
|
||||
('Access-Control-Allow-Methods', 'GET, OPTIONS'),
|
||||
('Access-Control-Allow-Headers', 'Content-Type, Authorization')
|
||||
]
|
||||
)
|
||||
Reference in New Issue
Block a user