fix: 修改上传图片接口的返回值
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
This commit is contained in:
parent
72303f4837
commit
330084ea4a
|
@ -17,6 +17,7 @@ api = APIBlueprint('api', __name__)
|
||||||
@api.post('/images')
|
@api.post('/images')
|
||||||
@api.doc(summary='上传图片', description='上传图片')
|
@api.doc(summary='上传图片', description='上传图片')
|
||||||
@api.input(ImageIn, location='files')
|
@api.input(ImageIn, location='files')
|
||||||
|
@api.output(ImagePreSignUrlOut)
|
||||||
@login_required
|
@login_required
|
||||||
def upload_image(files_data):
|
def upload_image(files_data):
|
||||||
f = files_data['image']
|
f = files_data['image']
|
||||||
|
@ -36,9 +37,16 @@ def upload_image(files_data):
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
raise UserInfoError(extra_data={'error_docs': str(e)})
|
raise UserInfoError(extra_data={'error_docs': str(e)})
|
||||||
|
|
||||||
return {'msg': 'uploading image success'}
|
try:
|
||||||
|
presign_url = rpc.storage.get_presign_url(result['_id'],
|
||||||
|
'bodyrecord',
|
||||||
|
bucket='bodyrecord')
|
||||||
|
except Exception as e:
|
||||||
|
raise ImageNotFound(extra_data={'error_docs': str(e)})
|
||||||
|
|
||||||
|
return {'image_presign_url': presign_url}
|
||||||
else:
|
else:
|
||||||
return {'msg': 'uploading image fail'}
|
raise ImageUploadError()
|
||||||
|
|
||||||
|
|
||||||
@api.get('/images/presign_url')
|
@api.get('/images/presign_url')
|
||||||
|
|
Loading…
Reference in New Issue