zhangyang 6 лет назад
Родитель
Сommit
2f0c11ebb2

BIN
bin/Win32/Debug/zhipuzi_pos_windows/db/pos.db


BIN
bin/Win32/Debug/zhipuzi_pos_windows/icon.ico


+ 2 - 2
bin/Win32/Debug/zhipuzi_pos_windows/skin/login.xml

@@ -44,9 +44,9 @@
 			</HorizontalLayout>			
 		</VerticalLayout>
 		
-		<HorizontalLayout height="30">
+		<HorizontalLayout height="50">
 			<Control></Control>
-			<Label name="loginresult" multiline="true" text="" visible="false" textcolor="#FF0000" align="center" />
+			<Label name="loginresult" width="400" height="50" multiline="true" text="" visible="false" textcolor="#FF0000" align="center" />
 			<Control></Control>
 		</HorizontalLayout>
 		

BIN
bin/Win32/Debug/zhipuzi_pos_windows/zhipuzi_pos_windows.exe


+ 21 - 7
zhipuzi_pos_windows/network/CZhipuziHttpClient.cpp

@@ -48,14 +48,28 @@ bool CZhipuziHttpClient::Login(std::string& errmsg)
 		return false;
 	}
 
-	rapidjson::Value& v_errcode = document["errcode"];
-	int errcode = v_errcode.GetInt();
-	if (errcode == -1)
+	if (document.HasMember("errcode"))
 	{
-		LOG_INFO("login failed! message:" << document["errmsg"].GetString());
-		errmsg = std::string(document["errmsg"].GetString());
-		return false;
+		rapidjson::Value& v_errcode = document["errcode"];
+		int errcode = v_errcode.GetInt();
+		if (errcode == -1)
+		{
+			LOG_INFO("login failed! message:" << document["errmsg"].GetString());
+			errmsg = std::string(document["errmsg"].GetString());
+			return false;
+		}
 	}
+	else if (document.HasMember("error_code"))
+	{
+		rapidjson::Value& v_errcode = document["error_code"];
+		int errcode = v_errcode.GetInt();
+		if (errcode < 0)
+		{
+			LOG_INFO("login failed! message:" << document["error_msg"].GetString());
+			errmsg = std::string(document["error_msg"].GetString());
+			return false;
+		}
+	}	
 
 	LOG_INFO("login success!");
 	
@@ -143,7 +157,7 @@ bool CZhipuziHttpClient::RequestNew(std::string url, std::map<string, string> pa
 
 	//先添加默认参数,用于计算签名
 	params["machinecode"] = m_client.m_machinecode;
-	params["username"] = m_client.m_username;
+	params["username"] = CLewaimaiString::UrlEncode(m_client.m_username);
 	params["password"] = md5(m_client.m_password);
 	params["lwm_appid"] = "84b19199fd221a78c491cd553cbb4ab7";
 	params["nonce"] = nonce;