:art: Support upload file file_type == 'contribution'

huangqimin001 2 gadi atpakaļ
vecāks
revīzija
d169cce602
3 mainītis faili ar 46 papildinājumiem un 1 dzēšanām
  1. 9 1
      api/admin_views.py
  2. 9 0
      kodo/oauth_settings.py
  3. 28 0
      member/models.py

+ 9 - 1
api/admin_views.py

@@ -948,6 +948,7 @@ def record_warehouse(request):
948 948
 def member_activity_list(request):
949 949
     brand_id = request.POST.get('brand_id', settings.KODO_DEFAULT_BRAND_ID)
950 950
     admin_id = request.POST.get('admin_id', '')
951
+    activity_type = request.POST.get('activity_type', '')
951 952
     title = request.POST.get('title', '')
952 953
     start_time = request.POST.get('start_time', '')
953 954
     end_time = request.POST.get('end_time', '')
@@ -962,7 +963,14 @@ def member_activity_list(request):
962 963
     except AdministratorInfo.DoesNotExist:
963 964
         return response(AdministratorStatusCode.ADMINISTRATOR_NOT_FOUND)
964 965
 
965
-    logs = MemberActivityInfo.objects.filter(title__icontains=title)
966
+    # logs = MemberActivityInfo.objects.filter(title__icontains=title)
967
+    logs = MemberActivityInfo.objects.filter(status=True)
968
+
969
+    if activity_type:
970
+        logs = logs.filter(activity_type=activity_type)
971
+
972
+    if title:
973
+        logs = logs.filter(title__icontains=title)
966 974
 
967 975
     if start_time and end_time:
968 976
         start_time = datetime.strptime(start_time, '%Y%m%d')

+ 9 - 0
kodo/oauth_settings.py

@@ -243,6 +243,15 @@ def DJANGO_FILE_UPLOAD_CALLBACK_FUNC(request, file_path=None, file_url=None):
243 243
             app_version=version,
244 244
         )
245 245
 
246
+    elif file_type == 'contribution':
247
+        width = request.POST.get('width', '')
248
+        height = request.POST.get('height', 0)
249
+
250
+        return {
251
+            'width': width,
252
+            'height': height,
253
+        }
254
+
246 255
     zbar = int(request.POST.get('zbar', 0))
247 256
     if zbar:
248 257
         import os

+ 28 - 0
member/models.py

@@ -661,3 +661,31 @@ class MemberActivityGroupShareInfo(BaseModelMixin):
661 661
 
662 662
     def __unicode__(self):
663 663
         return '%d' % self.pk
664
+
665
+
666
+class MemberActivityContributionInfo(BaseModelMixin):
667
+    brand_id = models.CharField(_(u'brand_id'), max_length=32, blank=True, null=True, help_text=u'品牌唯一标识', db_index=True)
668
+    brand_name = models.CharField(_(u'brand_name'), max_length=255, blank=True, null=True, help_text=u'品牌名称')
669
+
670
+    activity_id = models.CharField(_(u'activity_id'), max_length=32, blank=True, null=True, help_text=u'活动唯一标识', db_index=True)
671
+
672
+    share_user_id = models.CharField(_(u'share_user_id'), max_length=32, blank=True, null=True, help_text=u'分享用户唯一标识', db_index=True)
673
+    click_user_id = models.CharField(_(u'click_user_id'), max_length=32, blank=True, null=True, help_text=u'点击用户唯一标识', db_index=True)
674
+
675
+    open_gid = models.CharField(_(u'open_gid'), max_length=32, blank=True, null=True, help_text=u'群组唯一标识', db_index=True)
676
+
677
+    title = models.CharField(_(u'title'), max_length=255, blank=True, null=True, help_text=u'活动名称')
678
+
679
+    is_integral = models.BooleanField(_(u'is_integral'), default=False, help_text=u'是否有积分')
680
+    integral = models.IntegerField(_(u'integral'), default=0, help_text=u'积分')
681
+
682
+    class Meta:
683
+        verbose_name = _(u'会员活动群组分享信息')
684
+        verbose_name_plural = _(u'会员活动群组分享信息')
685
+
686
+        unique_together = (
687
+            ('activity_id', 'share_user_id', 'click_user_id', 'open_gid', 'brand_id'),
688
+        )
689
+
690
+    def __unicode__(self):
691
+        return '%d' % self.pk