|
@@ -1091,12 +1091,56 @@ class serveManagement(View):
|
|
|
return response.json(500, repr(e))
|
|
|
|
|
|
def getCloudDataList(self, request_dict, response):
|
|
|
- print('request_dict: ', request_dict)
|
|
|
-
|
|
|
- # UID_Bucket表查询数据
|
|
|
- uid = request_dict.get('uid', None)
|
|
|
-
|
|
|
- list_data = [{'name': 'test1', 'type': 'line', 'data': [1200, 3020, 1330, 512, 4463, 2214, 3330, 2412, 1500, 820, 3330, 912]},
|
|
|
- {'name': 'test2', 'type': 'line', 'data': [1500, 3020, 1330, 512, 4000, 2214, 3330, 1500, 1205, 820, 3330, 800]},
|
|
|
- {'name': '回款', 'type': 'line', 'data': [1300, 3020, 1330, 512, 5000, 2214, 3330, 1800, 1205, 820, 3330, 800]},]
|
|
|
- return response.json(0, {'list': list_data})
|
|
|
+ year = request_dict.get('year', None)
|
|
|
+ Jan = int(time.mktime(time.strptime(year + '-1-1 00:00:00', "%Y-%m-%d %H:%M:%S")))
|
|
|
+ Feb = int(time.mktime(time.strptime(year + '-2-1 00:00:00', "%Y-%m-%d %H:%M:%S")))
|
|
|
+ Mar = int(time.mktime(time.strptime(year + '-3-1 00:00:00', "%Y-%m-%d %H:%M:%S")))
|
|
|
+ Apr = int(time.mktime(time.strptime(year + '-4-1 00:00:00', "%Y-%m-%d %H:%M:%S")))
|
|
|
+ May = int(time.mktime(time.strptime(year + '-5-1 00:00:00', "%Y-%m-%d %H:%M:%S")))
|
|
|
+ Jun = int(time.mktime(time.strptime(year + '-6-1 00:00:00', "%Y-%m-%d %H:%M:%S")))
|
|
|
+ Jul = int(time.mktime(time.strptime(year + '-7-1 00:00:00', "%Y-%m-%d %H:%M:%S")))
|
|
|
+ Aug = int(time.mktime(time.strptime(year + '-8-1 00:00:00', "%Y-%m-%d %H:%M:%S")))
|
|
|
+ Sep = int(time.mktime(time.strptime(year + '-9-1 00:00:00', "%Y-%m-%d %H:%M:%S")))
|
|
|
+ Oct = int(time.mktime(time.strptime(year + '-10-1 00:00:00', "%Y-%m-%d %H:%M:%S")))
|
|
|
+ Nov = int(time.mktime(time.strptime(year + '-11-1 00:00:00', "%Y-%m-%d %H:%M:%S")))
|
|
|
+ Dec = int(time.mktime(time.strptime(year + '-12-1 00:00:00', "%Y-%m-%d %H:%M:%S")))
|
|
|
+ Jan_next = int(time.mktime(time.strptime(str(int(year)+1) + '-1-1 00:00:00', "%Y-%m-%d %H:%M:%S")))
|
|
|
+
|
|
|
+ list_data = []
|
|
|
+ vod_bucket_qs = VodBucketModel.objects.filter()
|
|
|
+ if not vod_bucket_qs.exists():
|
|
|
+ return response.json(173)
|
|
|
+ try:
|
|
|
+ for vod_bucket in vod_bucket_qs:
|
|
|
+ vod_bucket_id = vod_bucket.id
|
|
|
+ store_meal = Store_Meal.objects.filter(bucket_id=vod_bucket_id, lang__lang='cn').values('lang__title', 'lang__content')
|
|
|
+ if not store_meal.exists():
|
|
|
+ continue
|
|
|
+ name = store_meal[0]['lang__title']+'-'+store_meal[0]['lang__content']
|
|
|
+ order = Order_Model.objects.filter(rank__bucket_id=vod_bucket_id)
|
|
|
+ Jan_count = order.filter(addTime__range=[Jan, Feb]).count()
|
|
|
+ Feb_count = order.filter(addTime__range=[Feb, Mar]).count()
|
|
|
+ Mar_count = order.filter(addTime__range=[Mar, Apr]).count()
|
|
|
+ Apr_count = order.filter(addTime__range=[Apr, May]).count()
|
|
|
+ May_count = order.filter(addTime__range=[May, Jun]).count()
|
|
|
+ Jun_count = order.filter(addTime__range=[Jun, Jul]).count()
|
|
|
+ Jul_count = order.filter(addTime__range=[Jul, Aug]).count()
|
|
|
+ Aug_count = order.filter(addTime__range=[Aug, Sep]).count()
|
|
|
+ Sep_count = order.filter(addTime__range=[Sep, Oct]).count()
|
|
|
+ Oct_count = order.filter(addTime__range=[Oct, Nov]).count()
|
|
|
+ Nov_count = order.filter(addTime__range=[Nov, Dec]).count()
|
|
|
+ Dec_count = order.filter(addTime__range=[Dec, Jan_next]).count()
|
|
|
+ data = [Jan_count, Feb_count, Mar_count, Apr_count, May_count, Jun_count, Jul_count, Aug_count, Sep_count,
|
|
|
+ Oct_count, Nov_count, Dec_count]
|
|
|
+
|
|
|
+ cloud_data = {
|
|
|
+ 'name': name,
|
|
|
+ 'type': 'line',
|
|
|
+ 'data': data,
|
|
|
+ }
|
|
|
+ list_data.append(cloud_data)
|
|
|
+
|
|
|
+ return response.json(0, {'list': list_data})
|
|
|
+ except Exception as e:
|
|
|
+ print(e)
|
|
|
+ return response.json(500, repr(e))
|