后台返回时间字符串

This commit is contained in:
zogodo
2020-04-22 11:33:15 +08:00
parent 81dcea8dbc
commit 139f5e8263
4 changed files with 19 additions and 4 deletions

View File

@@ -157,10 +157,15 @@ exit:
static int HttpGetTc1Status(httpd_request_t *req)
{
char* sockets = GetSocketStatus();
char* tc1_status = malloc(412);
char* tc1_status = malloc(458);
char now_date[11] = { 0 };
char now_time[10] = { 0 };
strftime(now_date, 11, "%Y-%m-%d", localtime(&now));
strftime(now_time, 10, "%H:%M:%S", localtime(&now));
sprintf(tc1_status, TC1_STATUS_JSON, sockets, ip_status.mode,
sys_config->micoSystemConfig.ssid, sys_config->micoSystemConfig.user_key,
user_config->ap_name, user_config->ap_key, MQTT_SERVER, MQTT_SERVER_PORT, VERSION, ip_status.ip, ip_status.mask, ip_status.gateway, 0L);
user_config->ap_name, user_config->ap_key, MQTT_SERVER, MQTT_SERVER_PORT, VERSION,
ip_status.ip, ip_status.mask, ip_status.gateway, now_date, now_time, 0L);
OSStatus err = kNoErr;
send_http(tc1_status, strlen(tc1_status), exit, &err);

View File

@@ -60,6 +60,8 @@
'ip':'%s',\
'mask':'%s',\
'gateway':'%s',\
'date':'%s',\
'time':'%s',\
'up_time':%ld\
}"

View File

@@ -593,6 +593,14 @@ HttpGet("/status", function (re) {
$("#info_mask").html(status.mask);
$("#info_gateway").html(status.gateway);
$("#uptime").html(status.up_time);
//var now = new Date()
//task_date.value = now.toLocaleDateString().replace(/\//g, '-');
//task_date.value = now.getFullYear() + '-' + now.getMonth() + '-' + now.getDate();
$("#task_date").value(status.date);
$("#task_time").value(status.time);
task_date.value = status.date;
});
//Menu-start

View File

@@ -4,9 +4,9 @@
*. 重复定时任务
*. json单引号
*. 功率显示
*. 每天定时任务
*. 定时任务默认当前时间
*. 每天定时任务
*. 定时任务插座不对?
*. 最近一个月每天功耗
*. 最近一周每小时功率