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

@ -756,7 +756,6 @@ void procHTTP(data19 *req) {
free((void *)pBody); free((void *)pBody);
} }
if (fp && !strcasecmp(fp, "/allusers")) if (fp && !strcasecmp(fp, "/allusers"))
sendAllLists(req); sendAllLists(req);
else if (fp && !strcasecmp(fp, "/")) else if (fp && !strcasecmp(fp, "/"))
@ -789,10 +788,6 @@ typedef struct {
} USER_INFO, *PUSER_INFO; } USER_INFO, *PUSER_INFO;
static void sendUserList(data19 *req, const char *pRequest) { 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 logBuff[512];
char rspBuf[2048] = {0}; char rspBuf[2048] = {0};
dhcpMap::iterator p; dhcpMap::iterator p;
@ -903,10 +898,6 @@ static void sendUserList(data19 *req, const char *pRequest) {
} }
static void sendAllLists(data19 *req) { static void sendAllLists(data19 *req) {
char rsp[] =
"{\"ver\":3,\"cryptoType\":0,\"timeStamp\":1599187216753,\"code\":200,\"msgContent\":{\"items\":[],\"status\":"
"0,\"message\":[\"Success\"]}}";
char logBuff[512]; char logBuff[512];
data7 *dhcpEntry = nullptr; data7 *dhcpEntry = nullptr;
dhcpMap::iterator p; dhcpMap::iterator p;
@ -933,7 +924,7 @@ static void sendAllLists(data19* req){
cJSON *pRspMsg = cJSON_CreateObject(); cJSON *pRspMsg = cJSON_CreateObject();
cJSON *pMsgArray = cJSON_CreateArray(); cJSON *pMsgArray = cJSON_CreateArray();
// cJSON_AddItemToObject(pRspMsg, "", pMsgArray); cJSON_AddItemToObject(pRspMsg, "users", pMsgArray);
for (p = dhcpCache.begin(); kRunning && p != dhcpCache.end() && fp < maxData; p++) { for (p = dhcpCache.begin(); kRunning && p != dhcpCache.end() && fp < maxData; p++) {
//cJSON *pRspItem = cJSON_CreateObject(); //cJSON *pRspItem = cJSON_CreateObject();
@ -944,7 +935,7 @@ static void sendAllLists(data19* req){
//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)); fp += sprintf(fp, "%s", cJSON_Print(pRspRoot));