mirror of
https://github.com/oopuuu/zTC1.git
synced 2025-12-13 13:38:14 +08:00
完美
This commit is contained in:
@@ -9,7 +9,9 @@
|
|||||||
input,select,button{padding:5px;background:white;border:#777 solid 1px;}
|
input,select,button{padding:5px;background:white;border:#777 solid 1px;}
|
||||||
button{background:none;border:1px #777 solid;}
|
button{background:none;border:1px #777 solid;}
|
||||||
button:disabled,select:disabled,input:disabled{background:#bfbfbf;}
|
button:disabled,select:disabled,input:disabled{background:#bfbfbf;}
|
||||||
td{padding:5px;}
|
td,th{padding:5px;}
|
||||||
|
.task table{width:100%;margin:10px 0;border-collapse:collapse;}
|
||||||
|
.task td,.task th{text-align:center;border:1px solid #000;}
|
||||||
.socket input,.mode input{margin-right:-4px;}
|
.socket input,.mode input{margin-right:-4px;}
|
||||||
.submit{padding:5px;margin-top:5px;}
|
.submit{padding:5px;margin-top:5px;}
|
||||||
.success{color:#58dc5c;}
|
.success{color:#58dc5c;}
|
||||||
@@ -81,7 +83,18 @@
|
|||||||
<legend>Timed Task</legend>
|
<legend>Timed Task</legend>
|
||||||
<input type="number" id="task_time"/>
|
<input type="number" id="task_time"/>
|
||||||
<button onclick="AddTimedTask()">Add</button>
|
<button onclick="AddTimedTask()">Add</button>
|
||||||
<button onclick="GetTimedTask()">Get</button>
|
<table id="timed_task_tb">
|
||||||
|
<tr>
|
||||||
|
<th>Index</th>
|
||||||
|
<th>Time</th>
|
||||||
|
<th>Socket</th>
|
||||||
|
<th>On</th>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td colspan="4">Plese Sync</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
<button onclick="GetTimedTask()">Sync</button>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
|
|
||||||
<fieldset class="chart">
|
<fieldset class="chart">
|
||||||
@@ -446,7 +459,27 @@ function GetSysLog() {
|
|||||||
|
|
||||||
function GetTimedTask() {
|
function GetTimedTask() {
|
||||||
HttpGet("/task", function (re) {
|
HttpGet("/task", function (re) {
|
||||||
alert(re);
|
var tb_html = "\
|
||||||
|
<tr>\
|
||||||
|
<th>Index</th>\
|
||||||
|
<th>Time</th>\
|
||||||
|
<th>Socket</th>\
|
||||||
|
<th>On</th>\
|
||||||
|
</tr>";
|
||||||
|
var tasks = JSON.parse(re);
|
||||||
|
if (tasks.length == 0) {
|
||||||
|
tb_html += "<tr><td colspan='4'>No Timed Task</td></tr>";
|
||||||
|
}
|
||||||
|
for (var i = 0; i < tasks.length; i++) {
|
||||||
|
tb_html += "\
|
||||||
|
<tr>\
|
||||||
|
<td>" + (i+1) + "</td>\
|
||||||
|
<td>" + tasks[i].prs_time + "</td>\
|
||||||
|
<td>" + tasks[i].socket_idx + "</td>\
|
||||||
|
<td>" + tasks[i].on + "</td>\
|
||||||
|
</tr>";
|
||||||
|
}
|
||||||
|
document.getElementById("timed_task_tb").innerHTML = tb_html;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -458,7 +491,7 @@ function AddTimedTask() {
|
|||||||
var cmd = prs_time + " 4 0"
|
var cmd = prs_time + " 4 0"
|
||||||
|
|
||||||
HttpPost("/task", function (re) {
|
HttpPost("/task", function (re) {
|
||||||
alert(re);
|
//alert(re);
|
||||||
}, cmd);
|
}, cmd);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
@@ -93,7 +93,13 @@ bool DelTask(int time)
|
|||||||
|
|
||||||
char* GetTaskStr()
|
char* GetTaskStr()
|
||||||
{
|
{
|
||||||
char* str = (char*)malloc(sizeof(char)*task_count * 52);
|
if (task_top == NULL)
|
||||||
|
{
|
||||||
|
char* str = (char*)malloc(sizeof(char)*3);
|
||||||
|
sprintf(str, "%s", "[]");
|
||||||
|
return str;
|
||||||
|
}
|
||||||
|
char* str = (char*)malloc(sizeof(char)*task_count * 60);
|
||||||
pTimedTask tmp_tsk = task_top;
|
pTimedTask tmp_tsk = task_top;
|
||||||
char* tmp_str = str;
|
char* tmp_str = str;
|
||||||
tmp_str[0] = '[';
|
tmp_str[0] = '[';
|
||||||
@@ -105,7 +111,7 @@ char* GetTaskStr()
|
|||||||
tm_info = localtime(&tmp_tsk->prs_time);
|
tm_info = localtime(&tmp_tsk->prs_time);
|
||||||
strftime(buffer, 26, "%Y-%m-%d %H:%M:%S", tm_info);
|
strftime(buffer, 26, "%Y-%m-%d %H:%M:%S", tm_info);
|
||||||
|
|
||||||
sprintf(tmp_str, "{time:'%s',socket_index:%d,on:%d},",
|
sprintf(tmp_str, "{'prs_time':'%s','socket_idx':%d,'on':%d},",
|
||||||
buffer, tmp_tsk->socket_idx, tmp_tsk->on);
|
buffer, tmp_tsk->socket_idx, tmp_tsk->on);
|
||||||
tmp_str += strlen(tmp_str);
|
tmp_str += strlen(tmp_str);
|
||||||
tmp_tsk = tmp_tsk->next;
|
tmp_tsk = tmp_tsk->next;
|
||||||
|
|||||||
Reference in New Issue
Block a user