mirror of
https://github.com/oopuuu/zTC1.git
synced 2025-12-11 04:28:14 +08:00
后台返回时间字符串
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -60,6 +60,8 @@
|
||||
'ip':'%s',\
|
||||
'mask':'%s',\
|
||||
'gateway':'%s',\
|
||||
'date':'%s',\
|
||||
'time':'%s',\
|
||||
'up_time':%ld\
|
||||
}"
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user