| @@ -382,6 +382,7 @@ def activity_signup(request): | ||
| 382 | 382 |      brand_id = request.POST.get('brand_id', settings.KODO_DEFAULT_BRAND_ID) | 
| 383 | 383 |      user_id = request.POST.get('user_id', '') | 
| 384 | 384 |      activity_id = request.POST.get('activity_id', '') | 
| 385 | +    avatar = request.POST.get('avatar', '') | |
| 385 | 386 |      name = request.POST.get('name', '') | 
| 386 | 387 |      phone = request.POST.get('phone', '') | 
| 387 | 388 |  | 
| @@ -393,9 +394,12 @@ def activity_signup(request): | ||
| 393 | 394 |      MemberActivitySignupInfo.objects.update_or_create(user_id=user_id, activity_id=activity_id, defaults={ | 
| 394 | 395 | 'title': act.title, | 
| 395 | 396 | 'name': name, | 
| 397 | + 'avatar': avatar, | |
| 396 | 398 | 'phone': phone, | 
| 397 | 399 | }) | 
| 398 | 400 |  | 
| 401 | + MemberActivityContributionInfo.objects.filter(user_id=user_id, activity_id=activity_id).update(user_name=name, user_avatar=avatar) | |
| 402 | + | |
| 399 | 403 | # TODO: 立即推送模版消息(报名成功,时间,地点) | 
| 400 | 404 | # TODO: 延迟(活动当天)推送模版消息(时间,地点) | 
| 401 | 405 |  | 
| @@ -405,6 +409,26 @@ def activity_signup(request): | ||
| 405 | 409 |  | 
| 406 | 410 |  | 
| 407 | 411 | @logit | 
| 412 | +def activity_signup_info(request): | |
| 413 | +    brand_id = request.POST.get('brand_id', settings.KODO_DEFAULT_BRAND_ID) | |
| 414 | +    user_id = request.POST.get('user_id', '') | |
| 415 | +    activity_id = request.POST.get('activity_id', '') | |
| 416 | + | |
| 417 | + try: | |
| 418 | + signup_info = MemberActivitySignupInfo.objects.get(user_id=user_id, activity_id=activity_id, status=True) | |
| 419 | + contribution = MemberActivityContributionInfo.objects.get(user_id=user_id, activity_id=activity_id, content_type=0, status=True) | |
| 420 | + except MemberActivitySigninInfo.DoesNotExist: | |
| 421 | + return response() | |
| 422 | + except MemberActivityContributionInfo.DoesNotExist: | |
| 423 | + return response() | |
| 424 | + | |
| 425 | +    return response(data={ | |
| 426 | + 'signup_info': signup_info.data, | |
| 427 | + 'contribution': contribution.data | |
| 428 | + }) | |
| 429 | + | |
| 430 | + | |
| 431 | +@logit | |
| 408 | 432 | @transaction.atomic | 
| 409 | 433 | def activity_signin(request): | 
| 410 | 434 |      brand_id = request.POST.get('brand_id', settings.KODO_DEFAULT_BRAND_ID) | 
| @@ -530,6 +554,11 @@ def activity_contribute(request): | ||
| 530 | 554 | except UserInfo.DoesNotExist: | 
| 531 | 555 | return response(UserStatusCode.USER_NOT_FOUND) | 
| 532 | 556 |  | 
| 557 | + try: | |
| 558 | + signup_info = MemberActivitySignupInfo.objects.get(user_id=user_id, activity_id=activity_id, status=True) | |
| 559 | + except: | |
| 560 | + signup_info = NULL | |
| 561 | + | |
| 533 | 562 | contribution = MemberActivityContributionInfo.objects.create( | 
| 534 | 563 | brand_id=brand_id, | 
| 535 | 564 | user_id=user_id, | 
| @@ -539,6 +568,8 @@ def activity_contribute(request): | ||
| 539 | 568 | content=content, | 
| 540 | 569 | images=images, | 
| 541 | 570 | video_url=video_url, | 
| 571 | + user_name=signup_info.name if signup_info else '', | |
| 572 | + user_avatar=signup_info.avatar if signup_info else '' | |
| 542 | 573 | ) | 
| 543 | 574 |  | 
| 544 | 575 |      return response(data={ | 
| @@ -0,0 +1,18 @@ | ||
| 1 | +# Generated by Django 3.2.8 on 2022-10-26 06:02 | |
| 2 | + | |
| 3 | +from django.db import migrations, models | |
| 4 | + | |
| 5 | + | |
| 6 | +class Migration(migrations.Migration): | |
| 7 | + | |
| 8 | + dependencies = [ | |
| 9 | +        ('coupon', '0016_auto_20201202_1203'), | |
| 10 | + ] | |
| 11 | + | |
| 12 | + operations = [ | |
| 13 | + migrations.AlterField( | |
| 14 | + model_name='usercouponinfo', | |
| 15 | + name='coupon_from', | |
| 16 | + field=models.CharField(blank=True, db_index=True, default='MEMBER_BENEFITS', help_text='劵来源', max_length=32, null=True, verbose_name='coupon_from'), | |
| 17 | + ), | |
| 18 | + ] | 
| @@ -0,0 +1,28 @@ | ||
| 1 | +# Generated by Django 3.2.8 on 2022-10-26 06:02 | |
| 2 | + | |
| 3 | +from django.db import migrations, models | |
| 4 | + | |
| 5 | + | |
| 6 | +class Migration(migrations.Migration): | |
| 7 | + | |
| 8 | + dependencies = [ | |
| 9 | +        ('member', '0043_auto_20221026_0221'), | |
| 10 | + ] | |
| 11 | + | |
| 12 | + operations = [ | |
| 13 | + migrations.AddField( | |
| 14 | + model_name='memberactivitycontributioninfo', | |
| 15 | + name='user_avatar', | |
| 16 | + field=models.CharField(blank=True, help_text='用户头像', max_length=255, null=True, verbose_name='avatar'), | |
| 17 | + ), | |
| 18 | + migrations.AddField( | |
| 19 | + model_name='memberactivitycontributioninfo', | |
| 20 | + name='user_name', | |
| 21 | + field=models.CharField(blank=True, help_text='用户名称', max_length=255, null=True, verbose_name='name'), | |
| 22 | + ), | |
| 23 | + migrations.AddField( | |
| 24 | + model_name='memberactivitysignupinfo', | |
| 25 | + name='avatar', | |
| 26 | + field=models.CharField(blank=True, help_text='头像', max_length=255, null=True, verbose_name='avatar'), | |
| 27 | + ), | |
| 28 | + ] | 
| @@ -567,6 +567,7 @@ class MemberActivitySignupInfo(BaseModelMixin, BrandInfoMixin): | ||
| 567 | 567 |  | 
| 568 | 568 | title = models.CharField(_(u'title'), max_length=255, blank=True, null=True, help_text=u'活动名称') | 
| 569 | 569 |  | 
| 570 | + avatar = models.CharField(_(u'avatar'), max_length=255, blank=True, null=True, help_text=u'头像') | |
| 570 | 571 | name = models.CharField(_(u'name'), max_length=255, blank=True, null=True, help_text=u'姓名') | 
| 571 | 572 | phone = models.CharField(_(u'phone'), max_length=255, blank=True, null=True, help_text=u'电话') | 
| 572 | 573 |  | 
| @@ -588,6 +589,7 @@ class MemberActivitySignupInfo(BaseModelMixin, BrandInfoMixin): | ||
| 588 | 589 | 'user_id': self.user_id, | 
| 589 | 590 | 'activity_id': self.activity_id, | 
| 590 | 591 | 'title': self.title, | 
| 592 | + 'avatar': self.avatar, | |
| 591 | 593 | 'name': self.name, | 
| 592 | 594 | 'phone': self.phone, | 
| 593 | 595 | } | 
| @@ -666,6 +668,8 @@ class MemberActivityContributionInfo(BaseModelMixin, BrandInfoMixin): | ||
| 666 | 668 | # 传参图片列表(默认第一张为封面图,包括图片url、宽、高)、标题、内容(纯文本)。 | 
| 667 | 669 | title = models.CharField(_(u'title'), max_length=255, blank=True, null=True, help_text=u'标题') | 
| 668 | 670 | content = models.TextField(_(u'content'), blank=True, null=True, help_text=u'内容') | 
| 671 | + user_avatar = models.CharField(_(u'avatar'), max_length=255, blank=True, null=True, help_text=u'用户头像') | |
| 672 | + user_name = models.CharField(_(u'name'), max_length=255, blank=True, null=True, help_text=u'用户名称') | |
| 669 | 673 | # content_rich_text = RichTextField(_(u'content_rich_text'), blank=True, default='', help_text=u'内容') | 
| 670 | 674 |      # [{ | 
| 671 | 675 | # 'image_url': '', | 
| @@ -697,6 +701,8 @@ class MemberActivityContributionInfo(BaseModelMixin, BrandInfoMixin): | ||
| 697 | 701 | 'content_type_str': dict(MemberActivityContributionInfo.CONTENT_TYPE).get(self.content_type), | 
| 698 | 702 | 'title': self.title, | 
| 699 | 703 | 'content': self.content, | 
| 704 | + 'user_name': self.user_name, | |
| 705 | + 'user_avatar': self.user_avatar, | |
| 700 | 706 | 'images': self.images, | 
| 701 | 707 | 'video_url': self.video_url or '', | 
| 702 | 708 | 'audit_status': self.audit_status, |