fix: adjust upload_diet_image
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
This commit is contained in:
parent
f9680363f4
commit
3b3365fcfb
|
@ -56,7 +56,15 @@ def upload_avatar_image(files_data):
|
|||
@login_required
|
||||
def upload_diet_image(files_data):
|
||||
f = files_data['image']
|
||||
category = files_data['category'] # 食物类别
|
||||
category_dict = {
|
||||
0: '早餐',
|
||||
1: '午餐',
|
||||
2: '晚餐',
|
||||
3: '零食',
|
||||
4: '下午茶',
|
||||
5: '夜宵',
|
||||
}
|
||||
category = category_dict[files_data['category']] # 食物类别
|
||||
try:
|
||||
result = rpc.storage.upload(file_name=str(session['user_id'] + f'_{f.filename}'),
|
||||
file_binary=f.read(),
|
||||
|
|
|
@ -8,7 +8,7 @@ class ImageIn(Schema):
|
|||
|
||||
class DietImageIn(Schema):
|
||||
image = File()
|
||||
category = String()
|
||||
category = Integer()
|
||||
|
||||
|
||||
class ImagePreSignUrlIn(Schema):
|
||||
|
|
Loading…
Reference in New Issue