@@ -953,14 +953,14 @@ def member_activity_register_list(request, administrator): |
||
| 953 | 953 |
@transaction.atomic |
| 954 | 954 |
def member_activity_contribute_audit(request, administrator): |
| 955 | 955 |
contribution_id = request.POST.get('contribution_id', '')
|
| 956 |
- audit = get_query_value(request, 'audit', val_cast_type='int') |
|
| 956 |
+ audit_status = get_query_value(request, 'audit_status', val_cast_type='int') |
|
| 957 | 957 |
|
| 958 | 958 |
try: |
| 959 | 959 |
contribution = MemberActivityContributionInfo.objects.select_for_update().get(contribution_id=contribution_id, status=True) |
| 960 | 960 |
except MemberActivityContributionInfo.DoesNotExist: |
| 961 | 961 |
return response(MemberActivityContributionStatusCode.ACTIVITY_CONTRIBUTION_NOT_FOUND) |
| 962 | 962 |
|
| 963 |
- contribution.is_audit_pass = audit |
|
| 963 |
+ contribution.audit_status = audit_status |
|
| 964 | 964 |
contribution.save() |
| 965 | 965 |
|
| 966 | 966 |
return response(200, 'Member Activity Contribution Audit Success', u'会员活动投稿审批成功') |
@@ -1027,6 +1027,7 @@ def member_activity_contribute_welfare_detail(request, administrator): |
||
| 1027 | 1027 |
|
| 1028 | 1028 |
@check_admin |
| 1029 | 1029 |
def member_activity_contribute_welfare_update(request, administrator): |
| 1030 |
+ activity_id = request.POST.get('activity_id', '')
|
|
| 1030 | 1031 |
welfare_id = request.POST.get('welfare_id', '')
|
| 1031 | 1032 |
welfare_type = int(request.POST.get('welfare_type', 0))
|
| 1032 | 1033 |
welfare_title = request.POST.get('welfare_title', '')
|
@@ -1039,6 +1040,7 @@ def member_activity_contribute_welfare_update(request, administrator): |
||
| 1039 | 1040 |
except MemberActivityContributionWelfareInfo.DoesNotExist: |
| 1040 | 1041 |
return response() |
| 1041 | 1042 |
|
| 1043 |
+ welfare.activity_id = activity_id |
|
| 1042 | 1044 |
welfare.welfare_type = welfare_type |
| 1043 | 1045 |
welfare.welfare_title = welfare_title |
| 1044 | 1046 |
welfare.welfare_detail = welfare_detail |
@@ -1051,6 +1053,7 @@ def member_activity_contribute_welfare_update(request, administrator): |
||
| 1051 | 1053 |
|
| 1052 | 1054 |
@check_admin |
| 1053 | 1055 |
def member_activity_contribute_welfare_create(request, administrator): |
| 1056 |
+ activity_id = request.POST.get('activity_id', '')
|
|
| 1054 | 1057 |
welfare_type = int(request.POST.get('welfare_type', 0))
|
| 1055 | 1058 |
welfare_title = request.POST.get('welfare_title', '')
|
| 1056 | 1059 |
welfare_detail = request.POST.get('welfare_detail', '')
|
@@ -1059,6 +1062,7 @@ def member_activity_contribute_welfare_create(request, administrator): |
||
| 1059 | 1062 |
|
| 1060 | 1063 |
MemberActivityContributionWelfareInfo.objects.create( |
| 1061 | 1064 |
brand_id=administrator.brand_id, |
| 1065 |
+ activity_id=activity_id, |
|
| 1062 | 1066 |
welfare_type=welfare_type, |
| 1063 | 1067 |
welfare_title=welfare_title, |
| 1064 | 1068 |
welfare_detail=welfare_detail, |
@@ -554,7 +554,7 @@ def activity_contribute_list(request): |
||
| 554 | 554 |
page = request.POST.get('page', 1)
|
| 555 | 555 |
num = request.POST.get('num', 20)
|
| 556 | 556 |
|
| 557 |
- contributions = MemberActivityContributionInfo.objects.filter(content_type=content_type, is_audit_pass=True, status=True) |
|
| 557 |
+ contributions = MemberActivityContributionInfo.objects.filter(content_type=content_type, audit_status=MemberActivityContributionInfo.AUDIT_PASS, status=True) |
|
| 558 | 558 |
if user_id: |
| 559 | 559 |
contributions = contributions.filter(user_id=user_id) |
| 560 | 560 |
if activity_id: |
@@ -99,13 +99,13 @@ class MemberActivityGroupShareInfoAdmin(admin.ModelAdmin): |
||
| 99 | 99 |
|
| 100 | 100 |
|
| 101 | 101 |
class MemberActivityContributionInfoAdmin(admin.ModelAdmin): |
| 102 |
- list_display = ('contribution_id', 'activity_id', 'content_type', 'title', 'content', 'images', 'video_url', 'is_audit_pass', 'is_selected', 'status', 'created_at', 'updated_at')
|
|
| 103 |
- list_filter = ('activity_id', 'content_type', 'is_audit_pass', 'is_selected', 'status')
|
|
| 102 |
+ list_display = ('contribution_id', 'activity_id', 'content_type', 'title', 'content', 'images', 'video_url', 'audit_status', 'is_selected', 'status', 'created_at', 'updated_at')
|
|
| 103 |
+ list_filter = ('activity_id', 'content_type', 'audit_status', 'is_selected', 'status')
|
|
| 104 | 104 |
|
| 105 | 105 |
|
| 106 | 106 |
class MemberActivityContributionWelfareInfoAdmin(admin.ModelAdmin): |
| 107 |
- list_display = ('welfare_id', 'welfare_type', 'welfare_title', 'welfare_detail', 'welfare_value', 'welfare_image', 'status', 'created_at', 'updated_at')
|
|
| 108 |
- list_filter = ('welfare_type', 'status')
|
|
| 107 |
+ list_display = ('activity_id', 'welfare_id', 'welfare_type', 'welfare_title', 'welfare_detail', 'welfare_value', 'welfare_image', 'status', 'created_at', 'updated_at')
|
|
| 108 |
+ list_filter = ('activity_id', 'welfare_type', 'status')
|
|
| 109 | 109 |
|
| 110 | 110 |
|
| 111 | 111 |
admin.site.register(GoodsInfo, GoodsInfoAdmin) |
@@ -0,0 +1,19 @@ |
||
| 1 |
+# -*- coding: utf-8 -*- |
|
| 2 |
+# Generated by Django 3.2.16 on 2022-10-25 02:52 |
|
| 3 |
+ |
|
| 4 |
+from django.db import migrations, models |
|
| 5 |
+ |
|
| 6 |
+ |
|
| 7 |
+class Migration(migrations.Migration): |
|
| 8 |
+ |
|
| 9 |
+ dependencies = [ |
|
| 10 |
+ ('member', '0039_memberactivitycontributionwelfareinfo_is_upload_qiniu'),
|
|
| 11 |
+ ] |
|
| 12 |
+ |
|
| 13 |
+ operations = [ |
|
| 14 |
+ migrations.AddField( |
|
| 15 |
+ model_name='memberactivitycontributionwelfareinfo', |
|
| 16 |
+ name='activity_id', |
|
| 17 |
+ field=models.CharField(blank=True, db_index=True, help_text='活动唯一标识', max_length=32, null=True, verbose_name='activity_id'), |
|
| 18 |
+ ), |
|
| 19 |
+ ] |
@@ -0,0 +1,23 @@ |
||
| 1 |
+# -*- coding: utf-8 -*- |
|
| 2 |
+# Generated by Django 3.2.16 on 2022-10-25 04:36 |
|
| 3 |
+ |
|
| 4 |
+from django.db import migrations, models |
|
| 5 |
+ |
|
| 6 |
+ |
|
| 7 |
+class Migration(migrations.Migration): |
|
| 8 |
+ |
|
| 9 |
+ dependencies = [ |
|
| 10 |
+ ('member', '0040_memberactivitycontributionwelfareinfo_activity_id'),
|
|
| 11 |
+ ] |
|
| 12 |
+ |
|
| 13 |
+ operations = [ |
|
| 14 |
+ migrations.RemoveField( |
|
| 15 |
+ model_name='memberactivitycontributioninfo', |
|
| 16 |
+ name='is_audit_pass', |
|
| 17 |
+ ), |
|
| 18 |
+ migrations.AddField( |
|
| 19 |
+ model_name='memberactivitycontributioninfo', |
|
| 20 |
+ name='audit_status', |
|
| 21 |
+ field=models.IntegerField(choices=[(0, '未审批'), (1, '已通过'), (2, '未通过')], db_index=True, default=0, help_text='审批状态', verbose_name='audit_status'), |
|
| 22 |
+ ), |
|
| 23 |
+ ] |
@@ -671,6 +671,13 @@ class MemberActivityContributionInfo(BaseModelMixin): |
||
| 671 | 671 |
# (2, u'入围'), |
| 672 | 672 |
) |
| 673 | 673 |
|
| 674 |
+ AUDIT_PASS = 1 |
|
| 675 |
+ AUDIT_STATUS = ( |
|
| 676 |
+ (0, u'未审批'), |
|
| 677 |
+ (1, u'已通过'), |
|
| 678 |
+ (2, u'未通过'), |
|
| 679 |
+ ) |
|
| 680 |
+ |
|
| 674 | 681 |
brand_id = models.CharField(_(u'brand_id'), max_length=32, blank=True, null=True, help_text=u'品牌唯一标识', db_index=True) |
| 675 | 682 |
brand_name = models.CharField(_(u'brand_name'), max_length=255, blank=True, null=True, help_text=u'品牌名称') |
| 676 | 683 |
|
@@ -694,7 +701,7 @@ class MemberActivityContributionInfo(BaseModelMixin): |
||
| 694 | 701 |
images = JSONField(_(u'images'), default=[], help_text=u'图片列表') |
| 695 | 702 |
video_url = models.CharField(_(u'video_url'), max_length=255, blank=True, null=True, help_text=u'视频链接') |
| 696 | 703 |
|
| 697 |
- is_audit_pass = models.BooleanField(_(u'is_audit_pass'), default=False, help_text=u'是否审核通过') |
|
| 704 |
+ audit_status = models.IntegerField(_(u'audit_status'), choices=AUDIT_STATUS, default=0, help_text=u'审批状态', db_index=True) |
|
| 698 | 705 |
is_selected = models.BooleanField(_(u'is_selected'), default=False, help_text=u'是否入围') |
| 699 | 706 |
|
| 700 | 707 |
class Meta: |
@@ -716,6 +723,9 @@ class MemberActivityContributionInfo(BaseModelMixin): |
||
| 716 | 723 |
'content': self.content, |
| 717 | 724 |
'images': self.images, |
| 718 | 725 |
'video_url': self.video_url or '', |
| 726 |
+ 'audit_status': self.audit_status, |
|
| 727 |
+ 'audit_status_str': dict(MemberActivityContributionInfo.AUDIT_STATUS).get(self.audit_status), |
|
| 728 |
+ 'is_selected': self.is_selected, |
|
| 719 | 729 |
'created_at': tc.local_string(utc_dt=self.created_at), |
| 720 | 730 |
} |
| 721 | 731 |
|
@@ -730,6 +740,8 @@ class MemberActivityContributionWelfareInfo(BaseModelMixin): |
||
| 730 | 740 |
brand_id = models.CharField(_(u'brand_id'), max_length=32, blank=True, null=True, help_text=u'品牌唯一标识', db_index=True) |
| 731 | 741 |
brand_name = models.CharField(_(u'brand_name'), max_length=255, blank=True, null=True, help_text=u'品牌名称') |
| 732 | 742 |
|
| 743 |
+ activity_id = models.CharField(_(u'activity_id'), max_length=32, blank=True, null=True, help_text=u'活动唯一标识', db_index=True) |
|
| 744 |
+ |
|
| 733 | 745 |
welfare_id = ShortUUIDField(_(u'welfare_id'), max_length=32, blank=True, null=True, help_text=u'福利唯一标识', db_index=True, unique=True) |
| 734 | 746 |
|
| 735 | 747 |
welfare_type = models.IntegerField(_(u'welfare_type'), choices=WELFARE_TYPE, default=0, help_text=u'福利类型', db_index=True) |
@@ -759,6 +771,7 @@ class MemberActivityContributionWelfareInfo(BaseModelMixin): |
||
| 759 | 771 |
@property |
| 760 | 772 |
def data(self): |
| 761 | 773 |
return {
|
| 774 |
+ 'activity_id': self.activity_id, |
|
| 762 | 775 |
'welfare_id': self.welfare_id, |
| 763 | 776 |
'welfare_type': self.welfare_type, |
| 764 | 777 |
'welfare_type_str': dict(MemberActivityContributionWelfareInfo.WELFARE_TYPE).get(self.welfare_type), |