@@ -54,7 +54,18 @@ def encrypt(request): |
||
| 54 | 54 |
mieli.distributor_pk = distributor_pk |
| 55 | 55 |
mieli.sn = sn |
| 56 | 56 |
mieli.operator_id = optor_id |
| 57 |
- mieli.save() |
|
| 57 |
+ |
|
| 58 |
+ try: |
|
| 59 |
+ model = ModelInfo.objects.get(pk=model_pk) |
|
| 60 |
+ except ModelInfo.DoesNotExist: |
|
| 61 |
+ model = None |
|
| 62 |
+ |
|
| 63 |
+ if model: |
|
| 64 |
+ mieli.is_send_redpack = model.is_send_redpack |
|
| 65 |
+ mieli.redpack_amount = model.redpack_amount |
|
| 66 |
+ mieli.redpack_max_amount = model.redpack_max_amount |
|
| 67 |
+ |
|
| 68 |
+ mieli.save() |
|
| 58 | 69 |
|
| 59 | 70 |
return response(200, data={
|
| 60 | 71 |
'ciphertext': u'{prefix}+{cipherlen}+{ciphertext}'.format(
|
@@ -8,6 +8,7 @@ from django_admin import AdvancedActionsModelAdmin, AdvancedExportExcelModelAdmi |
||
| 8 | 8 |
from django_models_ext import ProvinceShortModelMixin |
| 9 | 9 |
from pysnippets.strsnippets import strip |
| 10 | 10 |
|
| 11 |
+from logs.models import MchInfoEncryptLogInfo |
|
| 11 | 12 |
from mch.models import (ActivityInfo, AdministratorInfo, BrandInfo, ConsumeInfoSubmitLogInfo, ConsumeImpressionInfo, DistributorInfo, |
| 12 | 13 |
LatestAppInfo, LatestAppScreenInfo, ModelInfo, OperatorInfo, SaleclerkInfo, SlideInfo) |
| 13 | 14 |
|
@@ -64,7 +65,7 @@ class BrandInfoAdmin(admin.ModelAdmin): |
||
| 64 | 65 |
|
| 65 | 66 |
|
| 66 | 67 |
class ModelInfoAdmin(admin.ModelAdmin): |
| 67 |
- list_display = ('brand_id', 'brand_name', 'jancode', 'model_id', 'model_name', 'model_uni_name', 'model_full_name', 'model_descr', 'category', 'warehouse', 'image', 'url', 'image2', 'factory_yuan', 'integral', 'position', 'display', 'status', 'created_at', 'updated_at')
|
|
| 68 |
+ list_display = ('brand_id', 'brand_name', 'jancode', 'model_id', 'model_name', 'model_uni_name', 'model_full_name', 'model_descr', 'category', 'warehouse', 'image', 'url', 'image2', 'factory_yuan', 'integral', 'is_send_redpack', 'redpack_amount', 'redpack_max_amount', 'position', 'display', 'status', 'created_at', 'updated_at')
|
|
| 68 | 69 |
list_filter = ('brand_name', 'category', 'warehouse', 'display', 'status')
|
| 69 | 70 |
readonly_fields = ('brand_name', 'factory_fee')
|
| 70 | 71 |
search_fields = ('brand_id', 'brand_name', 'jancode', 'model_id', 'model_name', 'model_uni_name', 'model_full_name', 'model_descr', 'category', 'warehouse')
|
@@ -81,6 +82,8 @@ class ModelInfoAdmin(admin.ModelAdmin): |
||
| 81 | 82 |
|
| 82 | 83 |
obj.save() |
| 83 | 84 |
|
| 85 |
+ MchInfoEncryptLogInfo.objects.filter(has_send_redpack=False).update(is_send_redpack=obj.is_send_redpack, redpack_amount=obj.redpack_amount, redpack_max_amount=obj.redpack_max_amount) |
|
| 86 |
+ |
|
| 84 | 87 |
|
| 85 | 88 |
class ModelImageInfoAdmin(admin.ModelAdmin): |
| 86 | 89 |
list_display = ('model_id', 'model_name', 'image', 'url', 'position', 'status', 'created_at', 'updated_at')
|
@@ -0,0 +1,30 @@ |
||
| 1 |
+# -*- coding: utf-8 -*- |
|
| 2 |
+# Generated by Django 1.11.22 on 2019-08-13 11:36 |
|
| 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', '0042_slideinfo'),
|
|
| 12 |
+ ] |
|
| 13 |
+ |
|
| 14 |
+ operations = [ |
|
| 15 |
+ migrations.AddField( |
|
| 16 |
+ model_name='modelinfo', |
|
| 17 |
+ name='is_send_redpack', |
|
| 18 |
+ field=models.BooleanField(db_index=True, default=False, help_text='\u662f\u5426\u53d1\u653e\u7ea2\u5305', verbose_name='is_send_redpack'), |
|
| 19 |
+ ), |
|
| 20 |
+ migrations.AddField( |
|
| 21 |
+ model_name='modelinfo', |
|
| 22 |
+ name='redpack_amount', |
|
| 23 |
+ field=models.IntegerField(default=0, help_text='\u7ea2\u5305\u56fa\u5b9a\u91d1\u989d\uff0c\u5355\u4f4d\uff1a\u5206', verbose_name='redpack_amount'), |
|
| 24 |
+ ), |
|
| 25 |
+ migrations.AddField( |
|
| 26 |
+ model_name='modelinfo', |
|
| 27 |
+ name='redpack_max_amount', |
|
| 28 |
+ field=models.IntegerField(default=0, help_text='\u7ea2\u5305\u91d1\u989d\u8303\u56f4\uff0c\u5355\u4f4d\uff1a\u5206\uff09', verbose_name='redpack_max_amount'), |
|
| 29 |
+ ), |
|
| 30 |
+ ] |
@@ -161,6 +161,10 @@ class ModelInfo(BaseModelMixin): |
||
| 161 | 161 |
|
| 162 | 162 |
integral = models.IntegerField(_(u'integral'), default=100, help_text=u'积分') |
| 163 | 163 |
|
| 164 |
+ is_send_redpack = models.BooleanField(_(u'is_send_redpack'), default=False, help_text=u'是否发放红包', db_index=True) |
|
| 165 |
+ redpack_amount = models.IntegerField(_(u'redpack_amount'), default=0, help_text=u'红包固定金额,单位:分') |
|
| 166 |
+ redpack_max_amount = models.IntegerField(_(u'redpack_max_amount'), default=0, help_text=u'红包金额范围,单位:分)') |
|
| 167 |
+ |
|
| 164 | 168 |
position = models.IntegerField(_(u'position'), default=1, help_text=u'排序') |
| 165 | 169 |
|
| 166 | 170 |
display = models.BooleanField(_(u'display'), default=True, help_text=_(u'Display'), db_index=True) |
@@ -2,7 +2,7 @@ pywe-card==1.0.0 |
||
| 2 | 2 |
pywe-component==1.0.1 |
| 3 | 3 |
pywe-component-preauthcode==1.0.3 |
| 4 | 4 |
pywe-jssdk==1.1.0 |
| 5 |
-pywe-membercard==1.0.1 |
|
| 5 |
+pywe-membercard==1.0.2 |
|
| 6 | 6 |
pywe-miniapp==1.1.5 |
| 7 | 7 |
pywe-oauth==1.0.7 |
| 8 | 8 |
pywe-pay==1.0.13 |