12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788 |
- #include "stdafx.h"
- #include "AnalysisJXTRespond.h"
- AnalysisJXTRespond::AnalysisJXTRespond(void)
- {
- nStatus = -1;
- nSendCount = 0;
- fCurConsume = 0.0;
- fBalance = 0.0;
- memset(szSMSID,0,1024);
- }
- AnalysisJXTRespond::~AnalysisJXTRespond(void)
- {
- }
- int AnalysisJXTRespond::AnalysisRespondString(IN CString strRespond)
- {
-
- unsigned int nFindRet = 0;
- strRespond.MakeLower();
- strRespond.TrimRight("\r\n");
- int nIndex = 0;
- CString strTemp;
-
- nIndex = strRespond.Find("/send:");
- if ( nIndex != -1 )
- {
- nFindRet &= 1;
- }
- strTemp = strRespond.Left(nIndex);
- nStatus = atoi(strTemp);
-
- strTemp = "/send:";
- strRespond = strRespond.Mid(strRespond.Find("/send:")+ strTemp.GetLength());
- nIndex = strRespond.Find("/consumption:");
- if ( nIndex != -1 )
- {
- nFindRet &= 2;
- }
- strTemp = strRespond.Left(nIndex);
- nSendCount = atoi(strTemp);
- strTemp = "/consumption:";
- strRespond = strRespond.Mid(nIndex+strTemp.GetLength());
-
- strTemp = "/tmoney:";
- nIndex = strRespond.Find(strTemp);
- if ( nIndex != -1)
- {
- nFindRet &= 4;
- }
- strTemp = strRespond.Left(nIndex);
- if (strTemp.Find(".") != -1)
- strTemp += "000000000";
- fCurConsume = atof(strTemp);
- strTemp = "/tmoney:";
- nIndex = strRespond.Find("/tmoney:");
- strRespond = strRespond.Mid(nIndex + strTemp.GetLength());
-
- strTemp = "/sid:";
- nIndex = strRespond.Find(strTemp);
- if ( nIndex != -1)
- {
- nFindRet &= 8;
- }
- strTemp = strRespond.Left(nIndex);
- if (strTemp.Find(".") != -1)
- strTemp += "000000000";
- fBalance = atof(strTemp);
-
- strTemp = "/sid:";
- nIndex = strRespond.Find("/sid:");
- strRespond = strRespond.Mid(nIndex + strTemp.GetLength());
- strcpy(szSMSID,strRespond);
- return nFindRet;
- }
|