@@ -9,7 +9,7 @@ from mch.models import ConsumeInfoSubmitLogInfo |
||
9 | 9 |
|
10 | 10 |
class UserInfoAdmin(ChangeOnlyModelAdmin, admin.ModelAdmin): |
11 | 11 |
list_display = ('user_id', 'nickname', 'phone', 'appid', 'unionid', 'openid', 'openid_miniapp', 'location', 'balance', 'integral', 'freeze_integral', 'user_status', 'test_user', 'status', 'created_at', 'updated_at') |
12 |
- list_filter = ('appid', 'subscribe', 'has_membercard', 'test_user', 'sex', 'user_status', 'status', 'code_version') |
|
12 |
+ list_filter = ('appid', 'subscribe', 'has_membercard', 'test_user', 'sex', 'user_status', 'status', 'code_version', 'created_at') |
|
13 | 13 |
readonly_fields = ('user_id', ) |
14 | 14 |
search_fields = ('user_id', 'username', 'unionid', 'openid', 'openid_miniapp', 'name', 'phone', 'location') |
15 | 15 |
|
@@ -253,6 +253,7 @@ def decrypt2(request): |
||
253 | 253 |
'plaintext': plaintext, |
254 | 254 |
'logo_url': brand.brand_logo_url if brand else '', |
255 | 255 |
'model_imgs': model.images if model else [], |
256 |
+ 'code_version': mieli.version, |
|
256 | 257 |
'goodsInfo': { |
257 | 258 |
'BrandID': brand_pk, |
258 | 259 |
'Brand': brand.brand_name if brand else '', |
@@ -11,6 +11,7 @@ from pywe_miniapp import get_phone_number |
||
11 | 11 |
from pywe_storage import RedisStorage |
12 | 12 |
from TimeConvert import TimeConvert as tc |
13 | 13 |
|
14 |
+from logs.models import MchInfoEncryptLogInfo |
|
14 | 15 |
from account.models import UserInfo |
15 | 16 |
from integral.models import SaleclerkSubmitLogInfo |
16 | 17 |
from mch.models import (ActivityInfo, AdministratorInfo, BrandInfo, ConsumeInfoSubmitLogInfo, DistributorInfo, |
@@ -220,8 +221,9 @@ def consumer_info_api(request): |
||
220 | 221 |
modelID = request.POST.get('ModelID', '') |
221 | 222 |
distributorID = request.POST.get('DistributorID', '') |
222 | 223 |
serialNo = request.POST.get('SerialNo', '') |
223 |
- verifyResult = request.POST.get('verifyResult', '') |
|
224 |
+ verifyResult = request.POST.get('verifyResult', 0) |
|
224 | 225 |
purePhoneNumber = request.POST.get('purePhoneNumber', '') |
226 |
+ code_version = request.POST.get('code_version', '') |
|
225 | 227 |
|
226 | 228 |
if lat == 'undefined': |
227 | 229 |
lat = .0 |
@@ -260,6 +262,15 @@ def consumer_info_api(request): |
||
260 | 262 |
except ValueError: |
261 | 263 |
return response(ProductModelStatusCode.MODEL_NOT_FOUND) |
262 | 264 |
|
265 |
+ #是否是新二维码,即统览码2 |
|
266 |
+ if not code_version: |
|
267 |
+ code_version = 1 |
|
268 |
+ code = filter(lambda ch: ch in '0123456789', serialNo) |
|
269 |
+ encrypt_logs = MchInfoEncryptLogInfo.objects.filter(model_pk=model.pk, sn=code) |
|
270 |
+ |
|
271 |
+ if encrypt_logs: |
|
272 |
+ code_version = encrypt_logs[0].version |
|
273 |
+ |
|
263 | 274 |
# try: |
264 | 275 |
# distributor = DistributorInfo.objects.get(pk=distributorID) |
265 | 276 |
# except DistributorInfo.DoesNotExist: |
@@ -308,6 +319,7 @@ def consumer_info_api(request): |
||
308 | 319 |
coupon_expire_at=act.coupon_expire_at if during_activity else None, |
309 | 320 |
coupon_value=act.coupon_value if during_activity else 0, |
310 | 321 |
test_user=user.test_user, |
322 |
+ code_version=code_version, |
|
311 | 323 |
) |
312 | 324 |
|
313 | 325 |
if not user.test_user and not dupload: |
@@ -222,7 +222,7 @@ class LatestAppScreenInfoAdmin(admin.ModelAdmin): |
||
222 | 222 |
|
223 | 223 |
class ConsumeInfoSubmitLogInfoAdmin(ReadOnlyModelAdmin, admin.ModelAdmin): |
224 | 224 |
list_display = ('user_id', 'phone', 'model_name', 'serialNo', 'dupload', 'submit_during_activity', 'has_used', 'created_at') |
225 |
- list_filter = ('brand_id', 'submit_during_activity', 'activity_id', 'dupload', 'test_user', 'verifyResult', 'has_used', 'status') |
|
225 |
+ list_filter = ('brand_id', 'submit_during_activity', 'activity_id', 'dupload', 'test_user', 'verifyResult', 'has_used', 'status', 'code_version', 'created_at') |
|
226 | 226 |
search_fields = ('user_id', 'phone', 'serialNo', 'model_name') |
227 | 227 |
|
228 | 228 |
|
@@ -0,0 +1,20 @@ |
||
1 |
+# -*- coding: utf-8 -*- |
|
2 |
+# Generated by Django 1.11.26 on 2020-03-17 10:54 |
|
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', '0051_auto_20200314_2340'), |
|
12 |
+ ] |
|
13 |
+ |
|
14 |
+ operations = [ |
|
15 |
+ migrations.AddField( |
|
16 |
+ model_name='consumeinfosubmitloginfo', |
|
17 |
+ name='code_version', |
|
18 |
+ field=models.IntegerField(db_index=True, default=1, help_text='\u7edf\u89c8\u7801\u7248\u672c', verbose_name='code_version'), |
|
19 |
+ ), |
|
20 |
+ ] |
@@ -616,6 +616,8 @@ class ConsumeInfoSubmitLogInfo(BaseModelMixin): |
||
616 | 616 |
admin_id = models.CharField(_(u'admin_id'), max_length=32, blank=True, null=True, help_text=u'核销员唯一标识', db_index=True) |
617 | 617 |
used_at = models.DateTimeField(_(u'used_at'), blank=True, null=True, help_text=_(u'维修券核销时间')) |
618 | 618 |
|
619 |
+ code_version = models.IntegerField(_(u'code_version'), default=1, help_text=u'统览码版本', db_index=True) |
|
620 |
+ |
|
619 | 621 |
test_user = models.BooleanField(_(u'test_user'), default=False, help_text=_(u'是否为测试用户'), db_index=True) |
620 | 622 |
|
621 | 623 |
class Meta: |
@@ -44,6 +44,8 @@ def clerk_sale_submit_api(request): |
||
44 | 44 |
|
45 | 45 |
trackingNo = request.POST.get('trackingNo', '') |
46 | 46 |
|
47 |
+ code_version = request.POST.get('code_version', 0) |
|
48 |
+ |
|
47 | 49 |
test_sn = serialNo in settings.TESTING_SNS |
48 | 50 |
|
49 | 51 |
if lat == 'undefined': |
@@ -102,12 +104,13 @@ def clerk_sale_submit_api(request): |
||
102 | 104 |
has_scan = ConsumeInfoSubmitLogInfo.objects.filter(model_id=model.model_id, serialNo=serialNo).exists() |
103 | 105 |
|
104 | 106 |
#是否是新二维码,即统览码2 |
105 |
- code_version = 1 |
|
106 |
- code = filter(lambda ch: ch in '0123456789', serialNo) |
|
107 |
- encrypt_logs = MchInfoEncryptLogInfo.objects.filter(model_pk=model.pk, sn=code) |
|
107 |
+ if not code_version: |
|
108 |
+ code_version = 1 |
|
109 |
+ code = filter(lambda ch: ch in '0123456789', serialNo) |
|
110 |
+ encrypt_logs = MchInfoEncryptLogInfo.objects.filter(model_pk=model.pk, sn=code) |
|
108 | 111 |
|
109 |
- if encrypt_logs: |
|
110 |
- code_version = encrypt_logs[0].version |
|
112 |
+ if encrypt_logs: |
|
113 |
+ code_version = encrypt_logs[0].version |
|
111 | 114 |
|
112 | 115 |
# 店员提交记录 |
113 | 116 |
ssli = SaleclerkSubmitLogInfo.objects.create( |