fix: adjust upload_diet_image
continuous-integration/drone/push Build is passing Details

This commit is contained in:
BryantHe 2023-09-20 16:09:05 +08:00
parent f9680363f4
commit 3b3365fcfb
2 changed files with 10 additions and 2 deletions

View File

@ -56,7 +56,15 @@ def upload_avatar_image(files_data):
@login_required @login_required
def upload_diet_image(files_data): def upload_diet_image(files_data):
f = files_data['image'] f = files_data['image']
category = files_data['category'] # 食物类别 category_dict = {
0: '早餐',
1: '午餐',
2: '晚餐',
3: '零食',
4: '下午茶',
5: '夜宵',
}
category = category_dict[files_data['category']] # 食物类别
try: try:
result = rpc.storage.upload(file_name=str(session['user_id'] + f'_{f.filename}'), result = rpc.storage.upload(file_name=str(session['user_id'] + f'_{f.filename}'),
file_binary=f.read(), file_binary=f.read(),

View File

@ -8,7 +8,7 @@ class ImageIn(Schema):
class DietImageIn(Schema): class DietImageIn(Schema):
image = File() image = File()
category = String() category = Integer()
class ImagePreSignUrlIn(Schema): class ImagePreSignUrlIn(Schema):