update
This commit is contained in:
parent
fe712cc09c
commit
ec56048bc9
11
xumu.py
11
xumu.py
|
@ -344,7 +344,16 @@ async def past_seven_days(deviceId):
|
||||||
"sql": sql
|
"sql": sql
|
||||||
}
|
}
|
||||||
r = requests.post(baseHost + queryUri, headers=headers, json=send_json)
|
r = requests.post(baseHost + queryUri, headers=headers, json=send_json)
|
||||||
return BaseResponse(data=r.json())
|
data = r.json()
|
||||||
|
timestamps = data["timestamps"]
|
||||||
|
times = []
|
||||||
|
for timestamp in timestamps:
|
||||||
|
dt = datetime.fromtimestamp(timestamp / 1000) # 因为时间戳是以毫秒为单位的,所以需要除以1000
|
||||||
|
# 将datetime对象格式化为只包含年月日的字符串
|
||||||
|
year_month_day_str = dt.strftime('%Y-%m-%d')
|
||||||
|
times.append(year_month_day_str)
|
||||||
|
data["timestamps"] = times
|
||||||
|
return BaseResponse(data=data)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
return BaseResponse(code=500, msg=str(e))
|
return BaseResponse(code=500, msg=str(e))
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue