| @@ -550,7 +550,7 @@ def flyimg_upload_api(request): | ||
| 550 | 550 | return response(GroupUserStatusCode.GROUP_USER_NOT_FOUND) | 
| 551 | 551 |  | 
| 552 | 552 | if photo: | 
| 553 | -        photo_path = 'fly/{uuid}{extension}'.format(uuid=shortuuid.uuid(), extension=os.path.splitext(photo.name)[1]) | |
| 553 | +        photo_path = 'fly/{uuid}{extension}'.format(uuid=shortuuid.uuid(), extension=os.path.splitext(photo.name)[1] or 'jpeg') | |
| 554 | 554 |          photo_thumbnail_path = photo_path.replace('.', '_thumbnail.') | 
| 555 | 555 |          photo_thumbnail2_path = photo_path.replace('.', '_thumbnail2.') | 
| 556 | 556 |  | 
| @@ -572,7 +572,7 @@ def flyimg_upload_api(request): | ||
| 572 | 572 | # 单列: 1080, xx-100K | 
| 573 | 573 | photo_w, photo_h, photo_thumbnail2_w, photo_thumbnail2_h = make_thumbnail( | 
| 574 | 574 |              os.path.join(settings.MEDIA_ROOT, photo_path).replace('\\', '/'), | 
| 575 | -            os.path.join(settings.MEDIA_ROOT, photo_thumbnail_path).replace('\\', '/'), | |
| 575 | +            os.path.join(settings.MEDIA_ROOT, photo_thumbnail2_path).replace('\\', '/'), | |
| 576 | 576 | settings.THUMBNAIL_MAX_WIDTH2 | 
| 577 | 577 | ) | 
| 578 | 578 |  | 
| @@ -227,6 +227,10 @@ WECHAT_GET_USERINFO = 'https://api.weixin.qq.com/sns/userinfo?access_token=%s&op | ||
| 227 | 227 | WXPAY_NOTIFY_SUCCESS = '<xml><return_code><![CDATA[SUCCESS]]></return_code><return_msg><![CDATA[OK]]></return_msg></xml>' | 
| 228 | 228 | WXPAY_NOTIFY_FAIL = '<xml><return_code><![CDATA[FAIL]]></return_code><return_msg><![CDATA[XML PARSE FAIL]]></return_msg></xml>' | 
| 229 | 229 |  | 
| 230 | +# 图片设置 | |
| 231 | +FILE_UPLOAD_MAX_MEMORY_SIZE = 5242880 # InMemoryUploadedFile 文件最大值 | |
| 232 | +FILE_UPLOAD_PERMISSIONS = 0o644 # TemporaryUploadedFile 文件权限设置 | |
| 233 | + | |
| 230 | 234 | # 唯一标识设置 | 
| 231 | 235 | CURTAIL_UUID_LENGTH = 7 | 
| 232 | 236 |  | 
| @@ -115,6 +115,8 @@ def upload_photo(request): | ||
| 115 | 115 | # photo_id = curtailUUID(PhotosInfo, 'photo_id') | 
| 116 | 116 |  | 
| 117 | 117 | _, extension = os.path.splitext(photo.name) | 
| 118 | + extension = extension or 'jpeg' | |
| 119 | + | |
| 118 | 120 |      m_photo_path = 'photo/{uuid}{extension}'.format(uuid=shortuuid.uuid(), extension=extension) | 
| 119 | 121 |  | 
| 120 | 122 | if default_storage.exists(m_photo_path): | 
| @@ -199,7 +201,7 @@ def session_join_api(request): | ||
| 199 | 201 | for photo in photos: | 
| 200 | 202 | photo_path = photo.p_photo_path | 
| 201 | 203 |              photo_thumbnail_path = photo_path.replace('.', '_thumbnail.') | 
| 202 | -            photo_thumbnail_path = photo_path.replace('.', '_thumbnail2.') | |
| 204 | +            photo_thumbnail2_path = photo_path.replace('.', '_thumbnail2.') | |
| 203 | 205 |  | 
| 204 | 206 | # 群组照片缩略图生成 | 
| 205 | 207 | # 双列: 540, 40-50K | 
| @@ -212,7 +214,7 @@ def session_join_api(request): | ||
| 212 | 214 | # 单列: 1080, xx-100K | 
| 213 | 215 | photo_w, photo_h, photo_thumbnail2_w, photo_thumbnail2_h = make_thumbnail( | 
| 214 | 216 |                  os.path.join(settings.MEDIA_ROOT, photo_path).replace('\\', '/'), | 
| 215 | -                os.path.join(settings.MEDIA_ROOT, photo_thumbnail_path).replace('\\', '/'), | |
| 217 | +                os.path.join(settings.MEDIA_ROOT, photo_thumbnail2_path).replace('\\', '/'), | |
| 216 | 218 | settings.THUMBNAIL_MAX_WIDTH2 | 
| 217 | 219 | ) | 
| 218 | 220 |  |