add online count

This commit is contained in:
2018-06-07 10:12:09 +08:00
parent cb7a142b88
commit 37bdaec248
2 changed files with 13 additions and 7 deletions
+12 -6
View File
@@ -105,6 +105,7 @@ void NetController::handleResponse(QNetworkReply *reply)
{
if(NEUState!=WrongPass && NEUState!=Owed && offlineCount++ > 1)
{
onlineCount = 0;
offlineCount = 0;
disconnectCount = 0;
lastState = NEUState;
@@ -113,16 +114,21 @@ void NetController::handleResponse(QNetworkReply *reply)
}
else
{
offlineCount = 0;
disconnectCount = 0;
lastState = NEUState;
NEUState = Online;
QStringList infoList = status.split(',');
emit sendInfo(infoList[0], infoList[1], infoList[2], infoList[5]);
if(onlineCount++ > 1)
{
onlineCount = 0;
offlineCount = 0;
disconnectCount = 0;
lastState = NEUState;
NEUState = Online;
QStringList infoList = status.split(',');
emit sendInfo(infoList[0], infoList[1], infoList[2], infoList[5]);
}
}
}
else if(disconnectCount++ > 1)
{
onlineCount = 0;
offlineCount = 0;
disconnectCount = 0;
lastState = NEUState;
+1 -1
View File
@@ -30,7 +30,7 @@ private:
QByteArray checkParam, username, password;
int traffic;
State NEUState = Unknown, lastState = Unknown;
int offlineCount = 0, disconnectCount = 0;
int onlineCount = 0, offlineCount = 0, disconnectCount = 0;
QNetworkAccessManager manager;
QNetworkRequest request;