|
|
@@ -53,11 +53,15 @@ class LandPlanInfoAPIView(APIView):
|
|
|
year_list = [year for year in range(current_year, current_year - 6, -1)]
|
|
|
year_value = LandPlanInfo.objects.all().exclude(recovery_time=0).values_list("recovery_time", flat=True).order_by("-recovery_time")
|
|
|
years = []
|
|
|
+ all_year = []
|
|
|
for year in year_value:
|
|
|
y = datetime.datetime.fromtimestamp(year).year
|
|
|
if y not in years and y in year_list:
|
|
|
years.append(y)
|
|
|
+ if y not in all_year:
|
|
|
+ all_year.append(y)
|
|
|
years.reverse()
|
|
|
+ all_year.reverse()
|
|
|
# 获取最近5年的作物ID
|
|
|
if years:
|
|
|
end = datetime.datetime(int(years[-1]) -5, 12,31,23,59).timestamp()
|
|
|
@@ -94,6 +98,7 @@ class LandPlanInfoAPIView(APIView):
|
|
|
"code": 0,
|
|
|
"msg": "success",
|
|
|
"data": serializers.data,
|
|
|
+ "years": all_year,
|
|
|
"count": total_obj,
|
|
|
"charts": {
|
|
|
"years": years,
|