diff --git a/TC1/http_server/app_httpd.c b/TC1/http_server/app_httpd.c index e423e31..ae1a00d 100644 --- a/TC1/http_server/app_httpd.c +++ b/TC1/http_server/app_httpd.c @@ -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); diff --git a/TC1/http_server/app_httpd.h b/TC1/http_server/app_httpd.h index 92b0171..de10159 100644 --- a/TC1/http_server/app_httpd.h +++ b/TC1/http_server/app_httpd.h @@ -60,6 +60,8 @@ 'ip':'%s',\ 'mask':'%s',\ 'gateway':'%s',\ + 'date':'%s',\ + 'time':'%s',\ 'up_time':%ld\ }" diff --git a/TC1/http_server/web/index.html b/TC1/http_server/web/index.html index 6a023d3..740cc3b 100644 --- a/TC1/http_server/web/index.html +++ b/TC1/http_server/web/index.html @@ -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 diff --git a/TODO.txt b/TODO.txt index c6d77ee..6228e63 100644 --- a/TODO.txt +++ b/TODO.txt @@ -4,9 +4,9 @@ *. 重复定时任务 *. json单引号 -*. 功率显示 -*. 每天定时任务 *. 定时任务默认当前时间 + +*. 每天定时任务 *. 定时任务插座不对? *. 最近一个月每天功耗 *. 最近一周每小时功率