@@ -18,6 +18,7 @@ class UserInfoAdmin(ChangeOnlyModelAdmin, admin.ModelAdmin): |
||
| 18 | 18 |
if obj.test_user: |
| 19 | 19 |
ConsumeInfoSubmitLogInfo.objects.filter(user_id=obj.user_id).update(test_user=True) |
| 20 | 20 |
|
| 21 |
+ |
|
| 21 | 22 |
class UserIntegralIncomeExpensesInfoAdmin(ChangeOnlyModelAdmin, admin.ModelAdmin): |
| 22 | 23 |
list_display = ('user_id', 'model_id', 'model_name', 'code', 'integral', 'remark', 'updated_at', 'created_at')
|
| 23 | 24 |
search_fields = ('user_id',)
|
@@ -3,7 +3,6 @@ |
||
| 3 | 3 |
from django.db import models |
| 4 | 4 |
from django.utils.translation import ugettext_lazy as _ |
| 5 | 5 |
from django_models_ext import BaseModelMixin, SexModelMixin |
| 6 |
-from jsonfield import JSONField |
|
| 7 | 6 |
from TimeConvert import TimeConvert as tc |
| 8 | 7 |
|
| 9 | 8 |
from kodo.basemodels import LensmanTypeBoolMixin |
@@ -324,6 +323,7 @@ class UserInfo(BaseModelMixin, LensmanTypeBoolMixin): |
||
| 324 | 323 |
'code': self.memberusercardcode, |
| 325 | 324 |
} |
| 326 | 325 |
|
| 326 |
+ |
|
| 327 | 327 |
class UserIntegralIncomeExpensesInfo(BaseModelMixin): |
| 328 | 328 |
PRODUCT = 0 |
| 329 | 329 |
SHARE = 1 |
@@ -339,7 +339,7 @@ class UserIntegralIncomeExpensesInfo(BaseModelMixin): |
||
| 339 | 339 |
|
| 340 | 340 |
brand_id = models.CharField(_(u'brand_id'), max_length=32, blank=True, null=True, help_text=u'品牌唯一标识', db_index=True) |
| 341 | 341 |
brand_name = models.CharField(_(u'brand_name'), max_length=255, blank=True, null=True, help_text=u'品牌名称') |
| 342 |
- |
|
| 342 |
+ |
|
| 343 | 343 |
integral_from = models.IntegerField(_(u'integral_from'), choices=INTEGRAL_FROM, default=PRODUCT, help_text=u'积分来源') |
| 344 | 344 |
|
| 345 | 345 |
model_id = models.CharField(_(u'model_id'), max_length=32, blank=True, null=True, help_text=u'型号唯一标识', db_index=True) |
@@ -356,4 +356,4 @@ class UserIntegralIncomeExpensesInfo(BaseModelMixin): |
||
| 356 | 356 |
verbose_name_plural = _(u'userinfointegralincomeexpensesinfo') |
| 357 | 357 |
|
| 358 | 358 |
def __unicode__(self): |
| 359 |
- return '%d' % self.pk |
|
| 359 |
+ return '%d' % self.pk |
@@ -1,10 +1,10 @@ |
||
| 1 | 1 |
# -*- coding: utf-8 -*- |
| 2 | 2 |
|
| 3 |
-from django.contrib.auth.models import Group, User |
|
| 4 | 3 |
from rest_framework import serializers |
| 5 | 4 |
|
| 6 | 5 |
from account.models import UserInfo |
| 7 | 6 |
|
| 7 |
+ |
|
| 8 | 8 |
class UserInfoSerializer(serializers.HyperlinkedModelSerializer): |
| 9 | 9 |
class Meta: |
| 10 | 10 |
model = UserInfo |
@@ -1 +1,4 @@ |
||
| 1 |
-# -*- coding: utf-8 -*- |
|
| 1 |
+from django.shortcuts import render |
|
| 2 |
+ |
|
| 3 |
+ |
|
| 4 |
+# Create your views here. |
@@ -128,7 +128,7 @@ def userinfo(request): |
||
| 128 | 128 |
except AdministratorInfo.DoesNotExist: |
| 129 | 129 |
return response(AdministratorStatusCode.ADMINISTRATOR_NOT_FOUND) |
| 130 | 130 |
|
| 131 |
- userinfos = UserInfo.objects.filter(status=True).order_by('-created_at')
|
|
| 131 |
+ userinfos = UserInfo.objects.filter(status=True).order_by('-pk')
|
|
| 132 | 132 |
count = userinfos.count() |
| 133 | 133 |
userinfos, left = pagination(userinfos, page, num) |
| 134 | 134 |
userinfos = [userinfo.admindata for userinfo in userinfos] |
@@ -160,7 +160,7 @@ def query_usercoupons(request): |
||
| 160 | 160 |
except AdministratorInfo.DoesNotExist: |
| 161 | 161 |
return response(AdministratorStatusCode.ADMINISTRATOR_NOT_FOUND) |
| 162 | 162 |
|
| 163 |
- coupons = UserCouponInfo.objects.filter(brand_id=administrator.brand_id, user_id=user_id, status=True).order_by('-created_at')
|
|
| 163 |
+ coupons = UserCouponInfo.objects.filter(brand_id=administrator.brand_id, user_id=user_id, status=True).order_by('-pk')
|
|
| 164 | 164 |
coupons = [coupon.admindata for coupon in coupons] |
| 165 | 165 |
|
| 166 | 166 |
return response(200, 'User Coupon Success', u'用户劵列表获取成功', data={
|
@@ -188,7 +188,7 @@ def query_usergoods(request): |
||
| 188 | 188 |
except AdministratorInfo.DoesNotExist: |
| 189 | 189 |
return response(AdministratorStatusCode.ADMINISTRATOR_NOT_FOUND) |
| 190 | 190 |
|
| 191 |
- logs = ConsumeInfoSubmitLogInfo.objects.filter(brand_id=administrator.brand_id, user_id=user_id, status=True).order_by('-created_at')
|
|
| 191 |
+ logs = ConsumeInfoSubmitLogInfo.objects.filter(brand_id=administrator.brand_id, user_id=user_id, status=True).order_by('-pk')
|
|
| 192 | 192 |
logs = [log.adminuserdata for log in logs] |
| 193 | 193 |
|
| 194 | 194 |
return response(200, 'Userinfo Goods Success', u'用户商品列表获取成功', data={
|
@@ -221,7 +221,7 @@ def query_userinfo(request): |
||
| 221 | 221 |
except AdministratorInfo.DoesNotExist: |
| 222 | 222 |
return response(AdministratorStatusCode.ADMINISTRATOR_NOT_FOUND) |
| 223 | 223 |
|
| 224 |
- userinfos = UserInfo.objects.filter(Q(status=True) & (Q(user_id__icontains=query) | Q(nickname__icontains=query) | Q(phone__icontains=query) | Q(memberusercardcode__icontains=query))).order_by('-created_at')
|
|
| 224 |
+ userinfos = UserInfo.objects.filter(Q(status=True) & (Q(user_id__icontains=query) | Q(nickname__icontains=query) | Q(phone__icontains=query) | Q(memberusercardcode__icontains=query))).order_by('-pk')
|
|
| 225 | 225 |
|
| 226 | 226 |
if level: |
| 227 | 227 |
userinfos = userinfos.filter(level=level) |
@@ -534,10 +534,10 @@ def statistic_member(request): |
||
| 534 | 534 |
else: |
| 535 | 535 |
userinfos = UserInfo.objects.filter(test_user=False, level__gte=1, status=True) |
| 536 | 536 |
|
| 537 |
- #关注公众号数 |
|
| 537 |
+ # 关注公众号数 |
|
| 538 | 538 |
mp_num = userinfos.filter(subscribe=True).count() |
| 539 | 539 |
|
| 540 |
- #领取保卡数 |
|
| 540 |
+ # 领取保卡数 |
|
| 541 | 541 |
membercard_num = userinfos.filter(has_membercard=True).count() |
| 542 | 542 |
|
| 543 | 543 |
# 会员级别 |
@@ -565,6 +565,7 @@ def statistic_member(request): |
||
| 565 | 565 |
'province_logs': province_logs, |
| 566 | 566 |
}) |
| 567 | 567 |
|
| 568 |
+ |
|
| 568 | 569 |
def statistic_coupon(request): |
| 569 | 570 |
brand_id = request.POST.get('brand_id', settings.KODO_DEFAULT_BRAND_ID)
|
| 570 | 571 |
admin_id = request.POST.get('admin_id', '')
|
@@ -587,13 +588,14 @@ def statistic_coupon(request): |
||
| 587 | 588 |
used_coupons = UserCouponInfo.objects.filter(has_used=True, status=True) |
| 588 | 589 |
|
| 589 | 590 |
type_has_used_logs = list(used_coupons.values('coupon_title', 'coupon_value').annotate(num=Count('user_coupon_id')))
|
| 590 |
- |
|
| 591 |
+ |
|
| 591 | 592 |
return response(200, 'Get Consumer Statistic Success', u'获取用户劵统计成功', data={
|
| 592 | 593 |
'froms_logs': froms_logs, |
| 593 | 594 |
'type_logs': type_logs, |
| 594 | 595 |
'type_has_used_logs': type_has_used_logs, |
| 595 | 596 |
}) |
| 596 | 597 |
|
| 598 |
+ |
|
| 597 | 599 |
def record_consumer(request): |
| 598 | 600 |
brand_id = request.POST.get('brand_id', settings.KODO_DEFAULT_BRAND_ID)
|
| 599 | 601 |
page = request.POST.get('page', 1)
|
@@ -613,7 +615,7 @@ def record_consumer(request): |
||
| 613 | 615 |
except AdministratorInfo.DoesNotExist: |
| 614 | 616 |
return response(AdministratorStatusCode.ADMINISTRATOR_NOT_FOUND) |
| 615 | 617 |
|
| 616 |
- logs = ConsumeInfoSubmitLogInfo.objects.filter(Q(status=True) & Q(test_user=False) & (Q(model_name__icontains=query) | Q(phone__icontains=query) | Q(serialNo__icontains=query))).order_by('-created_at')
|
|
| 618 |
+ logs = ConsumeInfoSubmitLogInfo.objects.filter(Q(status=True) & Q(test_user=False) & (Q(model_name__icontains=query) | Q(phone__icontains=query) | Q(serialNo__icontains=query))).order_by('-pk')
|
|
| 617 | 619 |
|
| 618 | 620 |
if dupload: |
| 619 | 621 |
logs = logs.filter(dupload=dupload) |
@@ -634,6 +636,7 @@ def record_consumer(request): |
||
| 634 | 636 |
'left': left |
| 635 | 637 |
}) |
| 636 | 638 |
|
| 639 |
+ |
|
| 637 | 640 |
def record_consumer_batch(request): |
| 638 | 641 |
brand_id = request.POST.get('brand_id', settings.KODO_DEFAULT_BRAND_ID)
|
| 639 | 642 |
admin_id = request.POST.get('admin_id', '')
|
@@ -645,9 +648,9 @@ def record_consumer_batch(request): |
||
| 645 | 648 |
for log in logs: |
| 646 | 649 |
try: |
| 647 | 650 |
infos.append(ConsumeInfoSubmitLogInfo.objects.get(model_name__icontains=log['model_name'], serialNo=log['code'], status=True, dupload=False).admindata) |
| 648 |
- except: |
|
| 651 |
+ except ConsumeInfoSubmitLogInfo.DoesNotExist: |
|
| 649 | 652 |
unknows.append(log) |
| 650 |
- |
|
| 653 |
+ |
|
| 651 | 654 |
return response(200, 'Batch Get Record Sale Success', u'批量获取销售员销售记录', data={
|
| 652 | 655 |
'logs': infos, |
| 653 | 656 |
'unknows': unknows |
@@ -702,6 +705,7 @@ def record_sale(request): |
||
| 702 | 705 |
'left': left |
| 703 | 706 |
}) |
| 704 | 707 |
|
| 708 |
+ |
|
| 705 | 709 |
def record_sale_batch(request): |
| 706 | 710 |
brand_id = request.POST.get('brand_id', settings.KODO_DEFAULT_BRAND_ID)
|
| 707 | 711 |
admin_id = request.POST.get('admin_id', '')
|
@@ -713,14 +717,15 @@ def record_sale_batch(request): |
||
| 713 | 717 |
for log in logs: |
| 714 | 718 |
try: |
| 715 | 719 |
infos.append(SaleclerkSubmitLogInfo.objects.get(model_name__icontains=log['model_name'], code=log['code'], status=True, dupload=False).admindata) |
| 716 |
- except: |
|
| 720 |
+ except SaleclerkSubmitLogInfo.DoesNotExist: |
|
| 717 | 721 |
unknows.append(log) |
| 718 |
- |
|
| 722 |
+ |
|
| 719 | 723 |
return response(200, 'Batch Get Record Sale Success', u'批量获取销售员销售记录', data={
|
| 720 | 724 |
'logs': infos, |
| 721 | 725 |
'unknows': unknows |
| 722 | 726 |
}) |
| 723 | 727 |
|
| 728 |
+ |
|
| 724 | 729 |
def model_list(request): |
| 725 | 730 |
brand_id = request.POST.get('brand_id', settings.KODO_DEFAULT_BRAND_ID)
|
| 726 | 731 |
admin_id = request.POST.get('admin_id', '')
|
@@ -776,11 +781,11 @@ def member_goods_order(request): |
||
| 776 | 781 |
except AdministratorInfo.DoesNotExist: |
| 777 | 782 |
return response(AdministratorStatusCode.ADMINISTRATOR_NOT_FOUND) |
| 778 | 783 |
|
| 779 |
- orders = GoodsOrderInfo.objects.filter(Q(phone__icontains=query) | Q(user_id=query) | Q(title__icontains=query) & Q(status=True)).order_by('-created_at')
|
|
| 784 |
+ orders = GoodsOrderInfo.objects.filter(Q(phone__icontains=query) | Q(user_id=query) | Q(title__icontains=query) & Q(status=True)).order_by('-pk')
|
|
| 780 | 785 |
|
| 781 | 786 |
if good_type: |
| 782 | 787 |
orders = orders.filter(good_type=good_type) |
| 783 |
- |
|
| 788 |
+ |
|
| 784 | 789 |
# 未发货,即快递单号为空 |
| 785 | 790 |
if order_status == 1: |
| 786 | 791 |
orders = orders.filter(Q(tracking_number__isnull=True) | Q(tracking_number='')) |
@@ -816,6 +821,7 @@ def member_goods_order_update(request): |
||
| 816 | 821 |
|
| 817 | 822 |
return response(200, 'Member Goods Order Update Success', u'会员商品订单修改成功') |
| 818 | 823 |
|
| 824 |
+ |
|
| 819 | 825 |
def member_goods_order_batch_update(request): |
| 820 | 826 |
brand_id = request.POST.get('brand_id', settings.KODO_DEFAULT_BRAND_ID)
|
| 821 | 827 |
admin_id = request.POST.get('admin_id', '')
|
@@ -833,7 +839,7 @@ def member_goods_order_batch_update(request): |
||
| 833 | 839 |
for order in orders: |
| 834 | 840 |
try: |
| 835 | 841 |
GoodsOrderInfo.objects.filter(order_id=order['order_id'], status=True).update(tracking_number=order['tracking_number']) |
| 836 |
- except: |
|
| 842 |
+ except GoodsOrderInfo.DoesNotExist: |
|
| 837 | 843 |
err_orders.append(order['order_id']) |
| 838 | 844 |
|
| 839 | 845 |
if err_orders: |
@@ -870,7 +876,7 @@ def record_warehouse(request): |
||
| 870 | 876 |
end_time = datetime.strptime(end_time + ' 23:59:59', '%Y%m%d %H:%M:%S') |
| 871 | 877 |
logs = logs.filter(created_at__range=(start_time, end_time)) |
| 872 | 878 |
|
| 873 |
- logs = logs.order_by('-created_at')
|
|
| 879 |
+ logs = logs.order_by('-pk')
|
|
| 874 | 880 |
|
| 875 | 881 |
count = logs.count() |
| 876 | 882 |
logs, left = pagination(logs, page, num) |
@@ -882,6 +888,7 @@ def record_warehouse(request): |
||
| 882 | 888 |
'count': count |
| 883 | 889 |
}) |
| 884 | 890 |
|
| 891 |
+ |
|
| 885 | 892 |
def member_activity_list(request): |
| 886 | 893 |
brand_id = request.POST.get('brand_id', settings.KODO_DEFAULT_BRAND_ID)
|
| 887 | 894 |
admin_id = request.POST.get('admin_id', '')
|
@@ -905,9 +912,9 @@ def member_activity_list(request): |
||
| 905 | 912 |
start_time = datetime.strptime(start_time, '%Y%m%d') |
| 906 | 913 |
end_time = datetime.strptime(end_time + ' 23:59:59', '%Y%m%d %H:%M:%S') |
| 907 | 914 |
logs = logs.filter(created_at__range=(start_time, end_time)) |
| 908 |
- |
|
| 909 |
- logs = logs.order_by('-created_at')
|
|
| 910 |
- |
|
| 915 |
+ |
|
| 916 |
+ logs = logs.order_by('-pk')
|
|
| 917 |
+ |
|
| 911 | 918 |
count = logs.count() |
| 912 | 919 |
logs, left = pagination(logs, page, num) |
| 913 | 920 |
logs = [log.admindata for log in logs] |
@@ -917,6 +924,7 @@ def member_activity_list(request): |
||
| 917 | 924 |
'count': count |
| 918 | 925 |
}) |
| 919 | 926 |
|
| 927 |
+ |
|
| 920 | 928 |
def member_activity_details(request): |
| 921 | 929 |
brand_id = request.POST.get('brand_id', settings.KODO_DEFAULT_BRAND_ID)
|
| 922 | 930 |
admin_id = request.POST.get('admin_id', '')
|
@@ -931,15 +939,16 @@ def member_activity_details(request): |
||
| 931 | 939 |
|
| 932 | 940 |
try: |
| 933 | 941 |
log = MemberActivityInfo.objects.get(activity_id=activity_id) |
| 934 |
- except: |
|
| 942 |
+ except MemberActivityInfo.DoesNotExist: |
|
| 935 | 943 |
return response() |
| 936 |
- |
|
| 944 |
+ |
|
| 937 | 945 |
log = log.admindetails |
| 938 | 946 |
|
| 939 | 947 |
return response(200, 'Get Member Activity Record Details Success', u'获取会员活动详情成功', data={
|
| 940 | 948 |
'log': log, |
| 941 | 949 |
}) |
| 942 | 950 |
|
| 951 |
+ |
|
| 943 | 952 |
def member_activity_update(request): |
| 944 | 953 |
brand_id = request.POST.get('brand_id', settings.KODO_DEFAULT_BRAND_ID)
|
| 945 | 954 |
admin_id = request.POST.get('admin_id', '')
|
@@ -971,9 +980,9 @@ def member_activity_update(request): |
||
| 971 | 980 |
|
| 972 | 981 |
try: |
| 973 | 982 |
log = MemberActivityInfo.objects.get(activity_id=activity_id, status=True) |
| 974 |
- except: |
|
| 983 |
+ except MemberActivityInfo.DoesNotExist: |
|
| 975 | 984 |
return response() |
| 976 |
- |
|
| 985 |
+ |
|
| 977 | 986 |
log.title = title |
| 978 | 987 |
log.subtitle = subtitle |
| 979 | 988 |
log.date = datetime.strptime(date + ' 23:59:59', '%Y-%m-%d %H:%M:%S') |
@@ -994,6 +1003,7 @@ def member_activity_update(request): |
||
| 994 | 1003 |
|
| 995 | 1004 |
return response(200, 'MemberActivityInfo Update Success', u'会员活动更新成功') |
| 996 | 1005 |
|
| 1006 |
+ |
|
| 997 | 1007 |
def member_activity_create(request): |
| 998 | 1008 |
brand_id = request.POST.get('brand_id', settings.KODO_DEFAULT_BRAND_ID)
|
| 999 | 1009 |
admin_id = request.POST.get('admin_id', '')
|
@@ -1014,7 +1024,6 @@ def member_activity_create(request): |
||
| 1014 | 1024 |
share_h5_link = request.POST.get('share_h5_link', '')
|
| 1015 | 1025 |
activity_state = int(request.POST.get('activity_state', 0))
|
| 1016 | 1026 |
|
| 1017 |
- |
|
| 1018 | 1027 |
if brand_id != settings.KODO_DEFAULT_BRAND_ID: |
| 1019 | 1028 |
return response(ProductBrandStatusCode.BRAND_NOT_MATCH) |
| 1020 | 1029 |
|
@@ -1045,6 +1054,7 @@ def member_activity_create(request): |
||
| 1045 | 1054 |
|
| 1046 | 1055 |
return response(200, 'MemberActivityInfo Create Success', u'会员活动创建成功') |
| 1047 | 1056 |
|
| 1057 |
+ |
|
| 1048 | 1058 |
def member_activity_share_list(request): |
| 1049 | 1059 |
brand_id = request.POST.get('brand_id', settings.KODO_DEFAULT_BRAND_ID)
|
| 1050 | 1060 |
admin_id = request.POST.get('admin_id', '')
|
@@ -1065,7 +1075,7 @@ def member_activity_share_list(request): |
||
| 1065 | 1075 |
total_integral = logs.aggregate(Sum('integral'))['integral__sum']
|
| 1066 | 1076 |
|
| 1067 | 1077 |
logs = logs.values('share_user_id').annotate(integral_sum=Sum('integral'), group_count=Count('open_gid'), user_count=Count('click_user_id')).order_by('-user_count')
|
| 1068 |
- |
|
| 1078 |
+ |
|
| 1069 | 1079 |
count = logs.count() |
| 1070 | 1080 |
logs, left = pagination(logs, page, num) |
| 1071 | 1081 |
|
@@ -1076,6 +1086,7 @@ def member_activity_share_list(request): |
||
| 1076 | 1086 |
'total_integral': total_integral |
| 1077 | 1087 |
}) |
| 1078 | 1088 |
|
| 1089 |
+ |
|
| 1079 | 1090 |
def coupon_list(request): |
| 1080 | 1091 |
brand_id = request.POST.get('brand_id', settings.KODO_DEFAULT_BRAND_ID)
|
| 1081 | 1092 |
admin_id = request.POST.get('admin_id', '')
|
@@ -1099,22 +1110,25 @@ def coupon_list(request): |
||
| 1099 | 1110 |
start_time = datetime.strptime(start_time, '%Y%m%d') |
| 1100 | 1111 |
end_time = datetime.strptime(end_time + ' 23:59:59', '%Y%m%d %H:%M:%S') |
| 1101 | 1112 |
logs = logs.filter(created_at__range=(start_time, end_time)) |
| 1102 |
- |
|
| 1103 |
- logs = logs.order_by('-created_at')
|
|
| 1104 |
- |
|
| 1113 |
+ |
|
| 1114 |
+ logs = logs.order_by('-pk')
|
|
| 1115 |
+ |
|
| 1105 | 1116 |
count = logs.count() |
| 1106 | 1117 |
logs, left = pagination(logs, page, num) |
| 1107 | 1118 |
logs = [log.admindata for log in logs] |
| 1119 |
+ |
|
| 1108 | 1120 |
return response(200, 'Get CouponInfo List Success', u'获取劵列表成功', data={
|
| 1109 | 1121 |
'logs': logs, |
| 1110 | 1122 |
'left': left, |
| 1111 | 1123 |
'count': count |
| 1112 | 1124 |
}) |
| 1113 | 1125 |
|
| 1126 |
+ |
|
| 1114 | 1127 |
def coupon_details(request): |
| 1115 | 1128 |
brand_id = request.POST.get('brand_id', settings.KODO_DEFAULT_BRAND_ID)
|
| 1116 | 1129 |
admin_id = request.POST.get('admin_id', '')
|
| 1117 | 1130 |
coupon_id = request.POST.get('coupon_id', '')
|
| 1131 |
+ |
|
| 1118 | 1132 |
if brand_id != settings.KODO_DEFAULT_BRAND_ID: |
| 1119 | 1133 |
return response(ProductBrandStatusCode.BRAND_NOT_MATCH) |
| 1120 | 1134 |
|
@@ -1125,15 +1139,16 @@ def coupon_details(request): |
||
| 1125 | 1139 |
|
| 1126 | 1140 |
try: |
| 1127 | 1141 |
log = CouponInfo.objects.get(coupon_id=coupon_id) |
| 1128 |
- except: |
|
| 1142 |
+ except CouponInfo.DoesNotExist: |
|
| 1129 | 1143 |
return response() |
| 1130 |
- |
|
| 1144 |
+ |
|
| 1131 | 1145 |
log = log.admindetails |
| 1132 | 1146 |
|
| 1133 | 1147 |
return response(200, 'Get Member Activity Record Details Success', u'获取会员活动详情成功', data={
|
| 1134 | 1148 |
'log': log, |
| 1135 | 1149 |
}) |
| 1136 | 1150 |
|
| 1151 |
+ |
|
| 1137 | 1152 |
def coupon_create(request): |
| 1138 | 1153 |
brand_id = request.POST.get('brand_id', settings.KODO_DEFAULT_BRAND_ID)
|
| 1139 | 1154 |
admin_id = request.POST.get('admin_id', '')
|
@@ -1155,14 +1170,14 @@ def coupon_create(request): |
||
| 1155 | 1170 |
return response(AdministratorStatusCode.ADMINISTRATOR_NOT_FOUND) |
| 1156 | 1171 |
|
| 1157 | 1172 |
info = CouponInfo.objects.create( |
| 1158 |
- brand_id = brand_id, |
|
| 1159 |
- coupon_title = coupon_title, |
|
| 1160 |
- coupon_detail = coupon_detail, |
|
| 1161 |
- coupon_value = coupon_value, |
|
| 1162 |
- coupon_image = coupon_image, |
|
| 1163 |
- coupon_expire_type = coupon_expire_type, |
|
| 1164 |
- coupon_valid_period = coupon_valid_period, |
|
| 1165 |
- is_coupon_admin_writeoff = is_coupon_admin_writeoff |
|
| 1173 |
+ brand_id=brand_id, |
|
| 1174 |
+ coupon_title=coupon_title, |
|
| 1175 |
+ coupon_detail=coupon_detail, |
|
| 1176 |
+ coupon_value=coupon_value, |
|
| 1177 |
+ coupon_image=coupon_image, |
|
| 1178 |
+ coupon_expire_type=coupon_expire_type, |
|
| 1179 |
+ coupon_valid_period=coupon_valid_period, |
|
| 1180 |
+ is_coupon_admin_writeoff=is_coupon_admin_writeoff, |
|
| 1166 | 1181 |
) |
| 1167 | 1182 |
|
| 1168 | 1183 |
if coupon_expire_at: |
@@ -1171,6 +1186,7 @@ def coupon_create(request): |
||
| 1171 | 1186 |
|
| 1172 | 1187 |
return response(200, 'CouponInfo Create Success', u'劵创建成功') |
| 1173 | 1188 |
|
| 1189 |
+ |
|
| 1174 | 1190 |
def coupon_update(request): |
| 1175 | 1191 |
brand_id = request.POST.get('brand_id', settings.KODO_DEFAULT_BRAND_ID)
|
| 1176 | 1192 |
admin_id = request.POST.get('admin_id', '')
|
@@ -1194,9 +1210,9 @@ def coupon_update(request): |
||
| 1194 | 1210 |
|
| 1195 | 1211 |
try: |
| 1196 | 1212 |
log = CouponInfo.objects.get(coupon_id=coupon_id, status=True) |
| 1197 |
- except: |
|
| 1213 |
+ except CouponInfo.DoesNotExist: |
|
| 1198 | 1214 |
return response() |
| 1199 |
- |
|
| 1215 |
+ |
|
| 1200 | 1216 |
log.brand_id = brand_id |
| 1201 | 1217 |
log.coupon_title = coupon_title |
| 1202 | 1218 |
log.coupon_detail = coupon_detail |
@@ -1211,6 +1227,7 @@ def coupon_update(request): |
||
| 1211 | 1227 |
|
| 1212 | 1228 |
return response(200, 'CouponInfo Update Success', u'劵更新成功') |
| 1213 | 1229 |
|
| 1230 |
+ |
|
| 1214 | 1231 |
def coupon_delete(request): |
| 1215 | 1232 |
brand_id = request.POST.get('brand_id', settings.KODO_DEFAULT_BRAND_ID)
|
| 1216 | 1233 |
admin_id = request.POST.get('admin_id', '')
|
@@ -1226,14 +1243,15 @@ def coupon_delete(request): |
||
| 1226 | 1243 |
|
| 1227 | 1244 |
try: |
| 1228 | 1245 |
log = CouponInfo.objects.get(coupon_id=coupon_id, status=True) |
| 1229 |
- except: |
|
| 1246 |
+ except CouponInfo.DoesNotExist: |
|
| 1230 | 1247 |
return response() |
| 1231 |
- |
|
| 1248 |
+ |
|
| 1232 | 1249 |
log.status = False |
| 1233 | 1250 |
log.save() |
| 1234 | 1251 |
|
| 1235 | 1252 |
return response(200, 'CouponInfo Delete Success', u'劵删除成功') |
| 1236 | 1253 |
|
| 1254 |
+ |
|
| 1237 | 1255 |
def member_goods_list(request): |
| 1238 | 1256 |
brand_id = request.POST.get('brand_id', settings.KODO_DEFAULT_BRAND_ID)
|
| 1239 | 1257 |
admin_id = request.POST.get('admin_id', '')
|
@@ -1249,8 +1267,8 @@ def member_goods_list(request): |
||
| 1249 | 1267 |
except AdministratorInfo.DoesNotExist: |
| 1250 | 1268 |
return response(AdministratorStatusCode.ADMINISTRATOR_NOT_FOUND) |
| 1251 | 1269 |
|
| 1252 |
- logs = GoodsInfo.objects.filter(title__icontains=title, only_for_member=False).order_by('-created_at')
|
|
| 1253 |
- |
|
| 1270 |
+ logs = GoodsInfo.objects.filter(title__icontains=title, only_for_member=False).order_by('-pk')
|
|
| 1271 |
+ |
|
| 1254 | 1272 |
count = logs.count() |
| 1255 | 1273 |
logs, left = pagination(logs, page, num) |
| 1256 | 1274 |
logs = [log.admindata for log in logs] |
@@ -1260,10 +1278,12 @@ def member_goods_list(request): |
||
| 1260 | 1278 |
'count': count |
| 1261 | 1279 |
}) |
| 1262 | 1280 |
|
| 1281 |
+ |
|
| 1263 | 1282 |
def member_goods_details(request): |
| 1264 | 1283 |
brand_id = request.POST.get('brand_id', settings.KODO_DEFAULT_BRAND_ID)
|
| 1265 | 1284 |
admin_id = request.POST.get('admin_id', '')
|
| 1266 | 1285 |
good_id = request.POST.get('good_id', '')
|
| 1286 |
+ |
|
| 1267 | 1287 |
if brand_id != settings.KODO_DEFAULT_BRAND_ID: |
| 1268 | 1288 |
return response(ProductBrandStatusCode.BRAND_NOT_MATCH) |
| 1269 | 1289 |
|
@@ -1274,15 +1294,16 @@ def member_goods_details(request): |
||
| 1274 | 1294 |
|
| 1275 | 1295 |
try: |
| 1276 | 1296 |
log = GoodsInfo.objects.get(good_id=good_id) |
| 1277 |
- except: |
|
| 1297 |
+ except GoodsInfo.DoesNotExist: |
|
| 1278 | 1298 |
return response() |
| 1279 |
- |
|
| 1299 |
+ |
|
| 1280 | 1300 |
log = log.admindetails |
| 1281 | 1301 |
|
| 1282 | 1302 |
return response(200, 'Get Member Goods Details Success', u'获取积分商品详情成功', data={
|
| 1283 | 1303 |
'log': log, |
| 1284 | 1304 |
}) |
| 1285 | 1305 |
|
| 1306 |
+ |
|
| 1286 | 1307 |
def member_goods_update(request): |
| 1287 | 1308 |
brand_id = request.POST.get('brand_id', settings.KODO_DEFAULT_BRAND_ID)
|
| 1288 | 1309 |
admin_id = request.POST.get('admin_id', '')
|
@@ -1307,9 +1328,9 @@ def member_goods_update(request): |
||
| 1307 | 1328 |
|
| 1308 | 1329 |
try: |
| 1309 | 1330 |
log = GoodsInfo.objects.get(good_id=good_id, status=True) |
| 1310 |
- except: |
|
| 1331 |
+ except GoodsInfo.DoesNotExist: |
|
| 1311 | 1332 |
return response() |
| 1312 |
- |
|
| 1333 |
+ |
|
| 1313 | 1334 |
log.title = title |
| 1314 | 1335 |
log.desc = desc |
| 1315 | 1336 |
log.value = value |
@@ -1323,6 +1344,7 @@ def member_goods_update(request): |
||
| 1323 | 1344 |
|
| 1324 | 1345 |
return response(200, 'GoodsInfo Update Success', u'积分商品更新成功') |
| 1325 | 1346 |
|
| 1347 |
+ |
|
| 1326 | 1348 |
def member_goods_create(request): |
| 1327 | 1349 |
brand_id = request.POST.get('brand_id', settings.KODO_DEFAULT_BRAND_ID)
|
| 1328 | 1350 |
admin_id = request.POST.get('admin_id', '')
|
@@ -1359,4 +1381,4 @@ def member_goods_create(request): |
||
| 1359 | 1381 |
fee=fee, |
| 1360 | 1382 |
) |
| 1361 | 1383 |
|
| 1362 |
- return response(200, 'GoodsInfo Create Success', u'积分商品创建成功') |
|
| 1384 |
+ return response(200, 'GoodsInfo Create Success', u'积分商品创建成功') |
@@ -0,0 +1,52 @@ |
||
| 1 |
+# -*- coding: utf-8 -*- |
|
| 2 |
+ |
|
| 3 |
+from __future__ import division |
|
| 4 |
+ |
|
| 5 |
+from django_logit import logit |
|
| 6 |
+from django_response import response |
|
| 7 |
+ |
|
| 8 |
+from logs.models import ComplementCodeLogInfo |
|
| 9 |
+from paginator import pagination |
|
| 10 |
+ |
|
| 11 |
+ |
|
| 12 |
+@logit(res=True) |
|
| 13 |
+def complement_code(request): |
|
| 14 |
+ user_id = request.POST.get('user_id', '')
|
|
| 15 |
+ log_id = request.POST.get('log_id', '')
|
|
| 16 |
+ name = request.POST.get('name', '')
|
|
| 17 |
+ phone = request.POST.get('phone', '')
|
|
| 18 |
+ model_id = request.POST.get('model_id', '')
|
|
| 19 |
+ model_name = request.POST.get('model_name', '')
|
|
| 20 |
+ sn = request.POST.get('sn', '')
|
|
| 21 |
+ shot_path = request.POST.get('shot_path', '')
|
|
| 22 |
+ invoice_path = request.POST.get('invoice_path', '')
|
|
| 23 |
+ |
|
| 24 |
+ log = ComplementCodeLogInfo.objects.update_or_create(user_id=user_id, log_id=log_id, defaults={
|
|
| 25 |
+ 'name': name, |
|
| 26 |
+ 'phone': phone, |
|
| 27 |
+ 'model_id': model_id, |
|
| 28 |
+ 'model_name': model_name, |
|
| 29 |
+ 'sn': sn, |
|
| 30 |
+ 'shot_path': shot_path, |
|
| 31 |
+ 'invoice_path': invoice_path, |
|
| 32 |
+ }) |
|
| 33 |
+ |
|
| 34 |
+ return response(data={
|
|
| 35 |
+ 'log_id': log.log_id, |
|
| 36 |
+ }) |
|
| 37 |
+ |
|
| 38 |
+ |
|
| 39 |
+def complement_code_list(request): |
|
| 40 |
+ user_id = request.POST.get('user_id', '')
|
|
| 41 |
+ page = request.POST.get('page', 1)
|
|
| 42 |
+ num = request.POST.get('num', 20)
|
|
| 43 |
+ |
|
| 44 |
+ logs = ComplementCodeLogInfo.objects.filter(user_id=user_id, status=True).order_by('-pk')
|
|
| 45 |
+ |
|
| 46 |
+ logs, left = pagination(logs, page, num) |
|
| 47 |
+ logs = [log.admindata for log in logs] |
|
| 48 |
+ |
|
| 49 |
+ return response(200, 'Get Complement Code List Success', u'获取补码列表成功', data={
|
|
| 50 |
+ 'logs': logs, |
|
| 51 |
+ 'left': left, |
|
| 52 |
+ }) |
@@ -356,11 +356,11 @@ def consumer_info_api(request): |
||
| 356 | 356 |
submit_pk=log.pk, |
| 357 | 357 |
) |
| 358 | 358 |
|
| 359 |
- #更新注册时间 |
|
| 359 |
+ # 更新注册时间 |
|
| 360 | 360 |
if not dupload: |
| 361 | 361 |
user.resgister_at = log.created_at |
| 362 | 362 |
user.save() |
| 363 |
- |
|
| 363 |
+ |
|
| 364 | 364 |
if not user.test_user and not dupload: |
| 365 | 365 |
|
| 366 | 366 |
# TODO: Make statistic async |
@@ -453,7 +453,7 @@ def consumer_info_api(request): |
||
| 453 | 453 |
user.integral += model.shot_member_integral |
| 454 | 454 |
# 配件不增加会员等级,只发放积分。 |
| 455 | 455 |
to_send_coupon = False |
| 456 |
- if user.level < UserInfo.MEMBER_BLACK_GOLD and model.category != '调焦器' and model.category !='增倍镜': |
|
| 456 |
+ if user.level < UserInfo.MEMBER_BLACK_GOLD and model.category != '调焦器' and model.category != '增倍镜': |
|
| 457 | 457 |
user.level += 1 |
| 458 | 458 |
to_send_coupon = True |
| 459 | 459 |
user.save() |
@@ -491,6 +491,7 @@ def consumer_snlist_api(request): |
||
| 491 | 491 |
'logs': logs, |
| 492 | 492 |
}) |
| 493 | 493 |
|
| 494 |
+ |
|
| 494 | 495 |
@logit(res=True) |
| 495 | 496 |
@transaction.atomic |
| 496 | 497 |
def consumer_model_list(request): |
@@ -501,11 +502,11 @@ def consumer_model_list(request): |
||
| 501 | 502 |
user = UserInfo.objects.get(user_id=user_id) |
| 502 | 503 |
except UserInfo.DoesNotExist: |
| 503 | 504 |
return response(UserStatusCode.USER_NOT_FOUND) |
| 504 |
- |
|
| 505 |
- #返回型号列表 |
|
| 505 |
+ |
|
| 506 |
+ # 返回型号列表 |
|
| 506 | 507 |
models = ModelInfo.objects.filter(shot_type_id__isnull=False, status=True).order_by('-shot_member_name')
|
| 507 | 508 |
models = [model.consumer_shot_data for model in models] |
| 508 |
- |
|
| 509 |
+ |
|
| 509 | 510 |
return response(200, 'Get Model List Success', u'获取型号列表成功', {
|
| 510 | 511 |
'models': models, |
| 511 |
- }) |
|
| 512 |
+ }) |
@@ -71,7 +71,7 @@ def exec_del_clerk_sale_submit(pk, admin_id): |
||
| 71 | 71 |
clerk.total_integral -= integral |
| 72 | 72 |
clerk.save() |
| 73 | 73 |
|
| 74 |
- #记录删除日志 |
|
| 74 |
+ # 记录删除日志 |
|
| 75 | 75 |
StaffDeleteClerkSaleSubmitLogInfo.objects.create( |
| 76 | 76 |
admin_id=admin_id, |
| 77 | 77 |
log_pk=pk, |
@@ -239,6 +239,7 @@ def del_clerk_sale_submit_api(request): |
||
| 239 | 239 |
|
| 240 | 240 |
return response(200, 'Del Success', u'删除成功') |
| 241 | 241 |
|
| 242 |
+ |
|
| 242 | 243 |
@logit |
| 243 | 244 |
@transaction.atomic |
| 244 | 245 |
def batch_del_clerk_sale_submit_api(request): |
@@ -290,8 +291,8 @@ def exec_del_consumer_submit(pk, admin_id): |
||
| 290 | 291 |
user = UserInfo.objects.select_for_update().get(user_id=ssli.user_id) |
| 291 | 292 |
except UserInfo.DoesNotExist: |
| 292 | 293 |
return response() |
| 293 |
- |
|
| 294 |
- #记录删除日志 |
|
| 294 |
+ |
|
| 295 |
+ # 记录删除日志 |
|
| 295 | 296 |
StaffDeleteConsumerSubmitLogInfo.objects.create( |
| 296 | 297 |
admin_id=admin_id, |
| 297 | 298 |
log_pk=pk, |
@@ -505,8 +506,8 @@ def batch_del_consumer_submit_api(request): |
||
| 505 | 506 |
administrator = AdministratorInfo.objects.get(admin_id=admin_id, user_status=AdministratorInfo.ACTIVATED, status=True) |
| 506 | 507 |
except AdministratorInfo.DoesNotExist: |
| 507 | 508 |
return response(AdministratorStatusCode.ADMINISTRATOR_NOT_FOUND) |
| 508 |
- |
|
| 509 |
+ |
|
| 509 | 510 |
for pk in pks: |
| 510 | 511 |
exec_del_consumer_submit(pk, admin_id) |
| 511 | 512 |
|
| 512 |
- return response(200, 'Del Success', u'删除成功') |
|
| 513 |
+ return response(200, 'Del Success', u'删除成功') |
@@ -3,15 +3,12 @@ |
||
| 3 | 3 |
from django.conf.urls import url |
| 4 | 4 |
from django_file_upload import views as file_views |
| 5 | 5 |
|
| 6 |
-from account import views as account_views |
|
| 7 |
-from api import (admin_views, clerk_views, distributor_views, encrypt_views, log_views, mch_views, member_views, |
|
| 6 |
+from api import (admin_views, clerk_views, complement_views, distributor_views, encrypt_views, log_views, mch_views, member_views, |
|
| 8 | 7 |
model_views, operator_views, refresh_views, sr_views, staff_views, wx_views) |
| 9 | 8 |
from miniapp import qy_views |
| 10 | 9 |
from miniapp import views as mini_views |
| 11 |
-from operation import views as op_views |
|
| 12 | 10 |
from page import oauth_views, sale_views, screen_views |
| 13 | 11 |
from sales import views as sales_views |
| 14 |
-from server import server_views |
|
| 15 | 12 |
from statistic import views as tj_views |
| 16 | 13 |
|
| 17 | 14 |
# Mini App |
@@ -163,13 +160,13 @@ urlpatterns += [ |
||
| 163 | 160 |
url(r'^admin/member/goods/order$', admin_views.member_goods_order, name='member_goods_order'), |
| 164 | 161 |
url(r'^admin/member/goods/order/update$', admin_views.member_goods_order_update, name='member_goods_order_update'), |
| 165 | 162 |
url(r'^admin/member/goods/order/batch/update$', admin_views.member_goods_order_batch_update, name='member_goods_order_batch_update'), |
| 166 |
- |
|
| 163 |
+ |
|
| 167 | 164 |
url(r'^admin/member/activity/list$', admin_views.member_activity_list, name='member_activity_list'), |
| 168 | 165 |
url(r'^admin/member/activity/details$', admin_views.member_activity_details, name='member_activity_details'), |
| 169 | 166 |
url(r'^admin/member/activity/update$', admin_views.member_activity_update, name='member_activity_update'), |
| 170 | 167 |
url(r'^admin/member/activity/create$', admin_views.member_activity_create, name='member_activity_create'), |
| 171 | 168 |
url(r'^admin/member/activity/share/list$', admin_views.member_activity_share_list, name='member_activity_share_list'), |
| 172 |
- |
|
| 169 |
+ |
|
| 173 | 170 |
url(r'^admin/coupon/list$', admin_views.coupon_list, name='coupon_list'), |
| 174 | 171 |
url(r'^admin/coupon/details$', admin_views.coupon_details, name='coupon_update'), |
| 175 | 172 |
url(r'^admin/coupon/create$', admin_views.coupon_create, name='coupon_create'), |
@@ -240,3 +237,8 @@ urlpatterns += [ |
||
| 240 | 237 |
urlpatterns += [ |
| 241 | 238 |
url(r'^get_limit_scene_qrcode_url$', wx_views.get_limit_scene_qrcode_url, name='get_limit_scene_qrcode_url'), |
| 242 | 239 |
] |
| 240 |
+ |
|
| 241 |
+urlpatterns += [ |
|
| 242 |
+ url(r'^complement/code$', complement_views.complement_code, name='complement_code'), |
|
| 243 |
+ url(r'^complement/code/list$', complement_views.complement_code_list, name='complement_code_list'), |
|
| 244 |
+] |
@@ -56,7 +56,7 @@ class CouponInfo(BaseModelMixin): |
||
| 56 | 56 |
if self.coupon_expire_type == CouponInfo.FIXED_EXPIRED_TIME: |
| 57 | 57 |
return self.coupon_expire_at |
| 58 | 58 |
return tc.utc_datetime(days=self.coupon_valid_period) |
| 59 |
- |
|
| 59 |
+ |
|
| 60 | 60 |
@property |
| 61 | 61 |
def admindata(self): |
| 62 | 62 |
return {
|
@@ -71,7 +71,7 @@ class CouponInfo(BaseModelMixin): |
||
| 71 | 71 |
'is_coupon_admin_writeoff': self.is_coupon_admin_writeoff, |
| 72 | 72 |
'created_at': tc.local_string(utc_dt=self.created_at, format='%Y-%m-%d %H:%M:%S'), |
| 73 | 73 |
} |
| 74 |
- |
|
| 74 |
+ |
|
| 75 | 75 |
@property |
| 76 | 76 |
def admindetails(self): |
| 77 | 77 |
return {
|
@@ -3,7 +3,7 @@ |
||
| 3 | 3 |
from django.contrib import admin |
| 4 | 4 |
from django_admin import ReadOnlyModelAdmin |
| 5 | 5 |
|
| 6 |
-from logs.models import MchInfoDecryptLogInfo, MchInfoEncryptLogInfo, MchLogInfo, MchSearchModelAndCameraLogInfo |
|
| 6 |
+from logs.models import MchInfoDecryptLogInfo, MchInfoEncryptLogInfo, MchLogInfo, MchSearchModelAndCameraLogInfo, ComplementCodeLogInfo |
|
| 7 | 7 |
|
| 8 | 8 |
|
| 9 | 9 |
class MchInfoEncryptLogInfoAdmin(ReadOnlyModelAdmin, admin.ModelAdmin): |
@@ -22,18 +22,18 @@ class MchLogInfoAdmin(ReadOnlyModelAdmin, admin.ModelAdmin): |
||
| 22 | 22 |
search_fields = ('operator_id', 'app_version')
|
| 23 | 23 |
|
| 24 | 24 |
|
| 25 |
-class MchLogInfoAdmin(ReadOnlyModelAdmin, admin.ModelAdmin): |
|
| 26 |
- list_display = ('log_id', 'log_file', 'operator_id', 'app_version', 'status', 'created_at', 'updated_at')
|
|
| 27 |
- list_filter = ('operator_id', 'app_version', 'status')
|
|
| 28 |
- search_fields = ('operator_id', 'app_version')
|
|
| 29 |
- |
|
| 30 |
- |
|
| 31 | 25 |
class MchSearchModelAndCameraLogInfoAdmin(admin.ModelAdmin): |
| 32 | 26 |
list_display = ('user_id', 'is_search_model', 'is_selected_model', 'is_search_camera', 'is_search_model_camera', 'is_search_camera_after_model', 'created_at')
|
| 33 | 27 |
list_filter = ('is_search_model', 'is_selected_model', 'is_search_camera', 'is_search_model_camera', 'is_search_camera_after_model')
|
| 34 | 28 |
|
| 35 | 29 |
|
| 30 |
+class ComplementCodeLogInfoAdmin(admin.ModelAdmin): |
|
| 31 |
+ list_display = ('user_id', 'log_id', 'name', 'phone', 'model_id', 'model_name', 'sn', 'shot_image', 'invoice_image', 'status', 'created_at', 'updated_at')
|
|
| 32 |
+ list_filter = ('model_id', 'status')
|
|
| 33 |
+ |
|
| 34 |
+ |
|
| 36 | 35 |
admin.site.register(MchInfoDecryptLogInfo, MchInfoDecryptLogInfoAdmin) |
| 37 | 36 |
admin.site.register(MchInfoEncryptLogInfo, MchInfoEncryptLogInfoAdmin) |
| 38 | 37 |
admin.site.register(MchSearchModelAndCameraLogInfo, MchSearchModelAndCameraLogInfoAdmin) |
| 39 | 38 |
admin.site.register(MchLogInfo, MchLogInfoAdmin) |
| 39 |
+admin.site.register(ComplementCodeLogInfo, ComplementCodeLogInfoAdmin) |
@@ -0,0 +1,39 @@ |
||
| 1 |
+# -*- coding: utf-8 -*- |
|
| 2 |
+# Generated by Django 1.11.29 on 2021-01-04 07:47 |
|
| 3 |
+from __future__ import unicode_literals |
|
| 4 |
+ |
|
| 5 |
+from django.db import migrations, models |
|
| 6 |
+import django_models_ext.fileext |
|
| 7 |
+import shortuuidfield.fields |
|
| 8 |
+ |
|
| 9 |
+ |
|
| 10 |
+class Migration(migrations.Migration): |
|
| 11 |
+ |
|
| 12 |
+ dependencies = [ |
|
| 13 |
+ ('logs', '0012_auto_20201130_0131'),
|
|
| 14 |
+ ] |
|
| 15 |
+ |
|
| 16 |
+ operations = [ |
|
| 17 |
+ migrations.CreateModel( |
|
| 18 |
+ name='ComplementCodeLogInfo', |
|
| 19 |
+ fields=[ |
|
| 20 |
+ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
|
| 21 |
+ ('status', models.BooleanField(default=True, help_text='Status', verbose_name='status')),
|
|
| 22 |
+ ('created_at', models.DateTimeField(auto_now_add=True, help_text='Create Time', verbose_name='created_at')),
|
|
| 23 |
+ ('updated_at', models.DateTimeField(auto_now=True, help_text='Update Time', verbose_name='updated_at')),
|
|
| 24 |
+ ('user_id', models.CharField(blank=True, db_index=True, help_text='\u7528\u6237\u552f\u4e00\u6807\u8bc6', max_length=32, null=True, verbose_name='user_id')),
|
|
| 25 |
+ ('log_id', shortuuidfield.fields.ShortUUIDField(blank=True, db_index=True, editable=False, help_text='\u65e5\u5fd7\u552f\u4e00\u6807\u8bc6', max_length=22)),
|
|
| 26 |
+ ('name', models.CharField(blank=True, help_text='\u7528\u6237\u59d3\u540d', max_length=255, null=True, verbose_name='name')),
|
|
| 27 |
+ ('phone', models.CharField(blank=True, db_index=True, help_text='\u7528\u6237\u7535\u8bdd', max_length=11, null=True, verbose_name='phone')),
|
|
| 28 |
+ ('model_id', models.CharField(blank=True, db_index=True, help_text='\u578b\u53f7\u552f\u4e00\u6807\u8bc6', max_length=32, null=True, verbose_name='model_id')),
|
|
| 29 |
+ ('model_name', models.CharField(blank=True, help_text='\u578b\u53f7\u540d\u79f0', max_length=255, null=True, verbose_name='model_name')),
|
|
| 30 |
+ ('sn', models.CharField(blank=True, db_index=True, help_text='\u5e8f\u5217\u53f7', max_length=32, null=True, verbose_name='sn')),
|
|
| 31 |
+ ('shot_image', models.ImageField(blank=True, help_text='\u955c\u5934\u673a\u8eab\u7167\u7247', null=True, upload_to=django_models_ext.fileext.upload_path, verbose_name='shot_image')),
|
|
| 32 |
+ ('invoice_image', models.ImageField(blank=True, help_text='\u8d2d\u4e70\u51ed\u8bc1\u7167\u7247', null=True, upload_to=django_models_ext.fileext.upload_path, verbose_name='invoice_image')),
|
|
| 33 |
+ ], |
|
| 34 |
+ options={
|
|
| 35 |
+ 'verbose_name': '\u8865\u7801\u8bb0\u5f55', |
|
| 36 |
+ 'verbose_name_plural': '\u8865\u7801\u8bb0\u5f55', |
|
| 37 |
+ }, |
|
| 38 |
+ ), |
|
| 39 |
+ ] |
@@ -113,3 +113,27 @@ class MchSearchModelAndCameraLogInfo(BaseModelMixin): |
||
| 113 | 113 |
|
| 114 | 114 |
def __unicode__(self): |
| 115 | 115 |
return '%d' % self.pk |
| 116 |
+ |
|
| 117 |
+ |
|
| 118 |
+class ComplementCodeLogInfo(BaseModelMixin): |
|
| 119 |
+ user_id = models.CharField(_(u'user_id'), max_length=32, blank=True, null=True, help_text=u'用户唯一标识', db_index=True) |
|
| 120 |
+ |
|
| 121 |
+ log_id = ShortUUIDField(_(u'log_id'), max_length=32, help_text=u'日志唯一标识', db_index=True) |
|
| 122 |
+ |
|
| 123 |
+ name = models.CharField(_(u'name'), max_length=255, blank=True, null=True, help_text=u'用户姓名') |
|
| 124 |
+ phone = models.CharField(_(u'phone'), max_length=11, blank=True, null=True, help_text=u'用户电话', db_index=True) |
|
| 125 |
+ |
|
| 126 |
+ model_id = models.CharField(_(u'model_id'), max_length=32, blank=True, null=True, help_text=u'型号唯一标识', db_index=True) |
|
| 127 |
+ model_name = models.CharField(_(u'model_name'), max_length=255, blank=True, null=True, help_text=u'型号名称') |
|
| 128 |
+ |
|
| 129 |
+ sn = models.CharField(_(u'sn'), max_length=32, blank=True, null=True, help_text=u'序列号', db_index=True) |
|
| 130 |
+ |
|
| 131 |
+ shot_image = models.ImageField(_(u'shot_image'), upload_to=upload_path, blank=True, null=True, help_text=u'镜头机身照片') |
|
| 132 |
+ invoice_image = models.ImageField(_(u'invoice_image'), upload_to=upload_path, blank=True, null=True, help_text=u'购买凭证照片') |
|
| 133 |
+ |
|
| 134 |
+ class Meta: |
|
| 135 |
+ verbose_name = _(u'补码记录') |
|
| 136 |
+ verbose_name_plural = _(u'补码记录') |
|
| 137 |
+ |
|
| 138 |
+ def __unicode__(self): |
|
| 139 |
+ return '%d' % self.pk |
@@ -11,6 +11,7 @@ from TimeConvert import TimeConvert as tc |
||
| 11 | 11 |
|
| 12 | 12 |
from coupon.models import CouponInfo |
| 13 | 13 |
|
| 14 |
+ |
|
| 14 | 15 |
class AdministratorInfo(BaseModelMixin): |
| 15 | 16 |
ADMINISTRATOR = 0 |
| 16 | 17 |
MAINTENANCE = 1 |
@@ -259,7 +260,7 @@ class ModelInfo(BaseModelMixin): |
||
| 259 | 260 |
'shot_image': self.shot_member_image_url, |
| 260 | 261 |
'integral': self.shot_member_integral, |
| 261 | 262 |
} |
| 262 |
- |
|
| 263 |
+ |
|
| 263 | 264 |
@property |
| 264 | 265 |
def consumer_shot_data(self): |
| 265 | 266 |
from member.models import ShotTypeInfo |
@@ -276,6 +277,7 @@ class ModelInfo(BaseModelMixin): |
||
| 276 | 277 |
'shot_type_name': shot_type.shot_type_name |
| 277 | 278 |
} |
| 278 | 279 |
|
| 280 |
+ |
|
| 279 | 281 |
class ModelImageInfo(BaseModelMixin): |
| 280 | 282 |
model_id = models.CharField(_(u'model_id'), max_length=32, blank=True, null=True, help_text=u'型号唯一标识', db_index=True) |
| 281 | 283 |
model_name = models.CharField(_(u'model_name'), max_length=255, blank=True, null=True, help_text=u'型号名称') |
@@ -102,7 +102,7 @@ class GoodsInfo(BaseModelMixin): |
||
| 102 | 102 |
def admindata(self): |
| 103 | 103 |
try: |
| 104 | 104 |
coupon = CouponInfo.objects.get(coupon_id=self.coupon_id).admindata |
| 105 |
- except: |
|
| 105 |
+ except CouponInfo.DoesNotExist: |
|
| 106 | 106 |
coupon = {}
|
| 107 | 107 |
return {
|
| 108 | 108 |
'good_id': self.good_id, |
@@ -119,12 +119,12 @@ class GoodsInfo(BaseModelMixin): |
||
| 119 | 119 |
'coupon': coupon, |
| 120 | 120 |
'created_at': tc.local_string(utc_dt=self.created_at, format='%Y-%m-%d %H:%M:%S'), |
| 121 | 121 |
} |
| 122 |
- |
|
| 122 |
+ |
|
| 123 | 123 |
@property |
| 124 | 124 |
def admindetails(self): |
| 125 | 125 |
try: |
| 126 | 126 |
coupon = CouponInfo.objects.get(coupon_id=self.coupon_id).admindata |
| 127 |
- except: |
|
| 127 |
+ except CouponInfo.DoesNotExist: |
|
| 128 | 128 |
coupon = {}
|
| 129 | 129 |
return {
|
| 130 | 130 |
'good_id': self.good_id, |
@@ -143,6 +143,7 @@ class GoodsInfo(BaseModelMixin): |
||
| 143 | 143 |
'created_at': tc.local_string(utc_dt=self.created_at, format='%Y-%m-%d %H:%M:%S'), |
| 144 | 144 |
} |
| 145 | 145 |
|
| 146 |
+ |
|
| 146 | 147 |
class GoodsOrderInfo(BaseModelMixin): |
| 147 | 148 |
PHYSICAL = 0 |
| 148 | 149 |
VIRTUAL = 1 |
@@ -456,7 +457,7 @@ class MemberActivityInfo(BaseModelMixin): |
||
| 456 | 457 |
'is_signed': self.is_signed(user_id), |
| 457 | 458 |
'is_signup': self.is_signup, |
| 458 | 459 |
} |
| 459 |
- |
|
| 460 |
+ |
|
| 460 | 461 |
@property |
| 461 | 462 |
def admindata(self): |
| 462 | 463 |
return {
|
@@ -482,7 +483,7 @@ class MemberActivityInfo(BaseModelMixin): |
||
| 482 | 483 |
'activity_state': self.activity_state, |
| 483 | 484 |
'created_at': tc.local_string(utc_dt=self.created_at, format='%Y-%m-%d %H:%M:%S'), |
| 484 | 485 |
} |
| 485 |
- |
|
| 486 |
+ |
|
| 486 | 487 |
@property |
| 487 | 488 |
def admindetails(self): |
| 488 | 489 |
return {
|
@@ -585,7 +586,7 @@ class MemberActivityGroupShareInfo(BaseModelMixin): |
||
| 585 | 586 |
class Meta: |
| 586 | 587 |
verbose_name = _(u'会员活动群组分享信息') |
| 587 | 588 |
verbose_name_plural = _(u'会员活动群组分享信息') |
| 588 |
- |
|
| 589 |
+ |
|
| 589 | 590 |
unique_together = ( |
| 590 | 591 |
('activity_id', 'share_user_id', 'click_user_id', 'open_gid', 'brand_id'),
|
| 591 | 592 |
) |
@@ -248,6 +248,7 @@ def membercard_extradata(request): |
||
| 248 | 248 |
|
| 249 | 249 |
return response(200, 'Get extraData Success', u'获取 extraData 成功', extraData) |
| 250 | 250 |
|
| 251 |
+ |
|
| 251 | 252 |
@logit |
| 252 | 253 |
@transaction.atomic |
| 253 | 254 |
def user_integral_add(request): |
@@ -276,5 +277,3 @@ def user_integral_add(request): |
||
| 276 | 277 |
user.save() |
| 277 | 278 |
|
| 278 | 279 |
return response(200, 'Add User Integral Success', u'添加用户投稿积分成功') |
| 279 |
- |
|
| 280 |
- |
@@ -68,6 +68,7 @@ def online_api(request): |
||
| 68 | 68 |
'online': app_settings.get('online', True),
|
| 69 | 69 |
}) |
| 70 | 70 |
|
| 71 |
+ |
|
| 71 | 72 |
@logit |
| 72 | 73 |
def splash_api(request): |
| 73 | 74 |
""" 启动页面 """ |
@@ -11,6 +11,7 @@ from mch.models import BrandInfo, DistributorInfo, SaleclerkInfo |
||
| 11 | 11 |
from utils.error.errno_utils import ProductBrandStatusCode, ProductDistributorStatusCode, SaleclerkStatusCode |
| 12 | 12 |
from utils.redis.connect import r |
| 13 | 13 |
|
| 14 |
+ |
|
| 14 | 15 |
def login_qrcode(request): |
| 15 | 16 |
lensman_type = int(request.GET.get('lt') or 0)
|
| 16 | 17 |
unionid = request.GET.get('unionid', '')
|
@@ -577,7 +577,7 @@ def clerk_checkout_serialNo_api(request): |
||
| 577 | 577 |
except SaleclerkInfo.DoesNotExist: |
| 578 | 578 |
return response(SaleclerkStatusCode.CLERK_NOT_FOUND) |
| 579 | 579 |
|
| 580 |
- log = MchInfoEncryptLogInfo.objects.filter(model_pk=model_pk, sn=serialNo).order_by('-created_at')
|
|
| 580 |
+ log = MchInfoEncryptLogInfo.objects.filter(model_pk=model_pk, sn=serialNo).order_by('-pk')
|
|
| 581 | 581 |
|
| 582 | 582 |
if not log: |
| 583 | 583 |
return response(ProductMachineStatusCode.SN_NOT_FOUND) |
@@ -8,10 +8,10 @@ from staff.models import StaffDeleteClerkSaleSubmitLogInfo, StaffDeleteConsumerS |
||
| 8 | 8 |
class StaffDeleteClerkSaleSubmitLogInfoAdmin(admin.ModelAdmin): |
| 9 | 9 |
list_display = ('admin_id', 'log_pk', 'model_name', 'code', 'status', 'created_at', 'updated_at')
|
| 10 | 10 |
|
| 11 |
+ |
|
| 11 | 12 |
class StaffDeleteConsumerSubmitLogInfoAdmin(admin.ModelAdmin): |
| 12 | 13 |
list_display = ('admin_id', 'log_pk', 'model_name', 'code', 'status', 'created_at', 'updated_at')
|
| 13 | 14 |
|
| 14 | 15 |
|
| 15 | 16 |
admin.site.register(StaffDeleteClerkSaleSubmitLogInfo, StaffDeleteClerkSaleSubmitLogInfoAdmin) |
| 16 | 17 |
admin.site.register(StaffDeleteConsumerSubmitLogInfo, StaffDeleteConsumerSubmitLogInfoAdmin) |
| 17 |
- |
@@ -18,6 +18,7 @@ class StaffDeleteClerkSaleSubmitLogInfo(BaseModelMixin): |
||
| 18 | 18 |
def __unicode__(self): |
| 19 | 19 |
return '%d' % self.pk |
| 20 | 20 |
|
| 21 |
+ |
|
| 21 | 22 |
class StaffDeleteConsumerSubmitLogInfo(BaseModelMixin): |
| 22 | 23 |
admin_id = models.CharField(_(u'admin_id'), max_length=32, blank=True, null=True, help_text=u'管理员ID', db_index=True) |
| 23 | 24 |
log_pk = models.CharField(_(u'log_pk'), max_length=32, blank=True, null=True, help_text=u'消费者提交记录关联pk', db_index=True) |
@@ -99,6 +99,7 @@ class MarketCodeStatusCode(BaseStatusCode): |
||
| 99 | 99 |
""" 一物一码相关错误码 5050xx """ |
| 100 | 100 |
MARKET_CODE_NOT_FOUND = StatusCodeField(505001, 'Market Code Not Found', description=u'一物一码不存在') |
| 101 | 101 |
|
| 102 |
+ |
|
| 102 | 103 |
class AdministratorStatusCode(BaseStatusCode): |
| 103 | 104 |
""" 操作员相关错误码 4002xx """ |
| 104 | 105 |
ADMINISTRATOR_NOT_FOUND = StatusCodeField(400201, 'Administrator Not Found', description=u'管理员不存在') |
@@ -150,10 +151,12 @@ class WechatStatusCode(BaseStatusCode): |
||
| 150 | 151 |
UNIONID_NOT_FOUND = StatusCodeField(400702, 'Unionid Not Found', description=u'微信 UNIONID 不存在') |
| 151 | 152 |
OPENID_NOT_FOUND = StatusCodeField(400703, 'OPENID Not Found', description=u'微信 OPENID 不存在') |
| 152 | 153 |
|
| 154 |
+ |
|
| 153 | 155 |
class ScreenStatusCode(BaseStatusCode): |
| 154 | 156 |
""" 群组/团相关错误码 4030xx """ |
| 155 | 157 |
QRCODE_NOT_SCAN = StatusCodeField(403001, 'QRCode Not Scan', description=u'二维码未扫描') |
| 156 | 158 |
|
| 159 |
+ |
|
| 157 | 160 |
class PermissionStatusCode(BaseStatusCode): |
| 158 | 161 |
""" 4099xx 权限相关错误码 """ |
| 159 | 162 |
PERMISSION_DENIED = StatusCodeField(409900, 'Permission Denied', description=u'权限不足') |