11#ifdef _MSC_BUILD
22#include < windows.h>
33#include < tchar.h>
4- #pragma comment(lib,"../../XEngine_Source/Debug/jsoncpp")
54#pragma comment(lib,"XEngine_BaseLib/XEngine_BaseLib")
65#pragma comment(lib,"XEngine_NetHelp/NetHelp_APIClient")
76#pragma comment(lib,"Ws2_32")
7+ #ifdef _WIN64
8+ #pragma comment(lib,"../../XEngine_Source/x64/Debug/jsoncpp")
9+ #else
10+ #pragma comment(lib,"../../XEngine_Source/Debug/jsoncpp")
11+ #endif
812#endif
913#include < stdio.h>
1014#include < string.h>
@@ -22,37 +26,37 @@ using namespace std;
2226
2327// g++ -std=c++17 -Wall -g APPClient_RestApi.cpp -o APPClient_RestApi.exe -L ../../../XEngine/XEngine_Release/XEngine_Linux/Ubuntu/XEngine_BaseLib -L ../../../XEngine/XEngine_Release/XEngine_Linux/Ubuntu/XEngine_NetHelp -lXEngine_BaseLib -lNetHelp_APIClient -ljsoncpp -Wl,-rpath=../../../XEngine/XEngine_Release/XEngine_Linux/Ubuntu/XEngine_BaseLib:../../../XEngine/XEngine_Release/XEngine_Linux/Ubuntu/XEngine_NetHelp,--disable-new-dtags
2428// 需要优先配置XEngine
25- // WINDOWS使用VS2022 x86 debug 编译
29+ // WINDOWS使用VS2022 x86 或者 x64 debug 编译
2630// linux使用下面的命令编译
2731// g++ -std=c++17 -Wall -g APPClient_RestApi.cpp -o APPClient_RestApi.exe -I ../../XEngine_Source/XEngine_ThirdPart/jsoncpp -L /usr/local/lib/XEngine_Release/XEngine_BaseLib -L /usr/local/lib/XEngine_Release/XEngine_NetHelp -L ../../XEngine_Source/XEngine_ThirdPart/jsoncpp -lXEngine_BaseLib -lNetHelp_APIClient -ljsoncpp
2832
2933// 查询
3034void API_Manage_Query ()
3135{
32- LPCTSTR lpszUrl = _T (" http://192.168.1.8:5100/Api/Manage/QueryFile" );
36+ LPCXSTR lpszUrl = _X (" http://192.168.1.8:5100/Api/Manage/QueryFile" );
3337 int nLen = 0 ;
3438 int nCode = 0 ;
35- TCHAR * ptszMsgBuffer = NULL ;
39+ XCHAR * ptszMsgBuffer = NULL ;
3640 Json::Value st_JsonRoot;
3741 st_JsonRoot[" lpszTimeStart" ];
3842 st_JsonRoot[" lpszTimeEnd" ];
3943 st_JsonRoot[" lpszBuckKey" ] = " storagekey2" ;
4044
41- if (!APIClient_Http_Request (_T (" POST" ), lpszUrl, st_JsonRoot.toStyledString ().c_str (), &nCode, &ptszMsgBuffer, &nLen))
45+ if (!APIClient_Http_Request (_X (" POST" ), lpszUrl, st_JsonRoot.toStyledString ().c_str (), &nCode, &ptszMsgBuffer, &nLen))
4246 {
43- printf (" API_Manage_Query:%lX\n " , APIClient_GetLastError ());
47+ _xtprintf (" API_Manage_Query:%lX\n " , APIClient_GetLastError ());
4448 return ;
4549 }
46- printf (" API_Manage_Query:%d,%s\n " , nCode, ptszMsgBuffer);
50+ _xtprintf (" API_Manage_Query:%d,%s\n " , nCode, ptszMsgBuffer);
4751 BaseLib_OperatorMemory_FreeCStyle ((XPPMEM)&ptszMsgBuffer);
4852}
4953// 插入
5054void API_Manage_Insert ()
5155{
52- LPCTSTR lpszUrl = _T (" http://192.168.1.8:5100/Api/Manage/Insert" );
56+ LPCXSTR lpszUrl = _X (" http://192.168.1.8:5100/Api/Manage/Insert" );
5357 int nLen = 0 ;
5458 int nCode = 0 ;
55- TCHAR * ptszMsgBuffer = NULL ;
59+ XCHAR * ptszMsgBuffer = NULL ;
5660 Json::Value st_JsonRoot;
5761 Json::Value st_JsonArray;
5862 Json::Value st_JsonObject;
@@ -66,21 +70,21 @@ void API_Manage_Insert()
6670 st_JsonRoot[" List" ] = st_JsonArray;
6771 st_JsonRoot[" Count" ] = 1 ;
6872
69- if (!APIClient_Http_Request (_T (" POST" ), lpszUrl, st_JsonRoot.toStyledString ().c_str (), &nCode, &ptszMsgBuffer, &nLen))
73+ if (!APIClient_Http_Request (_X (" POST" ), lpszUrl, st_JsonRoot.toStyledString ().c_str (), &nCode, &ptszMsgBuffer, &nLen))
7074 {
71- printf (" API_Manage_Insert:%lX\n " , APIClient_GetLastError ());
75+ _xtprintf (" API_Manage_Insert:%lX\n " , APIClient_GetLastError ());
7276 return ;
7377 }
74- printf (" API_Manage_Insert:%d,%s\n " , nCode, ptszMsgBuffer);
78+ _xtprintf (" API_Manage_Insert:%d,%s\n " , nCode, ptszMsgBuffer);
7579 BaseLib_OperatorMemory_FreeCStyle ((XPPMEM)&ptszMsgBuffer);
7680}
7781// 删除
7882void API_Manage_Delete ()
7983{
80- LPCTSTR lpszUrl = _T (" http://192.168.1.8:5100/Api/Manage/Delete" );
84+ LPCXSTR lpszUrl = _X (" http://192.168.1.8:5100/Api/Manage/Delete" );
8185 int nLen = 0 ;
8286 int nCode = 0 ;
83- TCHAR * ptszMsgBuffer = NULL ;
87+ XCHAR * ptszMsgBuffer = NULL ;
8488 Json::Value st_JsonRoot;
8589 Json::Value st_JsonArray;
8690 Json::Value st_JsonObject;
@@ -91,71 +95,71 @@ void API_Manage_Delete()
9195 st_JsonRoot[" List" ] = st_JsonArray;
9296 st_JsonRoot[" Count" ] = 1 ;
9397
94- if (!APIClient_Http_Request (_T (" POST" ), lpszUrl, st_JsonRoot.toStyledString ().c_str (), &nCode, &ptszMsgBuffer, &nLen))
98+ if (!APIClient_Http_Request (_X (" POST" ), lpszUrl, st_JsonRoot.toStyledString ().c_str (), &nCode, &ptszMsgBuffer, &nLen))
9599 {
96- printf (" API_Manage_Delete:%lX\n " , APIClient_GetLastError ());
100+ _xtprintf (" API_Manage_Delete:%lX\n " , APIClient_GetLastError ());
97101 return ;
98102 }
99- printf (" API_Manage_Delete:%d,%s\n " , nCode, ptszMsgBuffer);
103+ _xtprintf (" API_Manage_Delete:%d,%s\n " , nCode, ptszMsgBuffer);
100104 BaseLib_OperatorMemory_FreeCStyle ((XPPMEM)&ptszMsgBuffer);
101105}
102106// 文件夹
103107void API_Manage_Dir ()
104108{
105- LPCTSTR lpszUrl = _T (" http://192.168.1.8:5100/Api/Manage/Dir" );
109+ LPCXSTR lpszUrl = _X (" http://192.168.1.8:5100/Api/Manage/Dir" );
106110 int nLen = 0 ;
107111 int nCode = 0 ;
108- TCHAR * ptszMsgBuffer = NULL ;
112+ XCHAR * ptszMsgBuffer = NULL ;
109113 Json::Value st_JsonRoot;
110114 // 创建
111115 st_JsonRoot[" lpszBuckKey" ] = " storagekey1" ;
112116 st_JsonRoot[" lpszUserDir" ] = " user" ;
113117 st_JsonRoot[" nOPerator" ] = 1 ;
114- if (!APIClient_Http_Request (_T (" POST" ), lpszUrl, st_JsonRoot.toStyledString ().c_str (), &nCode, &ptszMsgBuffer, &nLen))
118+ if (!APIClient_Http_Request (_X (" POST" ), lpszUrl, st_JsonRoot.toStyledString ().c_str (), &nCode, &ptszMsgBuffer, &nLen))
115119 {
116- printf (" API_Manage_Dir:%lX\n " , APIClient_GetLastError ());
120+ _xtprintf (" API_Manage_Dir:%lX\n " , APIClient_GetLastError ());
117121 return ;
118122 }
119- printf (" API_Manage_Dir:%d,%s\n " , nCode, ptszMsgBuffer);
123+ _xtprintf (" API_Manage_Dir:%d,%s\n " , nCode, ptszMsgBuffer);
120124 BaseLib_OperatorMemory_FreeCStyle ((XPPMEM)&ptszMsgBuffer);
121125 // 查询
122126 st_JsonRoot.clear ();
123127 st_JsonRoot[" lpszBuckKey" ] = " storagekey1" ;
124128 st_JsonRoot[" lpszUserDir" ];
125129 st_JsonRoot[" nOPerator" ] = 0 ;
126- if (!APIClient_Http_Request (_T (" POST" ), lpszUrl, st_JsonRoot.toStyledString ().c_str (), &nCode, &ptszMsgBuffer, &nLen))
130+ if (!APIClient_Http_Request (_X (" POST" ), lpszUrl, st_JsonRoot.toStyledString ().c_str (), &nCode, &ptszMsgBuffer, &nLen))
127131 {
128- printf (" API_Manage_Dir:%lX\n " , APIClient_GetLastError ());
132+ _xtprintf (" API_Manage_Dir:%lX\n " , APIClient_GetLastError ());
129133 return ;
130134 }
131- printf (" API_Manage_Dir:%d,%s\n " , nCode, ptszMsgBuffer);
135+ _xtprintf (" API_Manage_Dir:%d,%s\n " , nCode, ptszMsgBuffer);
132136 BaseLib_OperatorMemory_FreeCStyle ((XPPMEM)&ptszMsgBuffer);
133137 // 删除
134138 st_JsonRoot.clear ();
135139 st_JsonRoot[" lpszBuckKey" ] = " storagekey1" ;
136140 st_JsonRoot[" lpszUserDir" ] = " user" ;
137141 st_JsonRoot[" nOPerator" ] = 2 ;
138- if (!APIClient_Http_Request (_T (" POST" ), lpszUrl, st_JsonRoot.toStyledString ().c_str (), &nCode, &ptszMsgBuffer, &nLen))
142+ if (!APIClient_Http_Request (_X (" POST" ), lpszUrl, st_JsonRoot.toStyledString ().c_str (), &nCode, &ptszMsgBuffer, &nLen))
139143 {
140- printf (" API_Manage_Dir:%lX\n " , APIClient_GetLastError ());
144+ _xtprintf (" API_Manage_Dir:%lX\n " , APIClient_GetLastError ());
141145 return ;
142146 }
143- printf (" API_Manage_Dir:%d,%s\n " , nCode, ptszMsgBuffer);
147+ _xtprintf (" API_Manage_Dir:%d,%s\n " , nCode, ptszMsgBuffer);
144148 BaseLib_OperatorMemory_FreeCStyle ((XPPMEM)&ptszMsgBuffer);
145149}
146150// 任务管理
147151void API_Manage_Task ()
148152{
149- LPCTSTR lpszUrl = _T (" http://192.168.1.8:5100/Api/Manage/Task" );
153+ LPCXSTR lpszUrl = _X (" http://192.168.1.8:5100/Api/Manage/Task" );
150154 int nLen = 0 ;
151155 int nCode = 0 ;
152- TCHAR * ptszMsgBuffer = NULL ;
153- if (!APIClient_Http_Request (_T (" POST" ), lpszUrl, NULL , &nCode, &ptszMsgBuffer, &nLen))
156+ XCHAR * ptszMsgBuffer = NULL ;
157+ if (!APIClient_Http_Request (_X (" POST" ), lpszUrl, NULL , &nCode, &ptszMsgBuffer, &nLen))
154158 {
155- printf (" API_Manage_Task:%lX\n " , APIClient_GetLastError ());
159+ _xtprintf (" API_Manage_Task:%lX\n " , APIClient_GetLastError ());
156160 return ;
157161 }
158- printf (" API_Manage_Task:%d,%s\n " , nCode, ptszMsgBuffer);
162+ _xtprintf (" API_Manage_Task:%d,%s\n " , nCode, ptszMsgBuffer);
159163 BaseLib_OperatorMemory_FreeCStyle ((XPPMEM)&ptszMsgBuffer);
160164}
161165
0 commit comments