:art: Support QINIU_FILE_URL_HTTPS

huangqimin001 2 jaren geleden
bovenliggende
commit
fe42e0b6eb
1 gewijzigde bestanden met toevoegingen van 10 en 4 verwijderingen
  1. 10 4
      member/models.py

+ 10 - 4
member/models.py

@@ -466,6 +466,12 @@ class MemberActivityInfo(BaseModelMixin, BrandInfoMixin):
466 466
             return self.content_rich_text
467 467
         return self.content_rich_text.replace('https://img.tamron.kodo.com.cn/', 'http://img.tamron.kodo.com.cn/')
468 468
 
469
+    @property
470
+    def final_poster_kv_img_url(self):
471
+        if settings.QINIU_FILE_URL_HTTPS:
472
+            return self.poster_kv_img_url
473
+        return self.poster_kv_img_url.replace('https://img.tamron.kodo.com.cn/', 'http://img.tamron.kodo.com.cn/')
474
+
469 475
     def data(self, user_id):
470 476
         return {
471 477
             'id': self.activity_id,
@@ -492,7 +498,7 @@ class MemberActivityInfo(BaseModelMixin, BrandInfoMixin):
492 498
             'state': self.final_state,
493 499
             'is_signed': self.is_signed(user_id),
494 500
             'is_signup': self.is_signup,
495
-            'poster_kv_img_url': self.poster_kv_img_url,
501
+            'poster_kv_img_url': self.final_poster_kv_img_url,
496 502
             'poster_content': self.poster_content,
497 503
             'contribution_content_placeholder': self.contribution_content_placeholder,
498 504
         }
@@ -524,7 +530,7 @@ class MemberActivityInfo(BaseModelMixin, BrandInfoMixin):
524 530
             'state': self.final_state,
525 531
             'is_signed': self.is_signed(user_id),
526 532
             'is_signup': self.is_signup,
527
-            'poster_kv_img_url': self.poster_kv_img_url,
533
+            'poster_kv_img_url': self.final_poster_kv_img_url,
528 534
             'poster_content': self.poster_content,
529 535
             'contribution_content_placeholder': self.contribution_content_placeholder,
530 536
 
@@ -561,7 +567,7 @@ class MemberActivityInfo(BaseModelMixin, BrandInfoMixin):
561 567
             'share_max_integral': self.group_share_max_integral,
562 568
             'activity_state': self.activity_state,
563 569
             'created_at': tc.local_string(utc_dt=self.created_at),
564
-            'poster_kv_img_url': self.poster_kv_img_url,
570
+            'poster_kv_img_url': self.final_poster_kv_img_url,
565 571
             'poster_content': self.poster_content,
566 572
             'contribution_content_placeholder': self.contribution_content_placeholder,
567 573
             'welfares': self.welfares,
@@ -601,7 +607,7 @@ class MemberActivityInfo(BaseModelMixin, BrandInfoMixin):
601 607
             'share_max_integral': self.group_share_max_integral,
602 608
             'activity_state': self.activity_state,
603 609
             'created_at': tc.local_string(utc_dt=self.created_at),
604
-            'poster_kv_img_url': self.poster_kv_img_url,
610
+            'poster_kv_img_url': self.final_poster_kv_img_url,
605 611
             'poster_content': self.poster_content,
606 612
             'contribution_content_placeholder': self.contribution_content_placeholder,
607 613
             'welfares': self.welfares,