Add nomark/origin price for GroupPhotoInfo

Brightcells 8 jaren geleden
bovenliggende
commit
14d5d63e3b
6 gewijzigde bestanden met toevoegingen van 46 en 4 verwijderingen
  1. 6 1
      group/lensman_views.py
  2. 24 0
      group/migrations/0034_auto_20170411_1156.py
  3. 5 0
      group/models.py
  4. 4 2
      group/views.py
  5. 6 0
      photo/views.py
  6. 1 1
      utils/sql/raw.py

+ 6 - 1
group/lensman_views.py

@@ -184,6 +184,9 @@ def lensman_photo_upload_api(request):
184 184
         photo.p_photo_path = photo_info.photo_watermark_path
185 185
         photo.save()
186 186
 
187
+        # 获取摄影师定价
188
+        price_info = get_lensman_price_fixed(user_id)
189
+
187 190
         # 写 GroupPhotoInfo 表
188 191
         group_photo, created = GroupPhotoInfo.objects.get_or_create(
189 192
             group_id=group_id,
@@ -205,6 +208,8 @@ def lensman_photo_upload_api(request):
205 208
                 'session_id': photo.session_id,
206 209
                 'lensman_id': photo.lensman_id,
207 210
                 'lensman_photo_id': photo.photo_id,
211
+                'nomark': price_info.get('nomark', 999),
212
+                'origin': price_info.get('origin', 999),
208 213
             }
209 214
         )
210 215
 
@@ -294,7 +299,7 @@ def lensman_origin_photo_upload_api(request):
294 299
         order.reback_at = tc.utc_datetime()
295 300
         order.save()
296 301
 
297
-    if photo and upload_lock(group_id, user_id, photo):
302
+    if photo and upload_lock(order_id, user_id, photo):
298 303
         # 写 PhotosInfo 表
299 304
         photo_info = file_save(photo, prefix='photo', ext='jpeg')
300 305
 

+ 24 - 0
group/migrations/0034_auto_20170411_1156.py

@@ -0,0 +1,24 @@
1
+# -*- coding: utf-8 -*-
2
+from __future__ import unicode_literals
3
+
4
+from django.db import models, migrations
5
+
6
+
7
+class Migration(migrations.Migration):
8
+
9
+    dependencies = [
10
+        ('group', '0033_groupphotoinfo_photo_id'),
11
+    ]
12
+
13
+    operations = [
14
+        migrations.AddField(
15
+            model_name='groupphotoinfo',
16
+            name='nomark',
17
+            field=models.IntegerField(default=299, help_text='\u6444\u5f71\u5e08\u7167\u7247\u65e0\u6c34\u5370\u4ef7\u683c(\u5206)', verbose_name='nomark'),
18
+        ),
19
+        migrations.AddField(
20
+            model_name='groupphotoinfo',
21
+            name='origin',
22
+            field=models.IntegerField(default=999, help_text='\u6444\u5f71\u5e08\u7167\u7247\u9ad8\u6e05\u56fe\u4ef7\u683c(\u5206)', verbose_name='origin'),
23
+        ),
24
+    ]

+ 5 - 0
group/models.py

@@ -247,6 +247,9 @@ class GroupPhotoInfo(CreateUpdateMixin):
247 247
     lensman_id = models.CharField(_(u'lensman_id'), max_length=255, blank=True, null=True, help_text=u'摄影师唯一标识,同 PhotosInfo 表', db_index=True)
248 248
     lensman_photo_id = models.CharField(_(u'lensman_photo_id'), max_length=255, blank=True, null=True, help_text=u'摄影师照片唯一标识,同 PhotosInfo 表', db_index=True)
249 249
 
250
+    nomark = models.IntegerField(_(u'nomark'), default=299, help_text=u'摄影师照片无水印价格(分)')
251
+    origin = models.IntegerField(_(u'origin'), default=999, help_text=u'摄影师照片高清图价格(分)')
252
+
250 253
     class Meta:
251 254
         verbose_name = _(u'groupphotoinfo')
252 255
         verbose_name_plural = _(u'groupphotoinfo')
@@ -309,6 +312,8 @@ class GroupPhotoInfo(CreateUpdateMixin):
309 312
             'thumbup_num': self.thumbup_num,
310 313
             'photo_from': self.photo_from,
311 314
             'session_id': self.session_id,
315
+            'nomark': self.nomark,
316
+            'origin': self.origin,
312 317
             'porder': porder,
313 318
             'created_at': self.created_at.replace(microsecond=0),
314 319
             'origin_expired_stamps': origin_expired_stamps(self.lensman_photo_id, self.user_id)

+ 4 - 2
group/views.py

@@ -643,8 +643,10 @@ def pai2_home_api(request):
643 643
         'thumbup_num': row[19],
644 644
         'photo_from': row[20],
645 645
         'session_id': row[21],
646
-        'created_at': row[22],
647
-        'origin_expired_stamps': origin_expired_stamps(row[23], row[15]),
646
+        'nomark': rows[22],
647
+        'origin': rows[23],
648
+        'created_at': row[24],
649
+        'origin_expired_stamps': origin_expired_stamps(row[25], row[15]),
648 650
         'thumbup': get_group_photo_thumbup_flag(row[5], user_id),
649 651
         'porder': get_lensman_order_record(row[5], user_id) if row[20] == GroupPhotoInfo.SESSION_GROUP else {},
650 652
     } for row in rows]

+ 6 - 0
photo/views.py

@@ -19,6 +19,7 @@ from utils.redis.connect import r
19 19
 from utils.redis.rgroup import get_group_info, set_group_info, set_group_users_info
20 20
 from utils.redis.rkeys import (GROUP_LAST_PHOTO_PK, GROUP_USERS_DELETED_SET, GROUP_USERS_PASSED_SET,
21 21
                                GROUP_USERS_QUIT_SET, GROUP_USERS_REFUSED_SET, UUID_LIST)
22
+from utils.redis.rprice import get_lensman_price_fixed
22 23
 from utils.redis.ruuid import generate_uuids, update_uuids
23 24
 from utils.storage_utils import file_save
24 25
 
@@ -156,6 +157,9 @@ def session_join_api(request):
156 157
         # 获取 Session 照片
157 158
         photos = PhotosInfo.objects.filter(session_id=session_id, status=True)
158 159
 
160
+        # 获取摄影师定价
161
+        price_info = get_lensman_price_fixed(user_id)
162
+
159 163
         group_photo = None
160 164
         for photo in photos:
161 165
             photo_info = file_save(photo_path=photo.p_photo_path, thumbnail=True)
@@ -179,6 +183,8 @@ def session_join_api(request):
179 183
                 session_id=photo.session_id,
180 184
                 lensman_id=photo.lensman_id,
181 185
                 lensman_photo_id=photo.photo_id,
186
+                nomark=price_info.get('nomark', 999),
187
+                origin=price_info.get('origin', 999),
182 188
             )
183 189
 
184 190
         if group_photo:

+ 1 - 1
utils/sql/raw.py

@@ -5,7 +5,7 @@ PAI2_HOME_API = (
5 5
     r"T1.group_id, T2.group_name, T2.group_default_avatar, T2.group_avatar, T2.group_from, T3.photo_id, "
6 6
     r"T3.photo_path, T3.photo_w, T3.photo_h, T3.photo_thumbnail_path, T3.photo_thumbnail_w, T3.photo_thumbnail_h, "
7 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.session_id, T3.created_at, T3.lensman_photo_id "
8
+    r"T3.comment_num, T3.thumbup_num, T3.photo_from, T3.session_id, T3.nomark, T3.origin, T3.created_at, T3.lensman_photo_id "
9 9
     r"from (select * from group_groupuserinfo where user_id='{user_id}' and user_status=1) as T1 "
10 10
     r"left outer join group_groupinfo as T2 on T1.group_id = T2.group_id "
11 11
     r"left outer join group_groupphotoinfo as T3 on T1.group_id = T3.group_id and T3.id > T1.current_id "