Skip to content

Commit fe2e068

Browse files
committed
fixed:weather query is incorrect
1 parent ae1a45a commit fe2e068

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

XEngine_Source/XEngine_ModuleProtocol/ModuleProtocol_Parse/ModuleProtocol_Parse.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1044,10 +1044,16 @@ bool CModuleProtocol_Parse::ModuleProtocol_Parse_Weather(LPCXSTR lpszMsgBuffer,
10441044
if (!pSt_JsonReader->parse(lpszMsgBuffer, lpszMsgBuffer + nMsgLen, &st_JsonRoot, &st_JsonError))
10451045
{
10461046
ModuleProtocol_IsErrorOccur = true;
1047-
ModuleProtocol_dwErrorCode = ERROR_XENGINE_APISERVICE_MODULE_PROTOCOL_PARSE_PARAMENT;
1047+
ModuleProtocol_dwErrorCode = ERROR_XENGINE_APISERVICE_MODULE_PROTOCOL_PARSE_JSON;
10481048
return false;
10491049
}
10501050
Json::Value st_JsonObject = st_JsonRoot["lives"][0];
1051+
if (0 == st_JsonObject.size())
1052+
{
1053+
ModuleProtocol_IsErrorOccur = true;
1054+
ModuleProtocol_dwErrorCode = ERROR_XENGINE_APISERVICE_MODULE_PROTOCOL_PARSE_VALIDATE;
1055+
return false;
1056+
}
10511057

10521058
if (!st_JsonObject["province"].isNull())
10531059
{

XEngine_Source/XEngine_ServiceApp/XEngine_HttpApp/XEngine_TaskGet/TaskGet_Weather.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ bool HTTPTask_TaskGet_WeatherInfo(LPCXSTR lpszClientAddr, LPCXSTR lpszAddrCode)
3232
//解析JSON信息
3333
if (!ModuleProtocol_Parse_Weather(tszGBKStr, nBLen, &st_WeatherInfo))
3434
{
35-
ModuleProtocol_Packet_Common(tszPktBuffer, &nPktLen, 404, _X("address id is incorrect"));
35+
ModuleProtocol_Packet_Common(tszPktBuffer, &nPktLen, 404, _X("get weather failed.maybe id is incorrect"));
3636
HttpProtocol_Server_SendMsgEx(xhHTTPPacket, tszMsgBuffer, &nMsgLen, &st_HDRParam, tszPktBuffer, nPktLen);
3737
XEngine_Network_Send(lpszClientAddr, tszMsgBuffer, nMsgLen);
3838
XLOG_PRINT(xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_INFO, _X("HTTP客户端:%s,请求的实时天气信息错误,可能ID:%s,不正确"), lpszClientAddr, lpszAddrCode);

0 commit comments

Comments
 (0)