3;# -*- coding: utf-8 -*- 2
+# Generated by Django 1.11.26 on 2019-12-21 06:19
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
+        ('mch', '0040_modelinfo_shot_member_name'),
12
+    ]
13
+
14
+    operations = [
15
+        migrations.AddField(
16
+            model_name='activityinfo',
17
+            name='coupon_id',
18
+            field=models.CharField(blank=True, db_index=True, help_text='\u5238\u552f\u4e00\u6807\u8bc6', max_length=32, null=True, verbose_name='coupon_id'),
19
+        ),
20
+    ]

+ 2 - 0
mch/models.py

@@ -615,6 +615,8 @@ class ActivityInfo(BaseModelMixin):
615 615
     start_at = models.DateTimeField(_(u'start_at'), help_text=_(u'start_at'))
616 616
     end_at = models.DateTimeField(_(u'end_at'), help_text=_(u'end_at'))
617 617
 
618
+    coupon_id = models.CharField(_(u'coupon_id'), max_length=32, blank=True, null=True, help_text=u'券唯一标识', db_index=True)
619
+
618 620
     coupon_expire_type = models.IntegerField(_(u'coupon_expire_type'), choices=COUPON_EXPIRED_TIME_TUPLE, default=FIXED_EXPIRED_TIME, help_text=_(u'维修券类型'))
619 621
     coupon_valid_period = models.IntegerField(_(u'coupon_valid_period'), default=0, help_text=_(u'维修券有效时间(单位:天)'))
620 622
     coupon_expire_at = models.DateTimeField(_(u'coupon_expire_at'), blank=True, null=True, help_text=_(u'维修券过期时间'))

+ 5 - 0
member/admin.py

@@ -30,6 +30,11 @@ class RightInfoAdmin(admin.ModelAdmin):
30 30
     list_display = ('right_id', 'right_type', 'icon', 'title', 'subtitle', 'detail', 'level1', 'level2', 'level3', 'level4', 'level5', 'minlevel', 'position', 'is_send_coupon', 'coupon_valid_period', 'coupon_num', 'status', 'created_at', 'updated_at')
31 31
     list_filter = ('right_type', 'is_send_coupon', 'status')
32 32
 
33
+    def save_model(self, request, obj, form, change):
34
+        obj.save()
35
+
36
+        # TODO: Update coupon relative
37
+
33 38
 
34 39
 class CouponInfoAdmin(admin.ModelAdmin):
35 40
     list_display = ('coupon_id', 'user_id', 'coupon_valid_period', 'coupon_amount', 'coupon_detail', 'active_at', 'expire_at', 'right_id', 'right_type', 'icon', 'title', 'subtitle', 'detail', 'status', 'created_at', 'updated_at')

+ 23 - 0
member/migrations/0012_auto_20191221_1419.py

@@ -0,0 +1,23 @@
1
+# -*- coding: utf-8 -*-
2
+# Generated by Django 1.11.26 on 2019-12-21 06:19
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', '0011_auto_20191212_1827'),
12
+    ]
13
+
14
+    operations = [
15
+        migrations.DeleteModel(
16
+            name='MemberCouponInfo',
17
+        ),
18
+        migrations.AddField(
19
+            model_name='rightinfo',
20
+            name='coupon_id',
21
+            field=models.CharField(blank=True, db_index=True, help_text='\u5238\u552f\u4e00\u6807\u8bc6', max_length=32, null=True, verbose_name='coupon_id'),
22
+        ),
23
+    ]

+ 4 - 52
member/models.py

@@ -92,6 +92,7 @@ class GoodsInfo(BaseModelMixin):
92 92
             'desc': self.desc,
93 93
         }
94 94
 
95
+
95 96
 class GoodsOrderInfo(BaseModelMixin):
96 97
     PHYSICAL = 0
97 98
     VIRTUAL = 1
@@ -163,6 +164,9 @@ class RightInfo(BaseModelMixin):
163 164
 
164 165
     # 券相关
165 166
     is_send_coupon = models.BooleanField(_(u'is_send_coupon'), default=False, help_text=_(u'是否发券'), db_index=True)
167
+
168
+    coupon_id = models.CharField(_(u'coupon_id'), max_length=32, blank=True, null=True, help_text=u'券唯一标识', db_index=True)
169
+
166 170
     coupon_valid_period = models.IntegerField(_(u'coupon_valid_period'), default=0, help_text=_(u'券有效时间(单位:天)'))
167 171
     coupon_num = models.IntegerField(_(u'coupon_num'), default=0, help_text=_(u'券每会员级别发放张数'))
168 172
     coupon_level1_amount = models.IntegerField(_(u'coupon_level1_amount'), default=0, blank=True, null=True, help_text=u'金额(单位:分)')
@@ -476,55 +480,3 @@ class MemberActivitySigninInfo(BaseModelMixin):
476 480
 
477 481
     def __unicode__(self):
478 482
         return unicode(self.pk)
479
-
480
-
481
-class MemberCouponInfo(BaseModelMixin):
482
-    DEEP_CLEANING = 0
483
-    FREE_FOCUS = 1
484
-    CLEAN_APPEARANCE = 2
485
-    ACCIDENTAL_MAINTENANCE = 3
486
-    MAINTENANCE_MANPOWER = 4
487
-
488
-    COUPON_TYPE_TUPLE = (
489
-        (DEEP_CLEANING, u'深度清洁'),
490
-        (FREE_FOCUS, u'免费调焦'),
491
-        (CLEAN_APPEARANCE, u'外观清洁'),
492
-        (ACCIDENTAL_MAINTENANCE, u'意外维修'),
493
-        (MAINTENANCE_MANPOWER, u'维修人工')
494
-    )
495
-
496
-    brand_id = models.CharField(_(u'brand_id'), max_length=32, blank=True, null=True, help_text=u'品牌唯一标识', db_index=True)
497
-    brand_name = models.CharField(_(u'brand_name'), max_length=255, blank=True, null=True, help_text=u'品牌名称')
498
-
499
-    coupon_id = ShortUUIDField(_(u'coupon_id'), max_length=32, blank=True, null=True, help_text=u'券唯一标识', db_index=True, unique=True)
500
-
501
-    user_id = models.CharField(_(u'user_id'), max_length=32, blank=True, null=True, help_text=u'用户唯一标识', db_index=True)
502
-
503
-    coupon_type = models.IntegerField(_(u'coupon_type'), choices=COUPON_TYPE_TUPLE, default=DEEP_CLEANING, help_text=u'券类型', db_index=True)
504
-    coupon_start_at = models.DateTimeField(_(u'coupon_start_at'), blank=True, null=True, help_text=u'券生效时间')
505
-    coupon_expire_at = models.DateTimeField(_(u'coupon_expire_at'), blank=True, null=True, help_text=u'券过期时间')
506
-    coupon_value = models.IntegerField(_(u'coupon_value'), default=0, help_text=u'券金额(单位:分)')
507
-
508
-    has_used = models.BooleanField(_(u'has_used'), default=False, help_text=u'是否已核销', db_index=True)
509
-    admin_id = models.CharField(_(u'admin_id'), max_length=32, blank=True, null=True, help_text=u'核销员唯一标识', db_index=True)
510
-    used_at = models.DateTimeField(_(u'used_at'), blank=True, null=True, help_text=u'维修券核销时间')
511
-
512
-    class Meta:
513
-        verbose_name = _(u'会员券信息')
514
-        verbose_name_plural = _(u'会员券信息')
515
-
516
-    def __unicode__(self):
517
-        return unicode(self.pk)
518
-
519
-    @property
520
-    def data(self):
521
-        return {
522
-            'coupon_id': self.coupon_id,
523
-            'coupon_type': self.coupon_type,
524
-            'coupon_start_at': tc.local_string(self.coupon_start_at, format='%Y%m%d'),
525
-            'coupon_expire_at': tc.local_string(self.coupon_expire_at, format='%Y%m%d'),
526
-            'coupon_value': self.coupon_value,
527
-            'has_used': self.has_used,
528
-            'admin_id': self.admin_id,
529
-            'used_at': tc.local_string(self.used_at, format='%Y%m%d'),
530
-        }

kodo - Gogs: Go Git Service

No Description

__init__.py 0B