186 202
             'user_id': self.user_id,
187 203
             'nickname': self.nickname,
188 204
             'avatar': self.avatar,

+ 21 - 7
group/views.py

@@ -552,6 +552,7 @@ def flyimg_upload_api(request):
552 552
     if photo:
553 553
         photo_path = 'fly/{uuid}{extension}'.format(uuid=shortuuid.uuid(), extension=os.path.splitext(photo.name)[1])
554 554
         photo_thumbnail_path = photo_path.replace('.', '_thumbnail.')
555
+        photo_thumbnail2_path = photo_path.replace('.', '_thumbnail2.')
555 556
 
556 557
         if default_storage.exists(photo_path):
557 558
             default_storage.delete(photo_path)
@@ -562,11 +563,18 @@ def flyimg_upload_api(request):
562 563
         # default_storage.save(photo_thumbnail_path, photo)
563 564
 
564 565
         # 群组照片缩略图生成
566
+        # 双列: 540, 40-50K
565 567
         photo_w, photo_h, photo_thumbnail_w, photo_thumbnail_h = make_thumbnail(
566 568
             os.path.join(settings.MEDIA_ROOT, photo_path).replace('\\', '/'),
567 569
             os.path.join(settings.MEDIA_ROOT, photo_thumbnail_path).replace('\\', '/'),
568 570
             settings.THUMBNAIL_MAX_WIDTH
569 571
         )
572
+        # 单列: 1080, xx-100K
573
+        photo_w, photo_h, photo_thumbnail2_w, photo_thumbnail2_h = make_thumbnail(
574
+            os.path.join(settings.MEDIA_ROOT, photo_path).replace('\\', '/'),
575
+            os.path.join(settings.MEDIA_ROOT, photo_thumbnail_path).replace('\\', '/'),
576
+            settings.THUMBNAIL_MAX_WIDTH2
577
+        )
570 578
 
571 579
         # 群组照片记录创建
572 580
         group_photo = GroupPhotoInfo.objects.create(
@@ -580,6 +588,9 @@ def flyimg_upload_api(request):
580 588
             photo_thumbnail_path=photo_thumbnail_path,
581 589
             photo_thumbnail_w=photo_thumbnail_w,
582 590
             photo_thumbnail_h=photo_thumbnail_h,
591
+            photo_thumbnail2_path=photo_thumbnail2_path,
592
+            photo_thumbnail2_w=photo_thumbnail2_w,
593
+            photo_thumbnail2_h=photo_thumbnail2_h,
583 594
         )
584 595
 
585 596
         # 设置群组最后一张照片PK
@@ -879,13 +890,16 @@ def pai2_home_api(request):
879 890
         'photo_thumbnail_url': img_url(row[9]),
880 891
         'photo_thumbnail_w': row[10],
881 892
         'photo_thumbnail_h': row[11],
882
-        'user_id': row[12],
883
-        'nickname': row[13],
884
-        'avatar': row[14],
885
-        'comment_num': row[15],
886
-        'thumbup_num': row[16],
887
-        'photo_from': row[17],
888
-        'created_at': row[18],
893
+        'photo_thumbnail2_url': img_url(row[12]),
894
+        'photo_thumbnail2_w': row[13],
895
+        'photo_thumbnail2_h': row[14],
896
+        'user_id': row[15],
897
+        'nickname': row[16],
898
+        'avatar': row[17],
899
+        'comment_num': row[18],
900
+        'thumbup_num': row[19],
901
+        'photo_from': row[20],
902
+        'created_at': row[21],
889 903
     } for row in rows]
890 904
 
891 905
     [row.update({'thumbup': get_group_photo_thumbup_flag(row['photo_id'], user_id)}) for row in rows]

+ 2 - 1
pai2/settings.py

@@ -234,7 +234,8 @@ CURTAIL_UUID_LENGTH = 7
234 234
 WATERMARK_LOGO = os.path.join(PROJ_DIR, 'static/pai2/img/paiai_96_96.png').replace('\\', '/')
235 235
 
236 236
 # 缩略图设置
237
-THUMBNAIL_MAX_WIDTH = 360
237
+THUMBNAIL_MAX_WIDTH = 540
238
+THUMBNAIL_MAX_WIDTH2 = 1080
238 239
 
239 240
 # 首页设置
240 241
 PAI2_HOME_PER_PAGE = 20  # 首页照片每页数量

+ 12 - 0
photo/views.py

@@ -199,14 +199,23 @@ def session_join_api(request):
199 199
         for photo in photos:
200 200
             photo_path = photo.p_photo_path
201 201
             photo_thumbnail_path = photo_path.replace('.', '_thumbnail.')
202
+            photo_thumbnail_path = photo_path.replace('.', '_thumbnail2.')
202 203
 
203 204
             # 群组照片缩略图生成
205
+            # 双列: 540, 40-50K
204 206
             photo_w, photo_h, photo_thumbnail_w, photo_thumbnail_h = make_thumbnail(
205 207
                 os.path.join(settings.MEDIA_ROOT, photo_path).replace('\\', '/'),
206 208
                 os.path.join(settings.MEDIA_ROOT, photo_thumbnail_path).replace('\\', '/'),
207 209
                 settings.THUMBNAIL_MAX_WIDTH
208 210
             )
209 211
 
212
+            # 单列: 1080, xx-100K
213
+            photo_w, photo_h, photo_thumbnail2_w, photo_thumbnail2_h = make_thumbnail(
214
+                os.path.join(settings.MEDIA_ROOT, photo_path).replace('\\', '/'),
215
+                os.path.join(settings.MEDIA_ROOT, photo_thumbnail_path).replace('\\', '/'),
216
+                settings.THUMBNAIL_MAX_WIDTH2
217
+            )
218
+
210 219
             # 群组照片记录创建
211 220
             group_photo = GroupPhotoInfo.objects.create(
212 221
                 group_id=group_id,
@@ -219,6 +228,9 @@ def session_join_api(request):
219 228
                 photo_thumbnail_path=photo_thumbnail_path,
220 229
                 photo_thumbnail_w=photo_thumbnail_w,
221 230
                 photo_thumbnail_h=photo_thumbnail_h,
231
+                photo_thumbnail2_path=photo_thumbnail2_path,
232
+                photo_thumbnail2_w=photo_thumbnail2_w,
233
+                photo_thumbnail2_h=photo_thumbnail2_h,
222 234
                 photo_from=GroupPhotoInfo.SESSION_GROUP,
223 235
             )
224 236
 

+ 4 - 3
utils/sql/raw.py

@@ -2,9 +2,10 @@
2 2
 
3 3
 PAI2_HOME_API = (
4 4
     r"select "
5
-    r"T1.group_id, T2.group_name, T2.group_default_avatar, T2.group_avatar, T2.group_from, T3.id, T3.photo_path, T3.photo_w, "
6
-    r"T3.photo_h, T3.photo_thumbnail_path, T3.photo_thumbnail_w, T3.photo_thumbnail_h, T3.user_id, T3.nickname, "
7
-    r"T3.avatar, T3.comment_num, T3.thumbup_num, T3.photo_from, T3.created_at "
5
+    r"T1.group_id, T2.group_name, T2.group_default_avatar, T2.group_avatar, T2.group_from, T3.id, T3.photo_path, "
6
+    r"T3.photo_w, T3.photo_h, T3.photo_thumbnail_path, T3.photo_thumbnail_w, T3.photo_thumbnail_h, "
7
+    r"T3.photo_thumbnail2_path, T3.photo_thumbnail2_w, T3.photo_thumbnail2_h, T3.user_id, T3.nickname, T3.avatar, "
8
+    r"T3.comment_num, T3.thumbup_num, T3.photo_from, T3.created_at "
8 9
     r"from (select * from group_groupuserinfo where user_id='{user_id}' and user_status=1) as T1 "
9 10
     r"left outer join group_groupinfo as T2 on T1.group_id = T2.group_id "
10 11
     r"left outer join group_groupphotoinfo as T3 on T1.group_id = T3.group_id and T3.id > T1.current_id "

kodo - Gogs: Go Git Service

Nenhuma Descrição

0014_lensmaninfo_refused_reason.py 502B

    # -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations class Migration(migrations.Migration): dependencies = [ ('account', '0013_auto_20160711_1436'), ] operations = [ migrations.AddField( model_name='lensmaninfo', name='refused_reason', field=models.TextField(help_text='\u5ba1\u6838\u62d2\u7edd\u539f\u56e0', null=True, verbose_name='refused_reason', blank=True), ), ]