/xxxx 删除定时任务

This commit is contained in:
zogodo
2020-02-22 19:08:22 +08:00
parent cffc1d5016
commit cae8dcb3a1
3 changed files with 614 additions and 580 deletions

View File

@@ -91,6 +91,15 @@ void GetPraFromUrl(char* url, char* pra, char* val)
static int HttpGetIndexPage(httpd_request_t *req)
{
char* buf = "1678369623 4 0";
pTimedTask task = (pTimedTask)malloc(sizeof(struct TimedTask));
sscanf(buf, "%ld %d %d", &task->prs_time, &task->socket_idx, &task->on);
AddTask(task);
OSStatus err = kNoErr;
err = httpd_send_all_header(req, HTTP_RES_200, sizeof(web_index_html), HTTP_CONTENT_HTML_ZIP);
@@ -357,7 +366,7 @@ static int HttpDelTask(httpd_request_t *req)
{
OSStatus err = kNoErr;
char* time_str = strstr(req->filename, "/task/");
char* time_str = strstr(req->filename, "/xxxx/");
if (!time_str)
{
http_log("HttpDelTask url[%s] err", req->filename);
@@ -365,13 +374,12 @@ static int HttpDelTask(httpd_request_t *req)
}
http_log("HttpDelTask url[%s] time_str[%s][%s]", req->filename, time_str, time_str + 6);
//int time1;
//sscanf(time_str + 6, "%d", &time1);
int time1;
sscanf(time_str + 6, "%d", &time1);
//char* mess = DelTask(time1) ? "OK" : "NO";
char* mess = DelTask(time1) ? "OK" : "NO";
//OSStatus err = kNoErr;
//send_http(mess, strlen(mess), exit, &err);
send_http(mess, strlen(mess), exit, &err);
exit:
return err;
}
@@ -413,6 +421,7 @@ const struct httpd_wsgi_call g_app_handlers[] = {
{ "/mqtt/config", HTTPD_HDR_DEFORT, 0, NULL, HttpSetMqttConfig, NULL, NULL },
{ "/log", HTTPD_HDR_DEFORT, 0, HttpGetLog, NULL, NULL, NULL },
{ "/task", HTTPD_HDR_DEFORT, APP_HTTP_FLAGS_NO_EXACT_MATCH, HttpGetTasks, HttpAddTask, NULL, HttpDelTask },
{ "/xxxx", HTTPD_HDR_DEFORT, APP_HTTP_FLAGS_NO_EXACT_MATCH, HttpDelTask, NULL, NULL, NULL },
{ "/ota", HTTPD_HDR_DEFORT, 0, Otastatus, OtaStart, NULL, NULL },
};