efault=0, help_text=u'数量') 77 77
 
78 78
     class Meta:
@@ -95,7 +95,7 @@ class DistributorSaleStatisticInfo(BaseModelMixin):
95 95
 class ProvinceSaleStatisticInfo(BaseModelMixin):
96 96
     province_code = models.CharField(_(u'province_code'), max_length=32, help_text=u'省份编码', db_index=True)
97 97
     province_name = models.CharField(_(u'province_name'), max_length=32, blank=True, null=True, help_text=u'省份名称')
98
-    ymd = models.CharField(_(u'ymd'), max_length=8, blank=True, null=True, help_text=u'年月日', db_index=True)  # 例:20171208, tc.local_string(format='%Y%m%d'), 0 为全部
98
+    ymd = models.IntegerField(_(u'ymd'), default=0, help_text=u'年月日', db_index=True)  # 例:20171208, tc.local_string(format='%Y%m%d'), 0 为全部
99 99
     num = models.IntegerField(_(u'num'), default=0, help_text=u'数量')
100 100
 
101 101
     position = models.IntegerField(_(u'position'), default=1, help_text=u'排序')

+ 6 - 6
statistic/views.py

@@ -12,7 +12,7 @@ from utils.rdm_utils import randnum
12 12
 
13 13
 @logit
14 14
 def tj_data(request):
15
-    ymd = tc.local_string(format='%Y%m%d')
15
+    ymd = int(tc.local_string(format='%Y%m%d'))
16 16
 
17 17
     # 注册用户统计 & 今日注册用户
18 18
     try:
@@ -21,7 +21,7 @@ def tj_data(request):
21 21
         register_num = 0
22 22
 
23 23
     # 注册用户数趋势
24
-    register_trends = RegisterStatisticInfo.objects.filter(status=True).order_by('-pk')[:30]
24
+    register_trends = RegisterStatisticInfo.objects.filter(status=True).order_by('-ymd')[:30]
25 25
     register_trends = [r.data for r in register_trends]
26 26
 
27 27
     # 销量统计 & 今日销量
@@ -31,19 +31,19 @@ def tj_data(request):
31 31
         sale_num = 0
32 32
 
33 33
     # 商品销量趋势
34
-    sale_trends = SaleStatisticInfo.objects.filter(status=True).order_by('-pk')[:30]
34
+    sale_trends = SaleStatisticInfo.objects.filter(status=True).order_by('-ymd')[:30]
35 35
     sale_trends = [s.data for s in sale_trends]
36 36
 
37 37
     # 型号销量统计 & 热销商品榜
38
-    model_sales = ModelSaleStatisticInfo.objects.filter(ymd='0', status=True).order_by('-num')[:3]
38
+    model_sales = ModelSaleStatisticInfo.objects.filter(ymd=0, status=True).order_by('-num')[:3]
39 39
     model_sales = [m.data for m in model_sales]
40 40
 
41 41
     # 经销商销量统计 & 经销商榜
42
-    distributor_sales = DistributorSaleStatisticInfo.objects.filter(ymd='0', status=True).order_by('-num')[:3]
42
+    distributor_sales = DistributorSaleStatisticInfo.objects.filter(ymd=0, status=True).order_by('-num')[:3]
43 43
     distributor_sales = [d.data for d in distributor_sales]
44 44
 
45 45
     # 各地区实时销量
46
-    province_sales = ProvinceSaleStatisticInfo.objects.filter(ymd='0', status=True).order_by('position')
46
+    province_sales = ProvinceSaleStatisticInfo.objects.filter(ymd=0, status=True).order_by('position')
47 47
     province_sales = [p.data for p in province_sales]
48 48
 
49 49
     return response(200, 'Get TJ Data Success', u'获取统计数据成功', {

kodo - Gogs: Go Git Service

Geen omschrijving

Brightcells: 212e3994d1 MP verify file 9 jaren geleden
..
JQ8Eskhrjp.txt 25cce5e3b1 Add qrcodejump verify file 9 jaren geleden
MP_verify_vEq7hPudfncXpZ57.txt 212e3994d1 MP verify file 9 jaren geleden