浏览代码

接口改造完成

zhangyang 6 年之前
父节点
当前提交
54ac8b1bed

二进制
bin/Win32/Debug/zhipuzi_pos_windows/db/pos.db


二进制
bin/Win32/Debug/zhipuzi_pos_windows/zhipuzi_pos_windows.exe


+ 1 - 1
zhipuzi_pos_windows/control/OrderListUI.cpp

@@ -68,7 +68,7 @@ void OrderListUI::HandleRefresh(OrderListStatus* status)
 	params["page"] = to_string(status->m_page);
 	std::string response;
 
-	CZhipuziHttpClient::RequestOld(url.c_str(), params, response);
+	CZhipuziHttpClient::Request(url.c_str(), params, response);
 
 	//走到这里,网络请求结束了,对比状态是否发生了改变
 	if (status->m_page != m_page || status->m_status != m_status)

+ 175 - 151
zhipuzi_pos_windows/network/CHttpClient.cpp

@@ -4,7 +4,7 @@
 #include <curl/curl.h>
 
 CHttpClient::CHttpClient(void) :
-    m_bDebug(false)
+	m_bDebug(false)
 {
 
 }
@@ -14,180 +14,204 @@ CHttpClient::~CHttpClient(void)
 
 }
 
-static int OnDebug(CURL*, curl_infotype itype, char* pData, size_t size, void*)
+static int OnDebug(CURL *, curl_infotype itype, char * pData, size_t size, void *)
 {
-    if(itype == CURLINFO_TEXT)
-    {
-        //printf("[TEXT]%s\n", pData);
-    }
-    else if(itype == CURLINFO_HEADER_IN)
-    {
-        printf("[HEADER_IN]%s\n", pData);
-    }
-    else if(itype == CURLINFO_HEADER_OUT)
-    {
-        printf("[HEADER_OUT]%s\n", pData);
-    }
-    else if(itype == CURLINFO_DATA_IN)
-    {
-        printf("[DATA_IN]%s\n", pData);
-    }
-    else if(itype == CURLINFO_DATA_OUT)
-    {
-        printf("[DATA_OUT]%s\n", pData);
-    }
-    return 0;
+	if (itype == CURLINFO_TEXT)
+	{
+		//printf("[TEXT]%s\n", pData);
+	}
+	else if (itype == CURLINFO_HEADER_IN)
+	{
+		printf("[HEADER_IN]%s\n", pData);
+	}
+
+	else if (itype == CURLINFO_HEADER_OUT)
+	{
+		printf("[HEADER_OUT]%s\n", pData);
+	}
+
+	else if (itype == CURLINFO_DATA_IN)
+	{
+		printf("[DATA_IN]%s\n", pData);
+	}
+
+	else if (itype == CURLINFO_DATA_OUT)
+	{
+		printf("[DATA_OUT]%s\n", pData);
+	}
+
+	return 0;
 }
 
 static size_t OnWriteData(void* buffer, size_t size, size_t nmemb, void* lpVoid)
 {
-    std::string* str = dynamic_cast<std::string*>((std::string*)lpVoid);
-    if(NULL == str || NULL == buffer)
-    {
-        return -1;
-    }
-
-    char* pData = (char*)buffer;
-    str->append(pData, size * nmemb);
-    return nmemb;
+	std::string* str = dynamic_cast<std::string*>((std::string *)lpVoid);
+
+	if (NULL == str || NULL == buffer)
+	{
+		return -1;
+	}
+
+	char* pData = (char*)buffer;
+	str->append(pData, size * nmemb);
+	return nmemb;
 }
 
-int CHttpClient::Post(const std::string& strUrl, const std::string& strPost, std::string& strResponse)
+int CHttpClient::Post(const std::string & strUrl, const std::string & strPost, std::string & strResponse)
 {
-    CURLcode res;
-    CURL* curl = curl_easy_init();
-    if(NULL == curl)
-    {
-        return CURLE_FAILED_INIT;
-    }
-    if(m_bDebug)
-    {
-        curl_easy_setopt(curl, CURLOPT_VERBOSE, 1);
-        curl_easy_setopt(curl, CURLOPT_DEBUGFUNCTION, OnDebug);
-    }
-    curl_easy_setopt(curl, CURLOPT_URL, strUrl.c_str());
-    curl_easy_setopt(curl, CURLOPT_POST, 1);
-    curl_easy_setopt(curl, CURLOPT_POSTFIELDS, strPost.c_str());
-    curl_easy_setopt(curl, CURLOPT_READFUNCTION, NULL);
-    curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, OnWriteData);
-    curl_easy_setopt(curl, CURLOPT_WRITEDATA, (void*)&strResponse);
-    curl_easy_setopt(curl, CURLOPT_NOSIGNAL, 1);
-    curl_easy_setopt(curl, CURLOPT_CONNECTTIMEOUT, 8);//连接超时,这个数值如果设置太短可能导致数据请求不到就断开了
-    curl_easy_setopt(curl, CURLOPT_TIMEOUT, 10);//接收数据时超时设置,如果10秒内数据未接收完,直接退出
-    res = curl_easy_perform(curl);
-    curl_easy_cleanup(curl);
-    return res;
+	CURLcode res;
+	CURL* curl = curl_easy_init();
+
+	if (NULL == curl)
+	{
+		return CURLE_FAILED_INIT;
+	}
+
+	if (m_bDebug)
+	{
+		curl_easy_setopt(curl, CURLOPT_VERBOSE, 1);
+		curl_easy_setopt(curl, CURLOPT_DEBUGFUNCTION, OnDebug);
+	}
+
+	curl_easy_setopt(curl, CURLOPT_URL, strUrl.c_str());
+	curl_easy_setopt(curl, CURLOPT_POST, 1);
+	curl_easy_setopt(curl, CURLOPT_POSTFIELDS, strPost.c_str());
+	curl_easy_setopt(curl, CURLOPT_READFUNCTION, NULL);
+	curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, OnWriteData);
+	curl_easy_setopt(curl, CURLOPT_WRITEDATA, (void *)&strResponse);
+	curl_easy_setopt(curl, CURLOPT_NOSIGNAL, 1);
+	curl_easy_setopt(curl, CURLOPT_CONNECTTIMEOUT, 8);//连接超时,这个数值如果设置太短可能导致数据请求不到就断开了
+	curl_easy_setopt(curl, CURLOPT_TIMEOUT, 10);//接收数据时超时设置,如果10秒内数据未接收完,直接退出
+	res = curl_easy_perform(curl);
+	curl_easy_cleanup(curl);
+	return res;
 }
 
-int CHttpClient::Get(const std::string& strUrl, std::string& strResponse)
+int CHttpClient::Get(const std::string & strUrl, std::string & strResponse)
 {
-    CURLcode res;
-    CURL* curl = curl_easy_init();
-    if(NULL == curl)
-    {
-        return CURLE_FAILED_INIT;
-    }
-    if(m_bDebug)
-    {
-        curl_easy_setopt(curl, CURLOPT_VERBOSE, 1);
-        curl_easy_setopt(curl, CURLOPT_DEBUGFUNCTION, OnDebug);
-    }
-    curl_easy_setopt(curl, CURLOPT_URL, strUrl.c_str());
-    curl_easy_setopt(curl, CURLOPT_READFUNCTION, NULL);
-    curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, OnWriteData);
-    curl_easy_setopt(curl, CURLOPT_WRITEDATA, (void*)&strResponse);
-    /**
-    * 当多个线程都使用超时处理的时候,同时主线程中有sleep或是wait等操作。
-    * 如果不设置这个选项,libcurl将会发信号打断这个wait从而导致程序退出。
-    */
-    curl_easy_setopt(curl, CURLOPT_NOSIGNAL, 1);
-    curl_easy_setopt(curl, CURLOPT_CONNECTTIMEOUT, 8);//连接超时,这个数值如果设置太短可能导致数据请求不到就断开了
-    curl_easy_setopt(curl, CURLOPT_TIMEOUT, 10);//接收数据时超时设置,如果10秒内数据未接收完,直接退出
-    res = curl_easy_perform(curl);
-    curl_easy_cleanup(curl);
-    return res;
+	CURLcode res;
+	CURL* curl = curl_easy_init();
+
+	if (NULL == curl)
+	{
+		return CURLE_FAILED_INIT;
+	}
+
+	if (m_bDebug)
+	{
+		curl_easy_setopt(curl, CURLOPT_VERBOSE, 1);
+		curl_easy_setopt(curl, CURLOPT_DEBUGFUNCTION, OnDebug);
+	}
+
+	curl_easy_setopt(curl, CURLOPT_URL, strUrl.c_str());
+	curl_easy_setopt(curl, CURLOPT_READFUNCTION, NULL);
+	curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, OnWriteData);
+	curl_easy_setopt(curl, CURLOPT_WRITEDATA, (void *)&strResponse);
+	/**
+	* 当多个线程都使用超时处理的时候,同时主线程中有sleep或是wait等操作。
+	* 如果不设置这个选项,libcurl将会发信号打断这个wait从而导致程序退出。
+	*/
+	curl_easy_setopt(curl, CURLOPT_NOSIGNAL, 1);
+	curl_easy_setopt(curl, CURLOPT_CONNECTTIMEOUT, 8);//连接超时,这个数值如果设置太短可能导致数据请求不到就断开了
+	curl_easy_setopt(curl, CURLOPT_TIMEOUT, 10);//接收数据时超时设置,如果10秒内数据未接收完,直接退出
+	res = curl_easy_perform(curl);
+	curl_easy_cleanup(curl);
+	return res;
 }
 
 /*
  *返回值说明 https://blog.csdn.net/u011857683/article/details/53069268
  **/
-int CHttpClient::Posts(const std::string& strUrl, const std::string& strPost, std::string& strResponse, const char* pCaPath)
+int CHttpClient::Posts(const std::string & strUrl, const std::string & strPost, std::string & strResponse, const char * pCaPath)
 {
-    CURLcode res;
-    CURL* curl = curl_easy_init();
-    if(NULL == curl)
-    {
-        return CURLE_FAILED_INIT;
-    }
-    if(m_bDebug)
-    {
-        curl_easy_setopt(curl, CURLOPT_VERBOSE, 1);
-        curl_easy_setopt(curl, CURLOPT_DEBUGFUNCTION, OnDebug);
-    }
-    curl_easy_setopt(curl, CURLOPT_URL, strUrl.c_str());
-    curl_easy_setopt(curl, CURLOPT_POST, 1);
-    curl_easy_setopt(curl, CURLOPT_POSTFIELDS, strPost.c_str());
-    curl_easy_setopt(curl, CURLOPT_READFUNCTION, NULL);
-    curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, OnWriteData);
-    curl_easy_setopt(curl, CURLOPT_WRITEDATA, (void*)&strResponse);
-    curl_easy_setopt(curl, CURLOPT_NOSIGNAL, 1);
-    if(NULL == pCaPath)
-    {
-        curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, false);
-        curl_easy_setopt(curl, CURLOPT_SSL_VERIFYHOST, false);
-    }
-    else
-    {
-        //缺省情况就是PEM,所以无需设置,另外支持DER
-        //curl_easy_setopt(curl,CURLOPT_SSLCERTTYPE,"PEM");
-        curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, true);
-        curl_easy_setopt(curl, CURLOPT_CAINFO, pCaPath);
-    }
-    curl_easy_setopt(curl, CURLOPT_CONNECTTIMEOUT, 8);//连接超时,这个数值如果设置太短可能导致数据请求不到就断开了
-    curl_easy_setopt(curl, CURLOPT_TIMEOUT, 10);//接收数据时超时设置,如果10秒内数据未接收完,直接退出
-    res = curl_easy_perform(curl);
-    curl_easy_cleanup(curl);
-    return res;
+	CURLcode res;
+	CURL* curl = curl_easy_init();
+
+	if (NULL == curl)
+	{
+		return CURLE_FAILED_INIT;
+	}
+
+	if (m_bDebug)
+	{
+		curl_easy_setopt(curl, CURLOPT_VERBOSE, 1);
+		curl_easy_setopt(curl, CURLOPT_DEBUGFUNCTION, OnDebug);
+	}
+
+	curl_easy_setopt(curl, CURLOPT_URL, strUrl.c_str());
+	curl_easy_setopt(curl, CURLOPT_POST, 1);
+	curl_easy_setopt(curl, CURLOPT_POSTFIELDS, strPost.c_str());
+	curl_easy_setopt(curl, CURLOPT_READFUNCTION, NULL);
+	curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, OnWriteData);
+	curl_easy_setopt(curl, CURLOPT_WRITEDATA, (void *)&strResponse);
+	curl_easy_setopt(curl, CURLOPT_NOSIGNAL, 1);
+	//curl_easy_setopt(curl, CURLOPT_COOKIE, "lwm_gray_tag=rc");;
+
+	if (NULL == pCaPath)
+	{
+		curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, false);
+		curl_easy_setopt(curl, CURLOPT_SSL_VERIFYHOST, false);
+	}
+
+	else
+	{
+		//缺省情况就是PEM,所以无需设置,另外支持DER
+		//curl_easy_setopt(curl,CURLOPT_SSLCERTTYPE,"PEM");
+		curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, true);
+		curl_easy_setopt(curl, CURLOPT_CAINFO, pCaPath);
+	}
+
+	curl_easy_setopt(curl, CURLOPT_CONNECTTIMEOUT, 8);//连接超时,这个数值如果设置太短可能导致数据请求不到就断开了
+	curl_easy_setopt(curl, CURLOPT_TIMEOUT, 10);//接收数据时超时设置,如果10秒内数据未接收完,直接退出
+	res = curl_easy_perform(curl);
+	curl_easy_cleanup(curl);
+	return res;
 }
 
-int CHttpClient::Gets(const std::string& strUrl, std::string& strResponse, const char* pCaPath)
+int CHttpClient::Gets(const std::string & strUrl, std::string & strResponse, const char * pCaPath)
 {
-    CURLcode res;
-    CURL* curl = curl_easy_init();
-    if(NULL == curl)
-    {
-        return CURLE_FAILED_INIT;
-    }
-    if(m_bDebug)
-    {
-        curl_easy_setopt(curl, CURLOPT_VERBOSE, 1);
-        curl_easy_setopt(curl, CURLOPT_DEBUGFUNCTION, OnDebug);
-    }
-    curl_easy_setopt(curl, CURLOPT_URL, strUrl.c_str());
-    curl_easy_setopt(curl, CURLOPT_READFUNCTION, NULL);
-    curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, OnWriteData);
-    curl_easy_setopt(curl, CURLOPT_WRITEDATA, (void*)&strResponse);
-    curl_easy_setopt(curl, CURLOPT_NOSIGNAL, 1);
-    if(NULL == pCaPath)
-    {
-        curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, false);
-        curl_easy_setopt(curl, CURLOPT_SSL_VERIFYHOST, false);
-    }
-    else
-    {
-        curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, true);
-        curl_easy_setopt(curl, CURLOPT_CAINFO, pCaPath);
-    }
-    curl_easy_setopt(curl, CURLOPT_CONNECTTIMEOUT, 8);//连接超时,这个数值如果设置太短可能导致数据请求不到就断开了
-    curl_easy_setopt(curl, CURLOPT_TIMEOUT, 10);//接收数据时超时设置,如果10秒内数据未接收完,直接退出
-    res = curl_easy_perform(curl);
-    curl_easy_cleanup(curl);
-    return res;
+	CURLcode res;
+	CURL* curl = curl_easy_init();
+
+	if (NULL == curl)
+	{
+		return CURLE_FAILED_INIT;
+	}
+
+	if (m_bDebug)
+	{
+		curl_easy_setopt(curl, CURLOPT_VERBOSE, 1);
+		curl_easy_setopt(curl, CURLOPT_DEBUGFUNCTION, OnDebug);
+	}
+
+	curl_easy_setopt(curl, CURLOPT_URL, strUrl.c_str());
+	curl_easy_setopt(curl, CURLOPT_READFUNCTION, NULL);
+	curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, OnWriteData);
+	curl_easy_setopt(curl, CURLOPT_WRITEDATA, (void *)&strResponse);
+	curl_easy_setopt(curl, CURLOPT_NOSIGNAL, 1);
+
+	if (NULL == pCaPath)
+	{
+		curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, false);
+		curl_easy_setopt(curl, CURLOPT_SSL_VERIFYHOST, false);
+	}
+
+	else
+	{
+		curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, true);
+		curl_easy_setopt(curl, CURLOPT_CAINFO, pCaPath);
+	}
+
+	curl_easy_setopt(curl, CURLOPT_CONNECTTIMEOUT, 8);//连接超时,这个数值如果设置太短可能导致数据请求不到就断开了
+	curl_easy_setopt(curl, CURLOPT_TIMEOUT, 10);//接收数据时超时设置,如果10秒内数据未接收完,直接退出
+	res = curl_easy_perform(curl);
+	curl_easy_cleanup(curl);
+	return res;
 }
 
 ///////////////////////////////////////////////////////////////////////////////////////////////
 
 void CHttpClient::SetDebug(bool bDebug)
 {
-    m_bDebug = bDebug;
+	m_bDebug = bDebug;
 }

+ 39 - 39
zhipuzi_pos_windows/network/CHttpClient.h

@@ -5,50 +5,50 @@ using namespace std;
 class CHttpClient
 {
 public:
-    CHttpClient();
-    ~CHttpClient();
+	CHttpClient();
+	~CHttpClient();
 
 public:
-    /**
-    * @brief HTTP POST请求
-    * @param strUrl 输入参数,请求的Url地址,如:http://www.baidu.com
-    * @param strPost 输入参数,使用如下格式para1=val1&para2=val2&…
-    * @param strResponse 输出参数,返回的内容
-    * @return 返回是否Post成功
-    */
-    int Post(const std::string& strUrl, const std::string& strPost, std::string& strResponse);
-
-    /**
-    * @brief HTTP GET请求
-    * @param strUrl 输入参数,请求的Url地址,如:http://www.baidu.com
-    * @param strResponse 输出参数,返回的内容
-    * @return 返回是否Post成功
-    */
-    int Get(const std::string& strUrl, std::string& strResponse);
-
-    /**
-    * @brief HTTPS POST请求,无证书版本
-    * @param strUrl 输入参数,请求的Url地址,如:https://www.alipay.com
-    * @param strPost 输入参数,使用如下格式ppara1=val1&para2=val2&…
-    * @param strResponse 输出参数,返回的内容
-    * @param pCaPath 输入参数,为CA证书的路径.如果输入为NULL,则不验证服务器端证书的有效性.
-    * @return 返回是否Post成功
-    */
-    int Posts(const std::string& strUrl, const std::string& strPost, std::string& strResponse, const char* pCaPath = NULL);
-
-    /**
-    * @brief HTTPS GET请求,无证书版本
-    * @param strUrl 输入参数,请求的Url地址,如:https://www.alipay.com
-    * @param strResponse 输出参数,返回的内容
-    * @param pCaPath 输入参数,为CA证书的路径.如果输入为NULL,则不验证服务器端证书的有效性.
-    * @return 返回是否Post成功
-    */
-    int Gets(const std::string& strUrl, std::string& strResponse, const char* pCaPath = NULL);
+	/**
+	* @brief HTTP POST请求
+	* @param strUrl 输入参数,请求的Url地址,如:http://www.baidu.com
+	* @param strPost 输入参数,使用如下格式para1=val1&para2=val2&…
+	* @param strResponse 输出参数,返回的内容
+	* @return 返回是否Post成功
+	*/
+	int Post(const std::string & strUrl, const std::string & strPost, std::string & strResponse);
+
+	/**
+	* @brief HTTP GET请求
+	* @param strUrl 输入参数,请求的Url地址,如:http://www.baidu.com
+	* @param strResponse 输出参数,返回的内容
+	* @return 返回是否Post成功
+	*/
+	int Get(const std::string & strUrl, std::string & strResponse);
+
+	/**
+	* @brief HTTPS POST请求,无证书版本
+	* @param strUrl 输入参数,请求的Url地址,如:https://www.alipay.com
+	* @param strPost 输入参数,使用如下格式ppara1=val1&para2=val2&…
+	* @param strResponse 输出参数,返回的内容
+	* @param pCaPath 输入参数,为CA证书的路径.如果输入为NULL,则不验证服务器端证书的有效性.
+	* @return 返回是否Post成功
+	*/
+	int Posts(const std::string & strUrl, const std::string & strPost, std::string & strResponse, const char * pCaPath = NULL);
+
+	/**
+	* @brief HTTPS GET请求,无证书版本
+	* @param strUrl 输入参数,请求的Url地址,如:https://www.alipay.com
+	* @param strResponse 输出参数,返回的内容
+	* @param pCaPath 输入参数,为CA证书的路径.如果输入为NULL,则不验证服务器端证书的有效性.
+	* @return 返回是否Post成功
+	*/
+	int Gets(const std::string & strUrl, std::string & strResponse, const char * pCaPath = NULL);
 
 public:
-    void SetDebug(bool bDebug);
+	void SetDebug(bool bDebug);
 
 private:
-    bool m_bDebug;
+	bool m_bDebug;
 };
 

+ 72 - 57
zhipuzi_pos_windows/network/CZhipuziHttpClient.cpp

@@ -27,7 +27,7 @@ bool CZhipuziHttpClient::Login(std::string& errmsg)
     std::map<string, string> params;
 
     std::string response;
-    bool ret = m_client.RequestNew("/login/login", params, response);
+    bool ret = m_client.RequestPingtai("/login/userlogin", params, response);
 
     if(!ret)
     {
@@ -71,22 +71,38 @@ bool CZhipuziHttpClient::Login(std::string& errmsg)
         }
     }
 
+	rapidjson::Value& v_data = document["data"];
+
+	rapidjson::Value& v_version_type = v_data["version_type"];
+	m_client.m_version_type = v_version_type.GetString();
+
+	if (m_client.m_version_type == "1")
+	{
+		m_client.m_yewu_ur = "https://cyapi.zhipuzi.com/pos";
+	}
+	else
+	{
+		m_client.m_yewu_ur = "https://lsapi.zhipuzi.com/pos";
+	}
+
+	rapidjson::Value& v_lwm_sess_token = v_data["lwm_sess_token"];
+	m_client.lwm_sess_token = v_lwm_sess_token.GetString();
+
     LOG_INFO("login success!");
 
     return true;
 }
 
-bool CZhipuziHttpClient::RequestOld(std::string url, std::map<string, string> params, std::string& response)
+bool CZhipuziHttpClient::Request(std::string url, std::map<string, string> params, std::string& response)
 {
     std::string timestamp = to_string(time(NULL));
     std::string nonce = "123456";
 
     //先添加默认参数,用于计算签名
-    params["machinecode"] = m_client.m_machinecode;
     params["username"] = m_client.m_username;
     params["nonce"] = nonce;
     params["timestamp"] = timestamp;
-    params["url"] = m_client.m_old_url + url;
+    params["url"] = m_client.m_yewu_ur + url;
 
     //计算签名
     std::string postString;
@@ -135,7 +151,7 @@ bool CZhipuziHttpClient::RequestOld(std::string url, std::map<string, string> pa
     LOG_INFO("postString:" << postString.c_str());
 
     CHttpClient m_httpClient;
-    int ret = m_httpClient.Posts(m_client.m_old_url + url, postString, response, NULL);
+    int ret = m_httpClient.Posts(m_client.m_yewu_ur + url, postString, response, NULL);
 
     LOG_INFO("response:" << response.c_str());
 
@@ -148,74 +164,73 @@ bool CZhipuziHttpClient::RequestOld(std::string url, std::map<string, string> pa
     return false;
 }
 
-bool CZhipuziHttpClient::RequestNew(std::string url, std::map<string, string> params, std::string& response)
+bool CZhipuziHttpClient::RequestPingtai(std::string url, std::map<string, string> params, std::string& response)
 {
-    std::string timestamp = to_string(time(NULL));
-    std::string nonce = "123456";
+	std::string timestamp = to_string(time(NULL));
+	std::string nonce = "123456";
 
-    std::string lwm_appid = "84b19199fd221a78c491cd553cbb4ab7";
-    std::string open_secret = "#repast!@#AfAS#@!";
+	//先添加默认参数,用于计算签名
+	params["username"] = m_client.m_username;
+	params["nonce"] = nonce;
+	params["timestamp"] = timestamp;
+	params["url"] = m_client.m_pingtai_url + url;
 
-    //先添加默认参数,用于计算签名
-    params["machinecode"] = m_client.m_machinecode;
-    params["username"] = CLewaimaiString::UrlEncode(m_client.m_username);
-    params["password"] = md5(m_client.m_password);
-    params["lwm_appid"] = "84b19199fd221a78c491cd553cbb4ab7";
-    params["nonce"] = nonce;
-    params["timestamp"] = timestamp;
+	//计算签名
+	std::string postString;
+	for (std::map<string, string>::iterator it = params.begin(); it != params.end();)
+	{
+		postString += it->first + "=" + it->second;
 
-    //计算签名
-    std::string postString;
-    for(std::map<string, string>::iterator it = params.begin(); it != params.end();)
-    {
-        postString += it->first + "=" + it->second;
+		it++;
 
-        it++;
+		if (it != params.end())
+		{
+			postString += "&";
+		}
+	}
 
-        if(it != params.end())
-        {
-            postString += "&";
-        }
-    }
+	LOG_INFO("postString:" << postString.c_str());
 
-    LOG_INFO("postString:" << postString.c_str());
+	//用于计算签名的临时变量
+	std::string password = md5(m_client.m_password);
+	transform(password.begin(), password.end(), password.begin(), ::toupper);
 
-    //用于计算签名的临时变量
-    string tmp = md5(postString);
-    tmp += open_secret;
+	string tmp = postString + password;
 
-    std::string sign = md5(tmp);
-    transform(sign.begin(), sign.end(), sign.begin(), ::toupper);
-    LOG_INFO("sign:" << sign.c_str());
+	std::string sign = md5(tmp);
+	transform(sign.begin(), sign.end(), sign.begin(), ::toupper);
+	LOG_INFO("sign:" << sign.c_str());
 
-    //加上签名,去掉url,计算post
-    params["sign"] = sign;
+	//加上签名,去掉url,计算post
+	params["sign"] = sign;
+	params.erase("url");
 
-    postString = "";
-    for(std::map<string, string>::iterator it = params.begin(); it != params.end();)
-    {
-        postString += it->first + "=" + it->second;
+	//未签名之前,不能进行urlencode,签名完成之后可以(params的value必须为utf8格式)
+	postString = "";
+	for (std::map<string, string>::iterator it = params.begin(); it != params.end();)
+	{
+		postString += it->first + "=" + CLewaimaiString::UrlEncode(it->second);
 
-        it++;
+		it++;
 
-        if(it != params.end())
-        {
-            postString += "&";
-        }
-    }
+		if (it != params.end())
+		{
+			postString += "&";
+		}
+	}
 
-    LOG_INFO("postString:" << postString.c_str());
+	LOG_INFO("postString:" << postString.c_str());
 
-    CHttpClient m_httpClient;
-    int ret = m_httpClient.Posts(m_client.m_new_url + url, postString, response, NULL);
+	CHttpClient m_httpClient;
+	int ret = m_httpClient.Posts(m_client.m_pingtai_url + url, postString, response, NULL);
 
-    LOG_INFO("response:" << response.c_str());
+	LOG_INFO("response:" << response.c_str());
 
-    if(ret == 0)
-    {
-        //ret为0表示没有出错
-        return true;
-    }
+	if (ret == 0)
+	{
+		//ret为0表示没有出错
+		return true;
+	}
 
-    return false;
+	return false;
 }

+ 7 - 7
zhipuzi_pos_windows/network/CZhipuziHttpClient.h

@@ -13,18 +13,18 @@ public:
 
     static bool Login(std::string& errmsg);
 
-    static bool RequestOld(std::string url, std::map<string, string> params, std::string& response);
-    static bool RequestNew(std::string url, std::map<string, string> params, std::string& response);
-
+    static bool Request(std::string url, std::map<string, string> params, std::string& response);
+	static bool RequestPingtai(std::string url, std::map<string, string> params, std::string& response);
 public:
     static CZhipuziHttpClient m_client;
 
 private:
     std::string m_username;
     std::string m_password;
-    std::string m_machinecode = "e6bc5694877b2aec";
 
-    std::string m_old_url = "https://cyapi.zhipuzi.com/pos";
-    std::string m_new_url = "https://pf-api.zhipuzi.com/pos";
-};
+    std::string m_pingtai_url = "https://pf-api.zhipuzi.com/pos";
+	std::string m_yewu_ur = "";
 
+	std::string m_version_type;
+	std::string lwm_sess_token;
+};

+ 6 - 6
zhipuzi_pos_windows/order/CWaimaiOrder.cpp

@@ -18,7 +18,7 @@ bool CWaimaiOrder::InitData(std::string order_id, std::string order_no)
     params["order_no"] = order_no;
 
     std::string response;
-    bool ret = CZhipuziHttpClient::RequestOld("/waimaiorder/getorderdetail", params, response);
+    bool ret = CZhipuziHttpClient::Request("/waimaiorder/getorderdetail", params, response);
     if(!ret)
     {
         LOG_INFO("网络请求出错");
@@ -191,7 +191,7 @@ bool CWaimaiOrder::ConfirmeOrder(std::string order_id)
     params["id"] = order_id;
     std::string response;
 
-    CZhipuziHttpClient::RequestOld(url.c_str(), params, response);
+    CZhipuziHttpClient::Request(url.c_str(), params, response);
 
     rapidjson::Document document;
     document.Parse(response.c_str());
@@ -233,7 +233,7 @@ bool CWaimaiOrder::SuccessOrder(std::string order_id)
     params["id"] = order_id;
     std::string response;
 
-    CZhipuziHttpClient::RequestOld(url.c_str(), params, response);
+    CZhipuziHttpClient::Request(url.c_str(), params, response);
 
     rapidjson::Document document;
     document.Parse(response.c_str());
@@ -276,7 +276,7 @@ bool CWaimaiOrder::FailOrder(std::string order_id, std::string reason)
     params["failed_reason"] = reason;
     std::string response;
 
-    CZhipuziHttpClient::RequestOld(url.c_str(), params, response);
+    CZhipuziHttpClient::Request(url.c_str(), params, response);
 
     rapidjson::Document document;
     document.Parse(response.c_str());
@@ -318,7 +318,7 @@ bool CWaimaiOrder::AgreeRefund(std::string order_id)
     params["order_id"] = order_id;
     std::string response;
 
-    CZhipuziHttpClient::RequestOld(url.c_str(), params, response);
+    CZhipuziHttpClient::Request(url.c_str(), params, response);
 
     rapidjson::Document document;
     document.Parse(response.c_str());
@@ -360,7 +360,7 @@ bool CWaimaiOrder::DisagreeRefund(std::string order_id)
     params["order_id"] = order_id;
     std::string response;
 
-    CZhipuziHttpClient::RequestOld(url.c_str(), params, response);
+    CZhipuziHttpClient::Request(url.c_str(), params, response);
 
     rapidjson::Document document;
     document.Parse(response.c_str());

+ 273 - 211
zhipuzi_pos_windows/wnd/CLoginWnd.cpp

@@ -247,106 +247,106 @@ LRESULT CLoginWnd::OnSize(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandle
 
 LRESULT CLoginWnd::HandleMessage(UINT uMsg, WPARAM wParam, LPARAM lParam)
 {
-    LRESULT lRes = 0;
-    BOOL bHandled = TRUE;
-    switch(uMsg)
-    {
-    case WM_CREATE:
-        lRes = OnCreate(uMsg, wParam, lParam, bHandled);
-        break;
-    case WM_CLOSE:
-        lRes = OnClose(uMsg, wParam, lParam, bHandled);
-        break;
-    case WM_DESTROY:
-        lRes = OnDestroy(uMsg, wParam, lParam, bHandled);
-        break;
-    case WM_NCACTIVATE:
-        lRes = OnNcActivate(uMsg, wParam, lParam, bHandled);
-        break;
-    case WM_NCCALCSIZE:
-        lRes = OnNcCalcSize(uMsg, wParam, lParam, bHandled);
-        break;
-    case WM_NCPAINT:
-        lRes = OnNcPaint(uMsg, wParam, lParam, bHandled);
-        break;
-    case WM_NCHITTEST:
-        lRes = OnNcHitTest(uMsg, wParam, lParam, bHandled);
-        break;
-    case WM_SIZE:
-        lRes = OnSize(uMsg, wParam, lParam, bHandled);
-        break;
-    default:
-        bHandled = FALSE;
-    }
-    if(bHandled)
-    {
-        return lRes;
-    }
-    if(m_pm.MessageHandler(uMsg, wParam, lParam, lRes))
-    {
-        return lRes;
-    }
-    return CWindowWnd::HandleMessage(uMsg, wParam, lParam);
+	LRESULT lRes = 0;
+	BOOL bHandled = TRUE;
+	switch (uMsg)
+	{
+	case WM_CREATE:
+		lRes = OnCreate(uMsg, wParam, lParam, bHandled);
+		break;
+	case WM_CLOSE:
+		lRes = OnClose(uMsg, wParam, lParam, bHandled);
+		break;
+	case WM_DESTROY:
+		lRes = OnDestroy(uMsg, wParam, lParam, bHandled);
+		break;
+	case WM_NCACTIVATE:
+		lRes = OnNcActivate(uMsg, wParam, lParam, bHandled);
+		break;
+	case WM_NCCALCSIZE:
+		lRes = OnNcCalcSize(uMsg, wParam, lParam, bHandled);
+		break;
+	case WM_NCPAINT:
+		lRes = OnNcPaint(uMsg, wParam, lParam, bHandled);
+		break;
+	case WM_NCHITTEST:
+		lRes = OnNcHitTest(uMsg, wParam, lParam, bHandled);
+		break;
+	case WM_SIZE:
+		lRes = OnSize(uMsg, wParam, lParam, bHandled);
+		break;
+	default:
+		bHandled = FALSE;
+	}
+	if (bHandled)
+	{
+		return lRes;
+	}
+	if (m_pm.MessageHandler(uMsg, wParam, lParam, lRes))
+	{
+		return lRes;
+	}
+	return CWindowWnd::HandleMessage(uMsg, wParam, lParam);
 }
 
 LRESULT CLoginWnd::MessageHandler(UINT uMsg, WPARAM wParam, LPARAM lParam, bool& bHandled)
 {
-    if(uMsg == WM_KEYDOWN)
-    {
-        if(wParam == VK_RETURN)
-        {
-            CEditUI* pEdit = static_cast<CEditUI*>(m_pm.FindControl(_T("accountedit")));
-            if(pEdit->GetText().IsEmpty())
-            {
-                pEdit->SetFocus();
-            }
-            else
-            {
-                pEdit = static_cast<CEditUI*>(m_pm.FindControl(_T("pwdedit")));
-                if(pEdit->GetText().IsEmpty())
-                {
-                    pEdit->SetFocus();
-                }
-                else
-                {
-                    this->HandleLogin();
-                }
-            }
-            return true;
-        }
-        else if(wParam == VK_ESCAPE)
-        {
-            PostQuitMessage(0);
-            return true;
-        }
-
-    }
-    else if(uMsg == WM_LOGIN_SUCCESS)
-    {
-        LoginSuccess();
-        return true;
-    }
-    else if(uMsg == WM_LOGIN_ERROR)
-    {
-        LoginError();
-        return true;
-    }
-    else if(uMsg == WM_NEED_UPDATE)
-    {
-        //说明需要升级了
-
-        Update();
-
-        return true;
-    }
-    else if(uMsg == WM_LOGIN_AGAIN_OUT)
-    {
-        ShowLoginAgainOut();
-
-        return true;
-    }
-
-    return false;
+	if (uMsg == WM_KEYDOWN)
+	{
+		if (wParam == VK_RETURN)
+		{
+			CEditUI* pEdit = static_cast<CEditUI*>(m_pm.FindControl(_T("accountedit")));
+			if (pEdit->GetText().IsEmpty())
+			{
+				pEdit->SetFocus();
+			}
+			else
+			{
+				pEdit = static_cast<CEditUI*>(m_pm.FindControl(_T("pwdedit")));
+				if (pEdit->GetText().IsEmpty())
+				{
+					pEdit->SetFocus();
+				}
+				else
+				{
+					this->HandleLogin();
+				}
+			}
+			return true;
+		}
+		else if (wParam == VK_ESCAPE)
+		{
+			PostQuitMessage(0);
+			return true;
+		}
+
+	}
+	else if (uMsg == WM_LOGIN_SUCCESS)
+	{
+		LoginSuccess();
+		return true;
+	}
+	else if (uMsg == WM_LOGIN_ERROR)
+	{
+		LoginError();
+		return true;
+	}
+	else if (uMsg == WM_NEED_UPDATE)
+	{
+		//说明需要升级了
+
+		Update();
+
+		return true;
+	}
+	else if (uMsg == WM_LOGIN_AGAIN_OUT)
+	{
+		ShowLoginAgainOut();
+
+		return true;
+	}
+
+	return false;
 }
 
 void CLoginWnd::StartLogin()
@@ -367,118 +367,180 @@ void CLoginWnd::StartLogin()
 
 void CLoginWnd::HandleLogin()
 {
-    ////真正登录前,先检测是否有需要更新
-    //CSystem::my_sleep(1);
+	CLabelUI* pLoginResultLabel = static_cast<CLabelUI*>(m_pm.FindControl(_T("loginresult")));
 
-    ////如果需要更新,那么就提示
-    //PostMessage(WM_NEED_UPDATE);
-    //return;
+	//真正登录前,先检测是否有需要更新
+	//std::map<string, string> params;
 
-    //判断账号密码是否正确
-    std::wstring account, password;
-    CEditUI* pAccountEdit = static_cast<CEditUI*>(m_pm.FindControl(_T("accountedit")));
-    if(pAccountEdit)
-    {
-        account = pAccountEdit->GetText().GetData();
-    }
+	//std::string response;
+	//bool ret = CZhipuziHttpClient::Request("/version/getwindowsversion", params, response);
+	//if (!ret)
+	//{
+	//	pLoginResultLabel->SetText(std::wstring(_T("网络请求出错")).c_str());
+	//	pLoginResultLabel->SetVisible(true);
 
-    CEditUI* pPasswordEdit = static_cast<CEditUI*>(m_pm.FindControl(_T("pwdedit")));
-    if(pPasswordEdit)
-    {
-        password = pPasswordEdit->GetText().GetData();
-    }
+	//	PostMessage(WM_LOGIN_ERROR);
 
-    LOG_INFO("account:" << account.c_str() << ", password:" << password.c_str());
+	//	return;
+	//}
 
-    string s_account = CLewaimaiString::UnicodeToUTF8(account);
-    string s_password = CLewaimaiString::UnicodeToUTF8(password);
+	//rapidjson::Document document;
+	//document.Parse(response.c_str());
 
-    CLewaimaiString::trim(s_account);
-    CLewaimaiString::trim(s_password);
+	//if (document.HasParseError())
+	//{
+	//	pLoginResultLabel->SetText(std::wstring(_T("服务器返回数据格式错误")).c_str());
+	//	pLoginResultLabel->SetVisible(true);
 
-    CLabelUI* pLoginResultLabel = static_cast<CLabelUI*>(m_pm.FindControl(_T("loginresult")));
-    if(s_account.compare("") == 0)
-    {
-        pLoginResultLabel->SetText(std::wstring(_T("用户名不能为空")).c_str());
-        pLoginResultLabel->SetVisible(true);
+	//	PostMessage(WM_LOGIN_ERROR);
 
-        PostMessage(WM_LOGIN_ERROR);
+	//	return;
+	//}
+	//else
+	//{
+	//	if (!document.HasMember("errcode") || !document.HasMember("errmsg") || !document.HasMember("data"))
+	//	{
+	//		pLoginResultLabel->SetText(std::wstring(_T("服务器返回数据格式错误")).c_str());
+	//		pLoginResultLabel->SetVisible(true);
 
-        return;
-    }
+	//		PostMessage(WM_LOGIN_ERROR);
 
-    if(s_password.compare("") == 0)
-    {
-        pLoginResultLabel->SetText(std::wstring(_T("密码不能为空")).c_str());
-        pLoginResultLabel->SetVisible(true);
+	//		return;
+	//	}
+
+	//	rapidjson::Value& v_errcode = document["errcode"];
+	//	int errcode = v_errcode.GetInt();
+	//	if (errcode != 0)
+	//	{
+	//		std::string errmsg = "response failed! message:" + string(document["errmsg"].GetString());
+	//		pLoginResultLabel->SetText(CLewaimaiString::UTF8ToUnicode(errmsg).c_str());
+	//		pLoginResultLabel->SetVisible(true);
+
+	//		PostMessage(WM_LOGIN_ERROR);
+
+	//		return;
+	//	}
+
+	//	rapidjson::Value& data = document["data"];
+
+	//	std::string newest_version = data["newest_version"].GetString();
+	//	m_update_url = data["url"].GetString();
+
+	//	if (newest_version > CSystem::GetVersion())
+	//	{
+	//		//说明有新版本,要更新
+	//		PostMessage(WM_NEED_UPDATE);
+	//		return;
+	//	}
+	//}
+
+	//判断账号密码是否正确
+	std::wstring account, password;
+	CEditUI* pAccountEdit = static_cast<CEditUI*>(m_pm.FindControl(_T("accountedit")));
+	if (pAccountEdit)
+	{
+		account = pAccountEdit->GetText().GetData();
+	}
+
+	CEditUI* pPasswordEdit = static_cast<CEditUI*>(m_pm.FindControl(_T("pwdedit")));
+	if (pPasswordEdit)
+	{
+		password = pPasswordEdit->GetText().GetData();
+	}
+
+	//把第1个中文冒号替换成英文冒号
+	CLewaimaiString::Replace(account, _T(":"), _T(":"), 1);
+
+	//LOG_INFO("account:" << account.c_str() << ", password:" << password.c_str());
+
+	string s_account = CLewaimaiString::UnicodeToUTF8(account);
+	string s_password = CLewaimaiString::UnicodeToUTF8(password);
+
+	CLewaimaiString::trim(s_account);
+	CLewaimaiString::trim(s_password);
+
+	if (s_account.compare("") == 0)
+	{
+		pLoginResultLabel->SetText(std::wstring(_T("用户名不能为空")).c_str());
+		pLoginResultLabel->SetVisible(true);
+
+		PostMessage(WM_LOGIN_ERROR);
+
+		return;
+	}
+
+	if (s_password.compare("") == 0)
+	{
+		pLoginResultLabel->SetText(std::wstring(_T("密码不能为空")).c_str());
+		pLoginResultLabel->SetVisible(true);
+
+		PostMessage(WM_LOGIN_ERROR);
+
+		return;
+	}
 
-        PostMessage(WM_LOGIN_ERROR);
+	CZhipuziHttpClient::Init(s_account, s_password);
+
+	std::string errmsg;
+	bool res = CZhipuziHttpClient::Login(errmsg);
+
+	if (res)
+	{
+		CCheckBoxUI* pAuto = static_cast<CCheckBoxUI*>(m_pm.FindControl(_T("login_auto_login")));
+		CCheckBoxUI* pRemember = static_cast<CCheckBoxUI*>(m_pm.FindControl(_T("login_remember_password")));
+
+		if (pAuto->IsSelected())
+		{
+			CSetting::SetParam("setting_is_auto_login", "1", false);
+			CSetting::SetParam("setting_is_remember_password", "1", false);
+
+			//相当于开启自动登录,默认就是开启了记住密码了
+			CSetting::SetUser(s_account, s_password, true);
+		}
+		else
+		{
+			CSetting::SetParam("setting_is_auto_login", "0", false);
+
+			if (pRemember->IsSelected())
+			{
+				CSetting::SetParam("setting_is_remember_password", "1", false);
+			}
+			else
+			{
+				CSetting::SetParam("setting_is_remember_password", "0", false);
+			}
+
+
+			if (pRemember->IsSelected())
+			{
+				CSetting::SetUser(s_account, s_password, true);
+			}
+			else
+			{
+				CSetting::SetUser(s_account, "", true);
+			}
+		}
+
+		//在这里设置完参数后,统一保存到数据库
+		CSetting::SetParam("last_login_username", s_account, true);
+
+		//把用户名和密码保存起来
+		CSetting::SetLoginInfo(s_account, s_password);
+
+		PostMessage(WM_LOGIN_SUCCESS);
+
+		return;
+	}
+	else
+	{
+		//登录失败了
+		CLabelUI* pLoginResultLabel = static_cast<CLabelUI*>(m_pm.FindControl(_T("loginresult")));
+
+		pLoginResultLabel->SetText(std::wstring(_T("登录失败:") + CLewaimaiString::UTF8ToUnicode(errmsg)).c_str());
+		pLoginResultLabel->SetVisible(true);
 
-        return;
-    }
-
-    CZhipuziHttpClient::Init(s_account, s_password);
-
-    std::string errmsg;
-    bool res = CZhipuziHttpClient::Login(errmsg);
-
-    if(res)
-    {
-        CCheckBoxUI* pAuto = static_cast<CCheckBoxUI*>(m_pm.FindControl(_T("login_auto_login")));
-        CCheckBoxUI* pRemember = static_cast<CCheckBoxUI*>(m_pm.FindControl(_T("login_remember_password")));
-
-        if(pAuto->IsSelected())
-        {
-            CSetting::SetParam("setting_is_auto_login", "1", false);
-            CSetting::SetParam("setting_is_remember_password", "1", false);
-
-            //相当于开启自动登录,默认就是开启了记住密码了
-            CSetting::SetUser(s_account, s_password, true);
-        }
-        else
-        {
-            CSetting::SetParam("setting_is_auto_login", "0", false);
-
-            if(pRemember->IsSelected())
-            {
-                CSetting::SetParam("setting_is_remember_password", "1", false);
-            }
-            else
-            {
-                CSetting::SetParam("setting_is_remember_password", "0", false);
-            }
-
-
-            if(pRemember->IsSelected())
-            {
-                CSetting::SetUser(s_account, s_password, true);
-            }
-            else
-            {
-                CSetting::SetUser(s_account, "", true);
-            }
-        }
-
-        //在这里设置完参数后,统一保存到数据库
-        CSetting::SetParam("last_login_username", s_account, true);
-
-        //把用户名和密码保存起来
-        CSetting::SetLoginInfo(s_account, s_password);
-
-        PostMessage(WM_LOGIN_SUCCESS);
-
-        return;
-    }
-    else
-    {
-        //登录失败了
-        CLabelUI* pLoginResultLabel = static_cast<CLabelUI*>(m_pm.FindControl(_T("loginresult")));
-
-        pLoginResultLabel->SetText(std::wstring(_T("登录失败:") + CLewaimaiString::UTF8ToUnicode(errmsg)).c_str());
-        pLoginResultLabel->SetVisible(true);
-
-        PostMessage(WM_LOGIN_ERROR);
-    }
+		PostMessage(WM_LOGIN_ERROR);
+	}
 }
 
 void CLoginWnd::LoginSuccess()
@@ -512,26 +574,26 @@ void CLoginWnd::LoginError()
 
 void CLoginWnd::Update()
 {
-    CUpdateWnd* pFrame = new CUpdateWnd();
-    if(pFrame == NULL)
-    {
-        return;
-    }
+	CUpdateWnd* pFrame = new CUpdateWnd();
+	if (pFrame == NULL)
+	{
+		return;
+	}
 
-    TCHAR lpTempPathBuffer[MAX_PATH];
-    DWORD dwRetVal = GetTempPath(MAX_PATH, lpTempPathBuffer);
+	TCHAR lpTempPathBuffer[MAX_PATH];
+	DWORD dwRetVal = GetTempPath(MAX_PATH, lpTempPathBuffer);
 
-    std::string url = "http://down10d.zol.com.cn/zoldownload_os/nsis3.04setup@81_262627.exe";
-    std::string filename = CLewaimaiString::UnicodeToANSI(lpTempPathBuffer);
-    pFrame->InitData(url, filename);
+	std::string url = m_update_url;
+	std::string filename = CLewaimaiString::UnicodeToANSI(lpTempPathBuffer);
+	pFrame->InitData(url, filename);
 
-    pFrame->SetIcon(IDI_ICON_DUILIB);
-    pFrame->Create(NULL, _T("自动更新"), UI_WNDSTYLE_DIALOG, 0, 0, 0, 0, 0, NULL);
-    pFrame->CenterWindow();
+	pFrame->SetIcon(IDI_ICON_DUILIB);
+	pFrame->Create(NULL, _T("自动更新"), UI_WNDSTYLE_DIALOG, 0, 0, 0, 0, 0, NULL);
+	pFrame->CenterWindow();
 
-    ::ShowWindow(*pFrame, SW_SHOWNORMAL);
+	::ShowWindow(*pFrame, SW_SHOWNORMAL);
 
-    Close();
+	Close();
 }
 
 void CLoginWnd::ShowLoginAgainOut()

+ 1 - 1
zhipuzi_pos_windows/wnd/CMainWnd.cpp

@@ -1870,7 +1870,7 @@ void CMainWnd::InitSettingStatus()
 
     std::string url = "/goodstype/getgoodstypelist";
 
-    CZhipuziHttpClient::RequestOld(url.c_str(), params, response);
+    CZhipuziHttpClient::Request(url.c_str(), params, response);
 
     rapidjson::Document document;
     document.Parse(response.c_str());