OCT ZNJK-1003 1. 删除无用代码

2. 更新返回JSON格式
This commit is contained in:
huangxin 2022-10-09 11:41:05 +08:00
parent 32c0881ace
commit f49a72661f
1 changed files with 12 additions and 21 deletions

View File

@ -743,10 +743,10 @@ void procHTTP(data19 *req) {
return;
}
// if (strcmp(pMethod, "POST") == 0) {
// sendAllLists(req);
// return;
// }
// if (strcmp(pMethod, "POST") == 0) {
// sendAllLists(req);
// return;
// }
if (pMethod) {
free((void *)pMethod);
@ -756,7 +756,6 @@ void procHTTP(data19 *req) {
free((void *)pBody);
}
if (fp && !strcasecmp(fp, "/allusers"))
sendAllLists(req);
else if (fp && !strcasecmp(fp, "/"))
@ -789,10 +788,6 @@ typedef struct {
} USER_INFO, *PUSER_INFO;
static void sendUserList(data19 *req, const char *pRequest) {
char rsp[] =
"{\"ver\":3,\"cryptoType\":0,\"timeStamp\":1599187216753,\"code\":200,\"msgContent\":{\"items\":[],\"status\":"
"0,\"message\":[\"Success\"]}}";
char logBuff[512];
char rspBuf[2048] = {0};
dhcpMap::iterator p;
@ -902,11 +897,7 @@ static void sendUserList(data19 *req, const char *pRequest) {
pthread_attr_destroy(&attr);
}
static void sendAllLists(data19* req){
char rsp[] =
"{\"ver\":3,\"cryptoType\":0,\"timeStamp\":1599187216753,\"code\":200,\"msgContent\":{\"items\":[],\"status\":"
"0,\"message\":[\"Success\"]}}";
static void sendAllLists(data19 *req) {
char logBuff[512];
data7 *dhcpEntry = nullptr;
dhcpMap::iterator p;
@ -933,18 +924,18 @@ static void sendAllLists(data19* req){
cJSON *pRspMsg = cJSON_CreateObject();
cJSON *pMsgArray = cJSON_CreateArray();
// cJSON_AddItemToObject(pRspMsg, "", pMsgArray);
cJSON_AddItemToObject(pRspMsg, "users", pMsgArray);
for (p = dhcpCache.begin(); kRunning && p != dhcpCache.end() && fp < maxData; p++) {
// cJSON *pRspItem = cJSON_CreateObject();
//cJSON *pRspItem = cJSON_CreateObject();
if ((dhcpEntry = p->second)) {
cJSON_AddStringToObject(pMsgArray, " ", dhcpEntry->mapname);
cJSON_AddStringToObject(pMsgArray, "", dhcpEntry->mapname);
}
// cJSON_AddItemToArray(pMsgArray, pRspItem);
//cJSON_AddItemToArray(pMsgArray, pRspItem);
}
cJSON_AddItemToObject(pRspRoot, "msgContent", pMsgArray);
cJSON_AddItemToObject(pRspRoot, "msgContent", pRspMsg);
fp += sprintf(fp, "%s", cJSON_Print(pRspRoot));
@ -1766,8 +1757,8 @@ MYDWORD chkaddr(data9 *req) {
#include <net/if_arp.h>
#pragma clang diagnostic push
#pragma ide diagnostic ignored "cert-err34-c"
int getHwAddr(char *buff, char *mac) {
#pragma ide diagnostic ignored "cert-err34-c"
int getHwAddr(char *buff, char *mac) {
if (buff == nullptr || mac == nullptr) {
return -1;
}