@@ -20,7 +20,7 @@ from utils.error.response_utils import response |
||
20 | 20 |
from utils.message_utils import system_messages |
21 | 21 |
from utils.redis.connect import r |
22 | 22 |
from utils.redis.rbrief import set_brief_info |
23 |
-from utils.redis.rgroup import set_group_info |
|
23 |
+from utils.redis.rgroup import set_group_info, set_group_info_by_id |
|
24 | 24 |
from utils.redis.rkeys import GROUP_LAST_PHOTO_PK, TODAY_INCOME, TODAY_UPLOAD_PHOTO_AMOUNT, WEEK_INCOME, WEEK_SOLD |
25 | 25 |
from utils.redis.rorder import set_lensman_order_record |
26 | 26 |
from utils.redis.rprice import get_lensman_price_fixed, set_lensman_price_fixed |
@@ -210,6 +210,9 @@ def lensman_photo_upload_api(request): |
||
210 | 210 |
# 更新今日上传照片数量 |
211 | 211 |
r.incr(TODAY_UPLOAD_PHOTO_AMOUNT % (user_id, tc.local_string(format='%Y%m%d'))) |
212 | 212 |
|
213 |
+ # Redis 群组数据缓存 |
|
214 |
+ set_group_info_by_id(group_id) |
|
215 |
+ |
|
213 | 216 |
return response(200, 'Lensman Upload Photo Success', u'摄影师照片上传成功', { |
214 | 217 |
'group_id': group_id, |
215 | 218 |
}) |
@@ -67,6 +67,10 @@ class GroupInfo(CreateUpdateMixin): |
||
67 | 67 |
return img_url(self.schedules_path) |
68 | 68 |
|
69 | 69 |
@property |
70 |
+ def group_photo_num(self): |
|
71 |
+ return GroupPhotoInfo.objects.filter(group_id=self.group_id, status=True).count() |
|
72 |
+ |
|
73 |
+ @property |
|
70 | 74 |
def data(self): |
71 | 75 |
return { |
72 | 76 |
'group_id': self.group_id, |
@@ -78,6 +82,7 @@ class GroupInfo(CreateUpdateMixin): |
||
78 | 82 |
'group_from': self.group_from, |
79 | 83 |
'group_lock': self.group_lock, |
80 | 84 |
'group_initio': self.group_initio, |
85 |
+ 'group_photo_num': self.group_photo_num, |
|
81 | 86 |
'name': self.name, |
82 | 87 |
'phone': self.phone, |
83 | 88 |
'started_at': tc.remove_microsecond(self.started_at), |
@@ -22,7 +22,7 @@ from utils.group_photo_utils import get_current_photos |
||
22 | 22 |
from utils.redis.connect import r |
23 | 23 |
from utils.redis.rgroup import (del_group_photo_thumbup_flag, get_group_info, get_group_photo_comment_list, |
24 | 24 |
get_group_photo_data, get_group_photo_thumbup_flag, get_group_photo_thumbup_list, |
25 |
- get_group_photo_watchers, get_group_users_info, set_group_info, |
|
25 |
+ get_group_photo_watchers, get_group_users_info, set_group_info, set_group_info_by_id, |
|
26 | 26 |
set_group_photo_comment_list, set_group_photo_data, set_group_photo_thumbup_flag, |
27 | 27 |
set_group_photo_thumbup_list, set_group_users_info) |
28 | 28 |
from utils.redis.rkeys import (GROUP_LAST_PHOTO_PK, GROUP_PHOTO_WATCHER_SET, GROUP_USERS_PASSED_SET, |
@@ -274,6 +274,9 @@ def flyimg_upload_api(request): |
||
274 | 274 |
# 设置群组最后一张照片PK |
275 | 275 |
r.set(GROUP_LAST_PHOTO_PK % group_id, group_photo.pk) |
276 | 276 |
|
277 |
+ # Redis 群组数据缓存 |
|
278 |
+ set_group_info_by_id(group_id) |
|
279 |
+ |
|
277 | 280 |
curinfo = get_current_photos(group_id, user_id, group_user.current_id, request=request) |
278 | 281 |
|
279 | 282 |
return response(200, 'Flyimg Upload Success', u'飞图上传成功', curinfo) |
@@ -185,6 +185,9 @@ def session_join_api(request): |
||
185 | 185 |
# 设置群组最后一张照片PK |
186 | 186 |
r.set(GROUP_LAST_PHOTO_PK % group_id, group_photo.pk) |
187 | 187 |
|
188 |
+ # Redis 群组数据缓存 |
|
189 |
+ set_group_info(group) |
|
190 |
+ |
|
188 | 191 |
# 获取从 current_id 到 now 的群组照片列表 |
189 | 192 |
group_photos = GroupPhotoInfo.objects.filter( |
190 | 193 |
group_id=group_id, |