|
|
|
@@ -124,7 +124,7 @@ class GoodsInfo(BaseModelMixin):
|
|
124
|
124
|
'value': self.value,
|
|
125
|
125
|
'left_num': self.left_num,
|
|
126
|
126
|
'coupon': coupon,
|
|
127
|
|
- 'created_at': tc.local_string(utc_dt=self.created_at, format='%Y-%m-%d %H:%M:%S'),
|
|
|
127
|
+ 'created_at': tc.local_string(utc_dt=self.created_at),
|
|
128
|
128
|
}
|
|
129
|
129
|
|
|
130
|
130
|
@property
|
|
|
|
@@ -147,7 +147,7 @@ class GoodsInfo(BaseModelMixin):
|
|
147
|
147
|
'desc': self.desc,
|
|
148
|
148
|
'left_num': self.left_num,
|
|
149
|
149
|
'coupon': coupon,
|
|
150
|
|
- 'created_at': tc.local_string(utc_dt=self.created_at, format='%Y-%m-%d %H:%M:%S'),
|
|
|
150
|
+ 'created_at': tc.local_string(utc_dt=self.created_at),
|
|
151
|
151
|
}
|
|
152
|
152
|
|
|
153
|
153
|
|
|
|
|
@@ -207,7 +207,7 @@ class GoodsOrderInfo(BaseModelMixin):
|
|
207
|
207
|
'user_address': self.address,
|
|
208
|
208
|
'tracking_number': self.tracking_number,
|
|
209
|
209
|
'integral': self.integral,
|
|
210
|
|
- 'created_at': tc.local_string(utc_dt=self.created_at, format='%Y-%m-%d %H:%M:%S'),
|
|
|
210
|
+ 'created_at': tc.local_string(utc_dt=self.created_at),
|
|
211
|
211
|
'send_template_message_res': json.loads(self.send_template_message_res) if self.send_template_message_res else '',
|
|
212
|
212
|
'remark': self.remark
|
|
213
|
213
|
}
|
|
|
|
@@ -342,20 +342,35 @@ class ShotTypeInfo(BaseModelMixin):
|
|
342
|
342
|
|
|
343
|
343
|
|
|
344
|
344
|
class MemberActivityInfo(BaseModelMixin):
|
|
|
345
|
+ ACTIVITY_TYPE = (
|
|
|
346
|
+ (0, u'线下活动'),
|
|
|
347
|
+ (1, u'公众号文章'),
|
|
|
348
|
+ (2, u'线上活动'),
|
|
|
349
|
+ (3, u'投稿活动'),
|
|
|
350
|
+ )
|
|
|
351
|
+
|
|
345
|
352
|
ACTIVITY_STATE = (
|
|
346
|
353
|
(0, u'草稿'),
|
|
347
|
354
|
(1, u'已发布'),
|
|
348
|
355
|
(2, u'下线'),
|
|
349
|
356
|
)
|
|
|
357
|
+
|
|
350
|
358
|
brand_id = models.CharField(_(u'brand_id'), max_length=32, blank=True, default='', help_text=u'品牌唯一标识', db_index=True)
|
|
351
|
359
|
brand_name = models.CharField(_(u'brand_name'), max_length=255, blank=True, default='', help_text=u'品牌名称')
|
|
352
|
360
|
|
|
353
|
361
|
activity_id = ShortUUIDField(_(u'activity_id'), max_length=32, blank=True, help_text=u'活动唯一标识', db_index=True, unique=True)
|
|
354
|
362
|
|
|
|
363
|
+ activity_type = models.IntegerField(_(u'activity_type'), choices=ACTIVITY_TYPE, default=0, help_text=u'活动类型', db_index=True)
|
|
|
364
|
+
|
|
355
|
365
|
title = models.CharField(_(u'title'), max_length=255, blank=True, default='', help_text=u'活动名称')
|
|
356
|
366
|
subtitle = models.CharField(_(u'subtitle'), max_length=255, blank=True, default='', help_text=u'活动二级名称')
|
|
357
|
367
|
|
|
358
|
368
|
date = models.DateField(_(u'date'), blank=True, null=True, help_text=u'活动时间')
|
|
|
369
|
+ start_date = models.DateField(_(u'start_date'), blank=True, null=True, help_text=u'活动报名开始日期')
|
|
|
370
|
+ end_date = models.DateField(_(u'end_date'), blank=True, null=True, help_text=u'活动报名截止日期')
|
|
|
371
|
+ start_display_date = models.DateField(_(u'start_display_date'), blank=True, null=True, help_text=u'活动展示开始日期')
|
|
|
372
|
+ end_display_date = models.DateField(_(u'end_display_date'), blank=True, null=True, help_text=u'活动展示截止日期')
|
|
|
373
|
+
|
|
359
|
374
|
city = models.CharField(_(u'city'), max_length=255, blank=True, default='', help_text=u'活动城市')
|
|
360
|
375
|
location = models.CharField(_(u'location'), max_length=255, blank=True, default='', help_text=u'活动地点')
|
|
361
|
376
|
lat = models.FloatField(_(u'lat'), default=1.0, help_text=u'纬度')
|
|
|
|
@@ -365,12 +380,11 @@ class MemberActivityInfo(BaseModelMixin):
|
|
365
|
380
|
group_share_integral = models.IntegerField(_(u'group_share_integral'), default=0, help_text=u'群组分享会员积分')
|
|
366
|
381
|
group_share_max_integral = models.IntegerField(_(u'group_share_max_integral'), default=0, help_text=u'群组分享会员积分单人上限')
|
|
367
|
382
|
|
|
368
|
|
- image = models.ImageField(_(u'image'), upload_to=upload_path, blank=True, help_text=u'活动内容图片')
|
|
369
|
|
-
|
|
370
|
|
- cover = models.ImageField(_(u'cover'), upload_to=upload_path, blank=True, help_text=u'活动列表图片')
|
|
371
|
|
-
|
|
372
|
383
|
is_slider = models.BooleanField(_(u'is_slider'), default=True, help_text=u'是否为轮播活动')
|
|
373
|
384
|
slider_image = models.ImageField(_(u'slider_image'), upload_to=upload_path, blank=True, help_text=u'活动轮播图片')
|
|
|
385
|
+ cover = models.ImageField(_(u'cover'), upload_to=upload_path, blank=True, help_text=u'活动列表图片')
|
|
|
386
|
+ limit_image_num = models.IntegerField(_(u'limit_image_num'), default=3, help_text=u'限制图片数量')
|
|
|
387
|
+ image = models.ImageField(_(u'image'), upload_to=upload_path, blank=True, help_text=u'活动内容图片')
|
|
374
|
388
|
|
|
375
|
389
|
content_rich_text = RichTextField(_(u'content_rich_text'), blank=True, default='', help_text=u'活动描述')
|
|
376
|
390
|
|
|
|
|
@@ -393,12 +407,12 @@ class MemberActivityInfo(BaseModelMixin):
|
|
393
|
407
|
return '%d' % self.pk
|
|
394
|
408
|
|
|
395
|
409
|
@property
|
|
396
|
|
- def image_path(self):
|
|
397
|
|
- return upload_file_path(self.image)
|
|
|
410
|
+ def slider_image_path(self):
|
|
|
411
|
+ return upload_file_path(self.slider_image)
|
|
398
|
412
|
|
|
399
|
413
|
@property
|
|
400
|
|
- def image_url(self):
|
|
401
|
|
- return qiniu_file_url(self.image.name, bucket='tamron') if self.is_upload_qiniu else upload_file_url(self.image)
|
|
|
414
|
+ def slider_image_url(self):
|
|
|
415
|
+ return qiniu_file_url(self.slider_image.name, bucket='tamron') if self.is_upload_qiniu else upload_file_url(self.slider_image)
|
|
402
|
416
|
|
|
403
|
417
|
@property
|
|
404
|
418
|
def cover_path(self):
|
|
|
|
@@ -408,13 +422,13 @@ class MemberActivityInfo(BaseModelMixin):
|
|
408
|
422
|
def cover_url(self):
|
|
409
|
423
|
return qiniu_file_url(self.cover.name, bucket='tamron') if self.is_upload_qiniu else upload_file_url(self.cover)
|
|
410
|
424
|
|
|
411
|
|
- @property
|
|
412
|
|
- def slider_image_path(self):
|
|
413
|
|
- return upload_file_path(self.slider_image)
|
|
414
|
|
-
|
|
415
|
|
- @property
|
|
416
|
|
- def slider_image_url(self):
|
|
417
|
|
- return qiniu_file_url(self.slider_image.name, bucket='tamron') if self.is_upload_qiniu else upload_file_url(self.slider_image)
|
|
|
425
|
+ # @property
|
|
|
426
|
+ # def image_path(self):
|
|
|
427
|
+ # return upload_file_path(self.image)
|
|
|
428
|
+ #
|
|
|
429
|
+ # @property
|
|
|
430
|
+ # def image_url(self):
|
|
|
431
|
+ # return qiniu_file_url(self.image.name, bucket='tamron') if self.is_upload_qiniu else upload_file_url(self.image)
|
|
418
|
432
|
|
|
419
|
433
|
@property
|
|
420
|
434
|
def final_state(self):
|
|
|
|
@@ -435,18 +449,25 @@ class MemberActivityInfo(BaseModelMixin):
|
|
435
|
449
|
return {
|
|
436
|
450
|
'id': self.activity_id,
|
|
437
|
451
|
'activity_id': self.activity_id,
|
|
|
452
|
+ 'activity_type': self.activity_type,
|
|
|
453
|
+ 'activity_type_str': dict(MemberActivityInfo.ACTIVITY_TYPE).get(self.activity_type),
|
|
438
|
454
|
'title': self.title,
|
|
439
|
455
|
'subtitle': self.subtitle,
|
|
440
|
|
- 'date': self.date.strftime('%Y-%m-%d'),
|
|
|
456
|
+ 'date': tc.local_date_string(self.date),
|
|
|
457
|
+ 'start_date': tc.local_date_string(self.start_date),
|
|
|
458
|
+ 'end_date': tc.local_date_string(self.end_date),
|
|
|
459
|
+ 'start_display_date': tc.local_date_string(self.start_display_date),
|
|
|
460
|
+ 'end_display_date': tc.local_date_string(self.end_display_date),
|
|
441
|
461
|
'city': self.city,
|
|
442
|
462
|
'location': self.location,
|
|
443
|
463
|
'lat': self.lat,
|
|
444
|
464
|
'lon': self.lon,
|
|
445
|
465
|
'integral': self.integral,
|
|
|
466
|
+ 'slider_image': self.slider_image_url,
|
|
446
|
467
|
'cover_url': self.cover_url,
|
|
|
468
|
+ 'limit_image_num': self.limit_image_num,
|
|
447
|
469
|
'share_img_link': self.share_img_link,
|
|
448
|
470
|
'share_h5_link': self.share_h5_link,
|
|
449
|
|
- 'slider_image': self.slider_image_url,
|
|
450
|
471
|
'state': self.final_state,
|
|
451
|
472
|
'is_signed': self.is_signed(user_id),
|
|
452
|
473
|
'is_signup': self.is_signup,
|
|
|
|
@@ -456,19 +477,26 @@ class MemberActivityInfo(BaseModelMixin):
|
|
456
|
477
|
return {
|
|
457
|
478
|
'id': self.activity_id,
|
|
458
|
479
|
'activity_id': self.activity_id,
|
|
|
480
|
+ 'activity_type': self.activity_type,
|
|
|
481
|
+ 'activity_type_str': dict(MemberActivityInfo.ACTIVITY_TYPE).get(self.activity_type),
|
|
459
|
482
|
'title': self.title,
|
|
460
|
483
|
'subtitle': self.subtitle,
|
|
461
|
|
- 'date': self.date.strftime('%Y-%m-%d'),
|
|
|
484
|
+ 'date': tc.local_date_string(self.date),
|
|
|
485
|
+ 'start_date': tc.local_date_string(self.start_date),
|
|
|
486
|
+ 'end_date': tc.local_date_string(self.end_date),
|
|
|
487
|
+ 'start_display_date': tc.local_date_string(self.start_display_date),
|
|
|
488
|
+ 'end_display_date': tc.local_date_string(self.end_display_date),
|
|
462
|
489
|
'city': self.city,
|
|
463
|
490
|
'location': self.location,
|
|
464
|
491
|
'lat': self.lat,
|
|
465
|
492
|
'lon': self.lon,
|
|
466
|
493
|
'integral': self.integral,
|
|
467
|
|
- 'content_rich_text': self.content_rich_text,
|
|
|
494
|
+ 'slider_image': self.slider_image_url,
|
|
468
|
495
|
'cover_url': self.cover_url,
|
|
|
496
|
+ 'limit_image_num': self.limit_image_num,
|
|
|
497
|
+ 'content_rich_text': self.content_rich_text,
|
|
469
|
498
|
'share_img_link': self.share_img_link,
|
|
470
|
499
|
'share_h5_link': self.share_h5_link,
|
|
471
|
|
- 'slider_image': self.slider_image_url,
|
|
472
|
500
|
'state': self.final_state,
|
|
473
|
501
|
'is_signed': self.is_signed(user_id),
|
|
474
|
502
|
'is_signup': self.is_signup,
|
|
|
|
@@ -479,25 +507,32 @@ class MemberActivityInfo(BaseModelMixin):
|
|
479
|
507
|
return {
|
|
480
|
508
|
'id': self.activity_id,
|
|
481
|
509
|
'activity_id': self.activity_id,
|
|
|
510
|
+ 'activity_type': self.activity_type,
|
|
|
511
|
+ 'activity_type_str': dict(MemberActivityInfo.ACTIVITY_TYPE).get(self.activity_type),
|
|
482
|
512
|
'title': self.title,
|
|
483
|
513
|
'subtitle': self.subtitle,
|
|
484
|
|
- 'date': self.date.strftime('%Y-%m-%d'),
|
|
|
514
|
+ 'date': tc.local_date_string(self.date),
|
|
|
515
|
+ 'start_date': tc.local_date_string(self.start_date),
|
|
|
516
|
+ 'end_date': tc.local_date_string(self.end_date),
|
|
|
517
|
+ 'start_display_date': tc.local_date_string(self.start_display_date),
|
|
|
518
|
+ 'end_display_date': tc.local_date_string(self.end_display_date),
|
|
485
|
519
|
'city': self.city,
|
|
486
|
520
|
'location': self.location,
|
|
487
|
521
|
'lat': self.lat,
|
|
488
|
522
|
'lon': self.lon,
|
|
489
|
523
|
'integral': self.integral,
|
|
|
524
|
+ 'is_slider': self.is_slider,
|
|
|
525
|
+ 'slider_image': self.slider_image_url,
|
|
490
|
526
|
'cover_url': self.cover_url,
|
|
|
527
|
+ 'limit_image_num': self.limit_image_num,
|
|
491
|
528
|
'share_img_link': self.share_img_link,
|
|
492
|
529
|
'share_h5_link': self.share_h5_link,
|
|
493
|
|
- 'slider_image': self.slider_image_url,
|
|
494
|
530
|
'state': self.final_state,
|
|
495
|
531
|
'is_signup': self.is_signup,
|
|
496
|
532
|
'share_integral': self.group_share_integral,
|
|
497
|
533
|
'share_max_integral': self.group_share_max_integral,
|
|
498
|
|
- 'is_slider': self.is_slider,
|
|
499
|
534
|
'activity_state': self.activity_state,
|
|
500
|
|
- 'created_at': tc.local_string(utc_dt=self.created_at, format='%Y-%m-%d %H:%M:%S'),
|
|
|
535
|
+ 'created_at': tc.local_string(utc_dt=self.created_at),
|
|
501
|
536
|
}
|
|
502
|
537
|
|
|
503
|
538
|
@property
|
|
|
|
@@ -505,28 +540,35 @@ class MemberActivityInfo(BaseModelMixin):
|
|
505
|
540
|
return {
|
|
506
|
541
|
'id': self.activity_id,
|
|
507
|
542
|
'activity_id': self.activity_id,
|
|
|
543
|
+ 'activity_type': self.activity_type,
|
|
|
544
|
+ 'activity_type_str': dict(MemberActivityInfo.ACTIVITY_TYPE).get(self.activity_type),
|
|
508
|
545
|
'title': self.title,
|
|
509
|
546
|
'subtitle': self.subtitle,
|
|
510
|
|
- 'date': self.date.strftime('%Y-%m-%d'),
|
|
|
547
|
+ 'date': tc.local_date_string(self.date),
|
|
|
548
|
+ 'start_date': tc.local_date_string(self.start_date),
|
|
|
549
|
+ 'end_date': tc.local_date_string(self.end_date),
|
|
|
550
|
+ 'start_display_date': tc.local_date_string(self.start_display_date),
|
|
|
551
|
+ 'end_display_date': tc.local_date_string(self.end_display_date),
|
|
511
|
552
|
'city': self.city,
|
|
512
|
553
|
'location': self.location,
|
|
513
|
554
|
'lat': self.lat,
|
|
514
|
555
|
'lon': self.lon,
|
|
515
|
556
|
'integral': self.integral,
|
|
516
|
|
- 'content_rich_text': self.content_rich_text,
|
|
|
557
|
+ 'is_slider': self.is_slider,
|
|
|
558
|
+ 'banner_path': self.slider_image_path,
|
|
|
559
|
+ 'slider_image': self.slider_image_url,
|
|
|
560
|
+ 'cover_path': self.cover_path,
|
|
517
|
561
|
'cover_url': self.cover_url,
|
|
|
562
|
+ 'limit_image_num': self.limit_image_num,
|
|
|
563
|
+ 'content_rich_text': self.content_rich_text,
|
|
518
|
564
|
'share_img_link': self.share_img_link,
|
|
519
|
565
|
'share_h5_link': self.share_h5_link,
|
|
520
|
|
- 'slider_image': self.slider_image_url,
|
|
521
|
566
|
'state': self.final_state,
|
|
522
|
567
|
'is_signup': self.is_signup,
|
|
523
|
568
|
'share_integral': self.group_share_integral,
|
|
524
|
569
|
'share_max_integral': self.group_share_max_integral,
|
|
525
|
570
|
'activity_state': self.activity_state,
|
|
526
|
|
- 'is_slider': self.is_slider,
|
|
527
|
|
- 'banner_path': self.slider_image_path,
|
|
528
|
|
- 'cover_path': self.cover_path,
|
|
529
|
|
- 'created_at': tc.local_string(utc_dt=self.created_at, format='%Y-%m-%d %H:%M:%S'),
|
|
|
571
|
+ 'created_at': tc.local_string(utc_dt=self.created_at),
|
|
530
|
572
|
}
|
|
531
|
573
|
|
|
532
|
574
|
|