38">
+ # 设置群组最后一张照片PK
+ r.set(GROUP_LAST_PHOTO_PK % group_id, group_photo.pk)
- # Redis 群组数据缓存
- set_group_info_by_id(group_id)
+ # Redis 群组数据缓存
+ set_group_info_by_id(group_id)
curinfo = get_current_photos(group_id, user_id, group_user.current_id, request=request)
@@ -9,7 +9,7 @@ TimeConvert==1.3.12 |
||
| 9 | 9 |
cryptography==1.5.2 |
| 10 | 10 |
django-curtail-uuid==1.0.0 |
| 11 | 11 |
django-detect==1.0.5 |
| 12 |
-django-file-md5==1.0.0 |
|
| 12 |
+django-file-md5==1.0.1 |
|
| 13 | 13 |
django-ip==1.0.0 |
| 14 | 14 |
django-json-response==1.1.4 |
| 15 | 15 |
django-logit==1.0.6 |
@@ -29,12 +29,14 @@ def file_save(file_=None, file_path=None, prefix='img', ext='jpeg', watermark=Fa |
||
| 29 | 29 |
# Ext |
| 30 | 30 |
ext = os.path.splitext(file_.name)[-1] or ext |
| 31 | 31 |
|
| 32 |
+ # Photo MD5 |
|
| 33 |
+ photo_md5 = calculate_md5(file_) |
|
| 34 |
+ |
|
| 32 | 35 |
# Photo UUID Get or Create |
| 33 |
- photo, created = PhotoUUIDInfo.objects.select_for_update().get_or_create(photo_md5=calculate_md5(file_)) |
|
| 36 |
+ photo, created = PhotoUUIDInfo.objects.select_for_update().get_or_create(photo_md5=photo_md5) |
|
| 34 | 37 |
|
| 35 | 38 |
# 照片路径 |
| 36 |
- photo_path = photo.photo_path |
|
| 37 |
- if not photo_path: |
|
| 39 |
+ if not photo.photo_path: |
|
| 38 | 40 |
photo_path = '{}/{}{}'.format(prefix, shortuuid.uuid(), ext)
|
| 39 | 41 |
if default_storage.exists(photo_path): |
| 40 | 42 |
default_storage.delete(photo_path) |
@@ -88,7 +90,9 @@ def file_save(file_=None, file_path=None, prefix='img', ext='jpeg', watermark=Fa |
||
| 88 | 90 |
return DotDict({
|
| 89 | 91 |
'ext': ext, |
| 90 | 92 |
|
| 91 |
- 'photo_path': photo_path, |
|
| 93 |
+ 'photo_md5': photo_md5, |
|
| 94 |
+ |
|
| 95 |
+ 'photo_path': photo.photo_path, |
|
| 92 | 96 |
'photo_w': photo.photo_w, |
| 93 | 97 |
'photo_h': photo.photo_h, |
| 94 | 98 |
|