@@ -842,18 +842,19 @@ def member_activity_update(request): |
||
842 | 842 |
subtitle = request.POST.get('subtitle', '') |
843 | 843 |
date = request.POST.get('date', '') |
844 | 844 |
city = request.POST.get('city', '') |
845 |
- location = request.POST.get('location', '') |
|
846 |
- integral = request.POST.get('integral', '') |
|
845 |
+ location = request.POST.get('location', 0) |
|
846 |
+ integral = int(request.POST.get('integral', 0)) |
|
847 | 847 |
cover_url = request.POST.get('cover_path', '') |
848 | 848 |
slider_image = request.POST.get('banner_path', '') |
849 | 849 |
image = request.POST.get('banner_path', '') |
850 | 850 |
is_signup = request.POST.get('is_signup', '') |
851 |
- group_share_integral = request.POST.get('share_integral', '') |
|
852 |
- group_share_max_integral = request.POST.get('group_share_max_integral', '') |
|
853 |
- group_share_integral = request.POST.get('share_integral', '') |
|
851 |
+ group_share_integral = int(request.POST.get('share_integral', 0)) |
|
852 |
+ group_share_max_integral = int(request.POST.get('group_share_max_integral', 0)) |
|
853 |
+ group_share_integral = int(request.POST.get('share_integral', 0)) |
|
854 | 854 |
is_slider = request.POST.get('is_slider', '') |
855 | 855 |
content_rich_text = request.POST.get('content_rich_text', '') |
856 | 856 |
share_h5_link = request.POST.get('share_h5_link', '') |
857 |
+ activity_state = int(request.POST.get('activity_state', 0)) |
|
857 | 858 |
|
858 | 859 |
if brand_id != settings.KODO_DEFAULT_BRAND_ID: |
859 | 860 |
return response(ProductBrandStatusCode.BRAND_NOT_MATCH) |
@@ -870,13 +871,13 @@ def member_activity_update(request): |
||
870 | 871 |
|
871 | 872 |
log.title = title |
872 | 873 |
log.subtitle = subtitle |
873 |
- log.date = date |
|
874 |
+ log.date = datetime.strptime(date + ' 23:59:59', '%Y-%m-%d %H:%M:%S') |
|
874 | 875 |
log.city = city |
875 | 876 |
log.location = location |
876 | 877 |
log.integral = integral |
877 |
- log.cover_url = cover_url |
|
878 |
+ log.cover = cover_url |
|
878 | 879 |
log.slider_image = slider_image |
879 |
- log.image = image |
|
880 |
+ log.image = slider_image |
|
880 | 881 |
log.is_signup = is_signup |
881 | 882 |
log.group_share_integral = group_share_integral |
882 | 883 |
log.group_share_max_integral = group_share_max_integral |
@@ -884,6 +885,7 @@ def member_activity_update(request): |
||
884 | 885 |
log.is_slider = is_slider |
885 | 886 |
log.content_rich_text = content_rich_text |
886 | 887 |
log.share_h5_link = share_h5_link |
888 |
+ log.activity_state = activity_state |
|
887 | 889 |
log.save() |
888 | 890 |
|
889 | 891 |
return response(200, 'MemberActivityInfo Update Success', u'会员活动更新成功') |
@@ -895,17 +897,20 @@ def member_activity_create(request): |
||
895 | 897 |
subtitle = request.POST.get('subtitle', '') |
896 | 898 |
date = request.POST.get('date', '') |
897 | 899 |
city = request.POST.get('city', '') |
898 |
- location = request.POST.get('location', '') |
|
899 |
- integral = request.POST.get('integral', '') |
|
900 |
+ location = request.POST.get('location', 0) |
|
901 |
+ integral = int(request.POST.get('integral', 0)) |
|
900 | 902 |
cover_url = request.POST.get('cover_path', '') |
901 | 903 |
slider_image = request.POST.get('banner_path', '') |
902 | 904 |
image = request.POST.get('banner_path', '') |
903 | 905 |
is_signup = request.POST.get('is_signup', '') |
904 |
- group_share_max_integral = request.POST.get('group_share_max_integral', '') |
|
905 |
- group_share_integral = request.POST.get('share_integral', '') |
|
906 |
+ group_share_integral = int(request.POST.get('share_integral', 0)) |
|
907 |
+ group_share_max_integral = int(request.POST.get('group_share_max_integral', 0)) |
|
908 |
+ group_share_integral = int(request.POST.get('share_integral', 0)) |
|
906 | 909 |
is_slider = request.POST.get('is_slider', '') |
907 | 910 |
content_rich_text = request.POST.get('content_rich_text', '') |
908 | 911 |
share_h5_link = request.POST.get('share_h5_link', '') |
912 |
+ activity_state = int(request.POST.get('activity_state', 0)) |
|
913 |
+ |
|
909 | 914 |
|
910 | 915 |
if brand_id != settings.KODO_DEFAULT_BRAND_ID: |
911 | 916 |
return response(ProductBrandStatusCode.BRAND_NOT_MATCH) |
@@ -923,7 +928,7 @@ def member_activity_create(request): |
||
923 | 928 |
city=city, |
924 | 929 |
location=location, |
925 | 930 |
integral=integral, |
926 |
- cover_url=cover_url, |
|
931 |
+ cover=cover_url, |
|
927 | 932 |
slider_image=slider_image, |
928 | 933 |
image=image, |
929 | 934 |
is_signup=is_signup, |
@@ -336,7 +336,7 @@ def activity_list(request): |
||
336 | 336 |
brand_id = request.POST.get('brand_id', settings.KODO_DEFAULT_BRAND_ID) |
337 | 337 |
user_id = request.POST.get('user_id', '') |
338 | 338 |
|
339 |
- raw_activitys = MemberActivityInfo.objects.filter(status=True).order_by('-date') |
|
339 |
+ raw_activitys = MemberActivityInfo.objects.filter(activity_state=1, status=True).order_by('-date') |
|
340 | 340 |
banners = [] |
341 | 341 |
activitys = [] |
342 | 342 |
for act in raw_activitys: |
@@ -0,0 +1,20 @@ |
||
1 |
+# -*- coding: utf-8 -*- |
|
2 |
+# Generated by Django 1.11.26 on 2020-12-03 08:06 |
|
3 |
+from __future__ import unicode_literals |
|
4 |
+ |
|
5 |
+from django.db import migrations, models |
|
6 |
+ |
|
7 |
+ |
|
8 |
+class Migration(migrations.Migration): |
|
9 |
+ |
|
10 |
+ dependencies = [ |
|
11 |
+ ('member', '0022_auto_20201203_1500'), |
|
12 |
+ ] |
|
13 |
+ |
|
14 |
+ operations = [ |
|
15 |
+ migrations.AddField( |
|
16 |
+ model_name='memberactivityinfo', |
|
17 |
+ name='activity_state', |
|
18 |
+ field=models.IntegerField(choices=[(0, '\u8349\u7a3f'), (1, '\u5df2\u53d1\u5e03')], db_index=True, default=0, help_text='\u6d3b\u52a8\u72b6\u6001', verbose_name='activity_state'), |
|
19 |
+ ), |
|
20 |
+ ] |
@@ -282,6 +282,11 @@ class ShotTypeInfo(BaseModelMixin): |
||
282 | 282 |
|
283 | 283 |
|
284 | 284 |
class MemberActivityInfo(BaseModelMixin): |
285 |
+ ACTIVITY_STATE = ( |
|
286 |
+ (0, u'草稿'), |
|
287 |
+ (1, u'已发布'), |
|
288 |
+ (2, u'下线'), |
|
289 |
+ ) |
|
285 | 290 |
brand_id = models.CharField(_(u'brand_id'), max_length=32, blank=True, default='', help_text=u'品牌唯一标识', db_index=True) |
286 | 291 |
brand_name = models.CharField(_(u'brand_name'), max_length=255, blank=True, default='', help_text=u'品牌名称') |
287 | 292 |
|
@@ -314,6 +319,8 @@ class MemberActivityInfo(BaseModelMixin): |
||
314 | 319 |
|
315 | 320 |
is_signup = models.BooleanField(_(u'is_signup'), default=True, help_text=u'是否有报名功能') |
316 | 321 |
|
322 |
+ activity_state = models.IntegerField(_(u'activity_state'), choices=ACTIVITY_STATE, default=0, help_text=u'活动状态', db_index=True) |
|
323 |
+ |
|
317 | 324 |
position = models.IntegerField(_(u'position'), default=1, help_text=u'排序', db_index=True) |
318 | 325 |
|
319 | 326 |
class Meta: |
@@ -397,9 +404,11 @@ class MemberActivityInfo(BaseModelMixin): |
||
397 | 404 |
'integral': self.integral, |
398 | 405 |
'content_rich_text': self.content_rich_text, |
399 | 406 |
'cover_url': self.cover_url, |
407 |
+ 'cover_path': self.cover_path, |
|
400 | 408 |
'share_img_link': self.share_img_link, |
401 | 409 |
'share_h5_link': self.share_h5_link, |
402 | 410 |
'slider_image': self.slider_image_url, |
411 |
+ 'banner_path': self.slider_path, |
|
403 | 412 |
'state': self.final_state, |
404 | 413 |
'is_signed': self.is_signed(user_id), |
405 | 414 |
'is_signup': self.is_signup, |
@@ -426,6 +435,8 @@ class MemberActivityInfo(BaseModelMixin): |
||
426 | 435 |
'is_signup': self.is_signup, |
427 | 436 |
'share_integral': self.group_share_integral, |
428 | 437 |
'share_max_integral': self.group_share_max_integral, |
438 |
+ 'is_slider': self.is_slider, |
|
439 |
+ 'activity_state': self.activity_state, |
|
429 | 440 |
'created_at': tc.local_string(utc_dt=self.created_at, format='%Y-%m-%d %H:%M:%S'), |
430 | 441 |
} |
431 | 442 |
|
@@ -451,6 +462,8 @@ class MemberActivityInfo(BaseModelMixin): |
||
451 | 462 |
'is_signup': self.is_signup, |
452 | 463 |
'share_integral': self.group_share_integral, |
453 | 464 |
'share_max_integral': self.group_share_max_integral, |
465 |
+ 'activity_state': self.activity_state, |
|
466 |
+ 'is_slider': self.is_slider, |
|
454 | 467 |
'created_at': tc.local_string(utc_dt=self.created_at, format='%Y-%m-%d %H:%M:%S'), |
455 | 468 |
} |
456 | 469 |
|