@@ -172,7 +172,7 @@ def lensman_photo_upload_api(request): |
||
172 | 172 |
group_id = group.group_id |
173 | 173 |
|
174 | 174 |
if photo and upload_lock(group_id, user_id, photo): |
175 |
- photo_info = file_save(photo, prefix='photo', ext='jpeg', watermark=True, thumbnail=True) |
|
175 |
+ photo_info = file_save(photo, prefix='photo', ext='.jpeg', watermark=True, thumbnail=True) |
|
176 | 176 |
|
177 | 177 |
# 写 PhotosInfo 表 |
178 | 178 |
photo, created = PhotosInfo.objects.get_or_create( |
@@ -303,7 +303,7 @@ def lensman_origin_photo_upload_api(request): |
||
303 | 303 |
|
304 | 304 |
if photo and upload_lock(order_id, user_id, photo): |
305 | 305 |
# 写 PhotosInfo 表 |
306 |
- photo_info = file_save(photo, prefix='photo', ext='jpeg') |
|
306 |
+ photo_info = file_save(photo, prefix='photo', ext='.jpeg') |
|
307 | 307 |
|
308 | 308 |
PhotosInfo.objects.filter( |
309 | 309 |
lensman_id=lensman_id, |
@@ -188,7 +188,7 @@ def tg_group_update_api(request): |
||
188 | 188 |
group.group_desc = group_desc |
189 | 189 |
# 群组头像更新 |
190 | 190 |
if group_avatar: |
191 |
- group.group_avatar = file_save(group_avatar, prefix='group', ext='jpeg').photo_path |
|
191 |
+ group.group_avatar = file_save(group_avatar, prefix='group', ext='.jpeg').photo_path |
|
192 | 192 |
# 起止时间更新 |
193 | 193 |
if started_at: |
194 | 194 |
group.started_at = started_at |
@@ -199,10 +199,10 @@ def tg_group_update_api(request): |
||
199 | 199 |
group.total_persons = total_persons |
200 | 200 |
# 注意事项更新 |
201 | 201 |
if attentions: |
202 |
- group.attentions_path = file_save(attentions, prefix='tour', ext='jpeg').photo_path |
|
202 |
+ group.attentions_path = file_save(attentions, prefix='tour', ext='.jpeg').photo_path |
|
203 | 203 |
# 行程安排更新 |
204 | 204 |
if schedules: |
205 |
- group.schedules_path = file_save(schedules, prefix='tour', ext='jpeg').photo_path |
|
205 |
+ group.schedules_path = file_save(schedules, prefix='tour', ext='.jpeg').photo_path |
|
206 | 206 |
group.save() |
207 | 207 |
|
208 | 208 |
# Redis 群组数据缓存更新 |
@@ -269,7 +269,7 @@ def tg_group_gather_start_api(request): |
||
269 | 269 |
group.gather_lat = gather_lat |
270 | 270 |
group.gather_location = gather_location |
271 | 271 |
if gather_screenshot: |
272 |
- group.gather_screenshot = file_save(gather_screenshot, prefix='tour', ext='jpeg').photo_path |
|
272 |
+ group.gather_screenshot = file_save(gather_screenshot, prefix='tour', ext='.jpeg').photo_path |
|
273 | 273 |
group.save() |
274 | 274 |
|
275 | 275 |
# Redis 群组数据缓存更新 |
@@ -127,7 +127,7 @@ def group_update_api(request): |
||
127 | 127 |
group.group_desc = group_desc |
128 | 128 |
# 群组头像更新 |
129 | 129 |
if group_avatar: |
130 |
- group.group_avatar = file_save(group_avatar, prefix='group', ext='jpeg').photo_path |
|
130 |
+ group.group_avatar = file_save(group_avatar, prefix='group', ext='.jpeg').photo_path |
|
131 | 131 |
group.save() |
132 | 132 |
|
133 | 133 |
# Redis 群组数据缓存更新 |
@@ -277,7 +277,7 @@ def flyimg_upload_api(request): |
||
277 | 277 |
return response(GroupUserStatusCode.GROUP_USER_NOT_FOUND) |
278 | 278 |
|
279 | 279 |
if photo and upload_lock(group_id, user_id, photo): |
280 |
- photo_info = file_save(photo, prefix='fly', ext='jpeg', thumbnail=True) |
|
280 |
+ photo_info = file_save(photo, prefix='fly', ext='.jpeg', thumbnail=True) |
|
281 | 281 |
|
282 | 282 |
# 群组照片记录创建 |
283 | 283 |
group_photo, created = GroupPhotoInfo.objects.get_or_create( |
@@ -86,7 +86,7 @@ def upload_photo(request): |
||
86 | 86 |
except LensmanInfo.DoesNotExist: |
87 | 87 |
return response(LensmanStatusCode.LENSMAN_NOT_FOUND) |
88 | 88 |
|
89 |
- photo_info = file_save(photo, prefix='photo', ext='jpeg', watermark=True) |
|
89 |
+ photo_info = file_save(photo, prefix='photo', ext='.jpeg', watermark=True) |
|
90 | 90 |
|
91 | 91 |
photo, created = PhotosInfo.objects.get_or_create( |
92 | 92 |
lensman_id=lensman_id, |
@@ -178,7 +178,7 @@ def session_join_api(request): |
||
178 | 178 |
|
179 | 179 |
group_photo = None |
180 | 180 |
for photo in photos: |
181 |
- photo_info = file_save(photo_path=photo.p_photo_path, prefix='photo', ext='jpeg', thumbnail=True) |
|
181 |
+ photo_info = file_save(photo_path=photo.p_photo_path, prefix='photo', ext='.jpeg', thumbnail=True) |
|
182 | 182 |
|
183 | 183 |
# 群组照片记录创建 |
184 | 184 |
group_photo = GroupPhotoInfo.objects.create( |
@@ -22,7 +22,7 @@ class DotDict(dict): |
||
22 | 22 |
|
23 | 23 |
|
24 | 24 |
@transaction.atomic |
25 |
-def file_save(file_=None, file_path=None, prefix='img', ext='jpeg', watermark=False, thumbnail=False): |
|
25 |
+def file_save(file_=None, file_path=None, prefix='img', ext='.jpeg', watermark=False, thumbnail=False): |
|
26 | 26 |
# Photo |
27 | 27 |
file_ = file_ or default_storage.open(file_path) |
28 | 28 |
|