server side error 解析
又發生一個需要改的事項, D先生是這樣改的...
before
query_results = query.select("from_url", "to_url", "count(time)", "count(distinct ip)", "date(time)").group("to_url").order("-count(time)").fetch(100, (page - 1) * 100)
query_count = query.select("count(distinct to_url)").get()[0]
conn.close()
data = [{
"from_url": k[0],
"to_url": k[1],
"count": k[2],
"uu_count": k[3],
} for k in query_results]
return self.JsonResponse(True, {
"data": data,
"start_date": mydb.to_datestring(start_date),
"end_date": mydb.to_datestring(end_date),
"count": query_count,
"index": page,
"prev": page > 1,
"next": (page * 100) < query_count,
})
after
query_results = query.select("from_url", "to_url", "count(time)", "count(distinct ip)", "max(weburl)").group("to_url").order("-count(time)").fetch(100, (page - 1) * 100)
query_count = query.select("count(distinct to_url), count(distinct to_url, ip)").get()[0]
conn.close()
data = [{
"from_url": k[0],
"to_url": k[1],
"count": k[2],
"uu_count": k[3],
"weburl": k[4],
} for k in query_results]
return self.JsonResponse(True, {
"data": data,
"start_date": mydb.to_datestring(start_date),
"end_date": mydb.to_datestring(end_date),
"total": {
"click":query_count[0],
"uu_click":query_count[1],
},
"index": page,
"prev": page > 1,
"next": (page * 100) < query_count,
})
before
query_results = query.select("from_url", "to_url", "count(time)", "count(distinct ip)", "date(time)").group("to_url").order("-count(time)").fetch(100, (page - 1) * 100)
query_count = query.select("count(distinct to_url)").get()[0]
conn.close()
data = [{
"from_url": k[0],
"to_url": k[1],
"count": k[2],
"uu_count": k[3],
} for k in query_results]
return self.JsonResponse(True, {
"data": data,
"start_date": mydb.to_datestring(start_date),
"end_date": mydb.to_datestring(end_date),
"count": query_count,
"index": page,
"prev": page > 1,
"next": (page * 100) < query_count,
})
after
query_results = query.select("from_url", "to_url", "count(time)", "count(distinct ip)", "max(weburl)").group("to_url").order("-count(time)").fetch(100, (page - 1) * 100)
query_count = query.select("count(distinct to_url), count(distinct to_url, ip)").get()[0]
conn.close()
data = [{
"from_url": k[0],
"to_url": k[1],
"count": k[2],
"uu_count": k[3],
"weburl": k[4],
} for k in query_results]
return self.JsonResponse(True, {
"data": data,
"start_date": mydb.to_datestring(start_date),
"end_date": mydb.to_datestring(end_date),
"total": {
"click":query_count[0],
"uu_click":query_count[1],
},
"index": page,
"prev": page > 1,
"next": (page * 100) < query_count,
})
留言
張貼留言