Skip to content

Commit 73e9b7f

Browse files
authored
Merge pull request #20 from libxengine/develop
V3.4.0.1001 Merge
2 parents 861f755 + 1941016 commit 73e9b7f

File tree

62 files changed

+1884
-70
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

62 files changed

+1884
-70
lines changed

CHANGELOG

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,21 @@
1+
XEngine_APIService V3.4.0.1001
2+
3+
增加:lua脚本心跳协议支持
4+
增加:短连接和敏感词查询列表支持
5+
增加:机器信息收集协议
6+
修改:允许lua返回的消息大小为0了
7+
修改:数据库支持部启用了
8+
修改:条件编译现在不需要添加额外的命令用于支持linux和macos了
9+
修复:当使用中文字符串插入和其他操作敏感词,日志,邮编数据库的时候不正确的问题
10+
11+
added:lua file heartbeat supported
12+
added:query list support for short link
13+
added:machine information collection protocol support
14+
modify:allow lua to return msg is zero size
15+
modify:database support not enable
16+
modify:The conditional compilation switch does not require additional compilation commands on linux or macos
17+
fixed:when use chinese charset insert or other operator is incorrect for word filter
18+
======================================================================================
119
XEngine_APIService V3.3.0.1001
220

321
增加:行政区域ID转换支持

README.en.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,9 @@ Support privatization deployment, free, safe, open source, controllable
5050
29. Image Process
5151
30. process deamon
5252
31. Region ID Convert
53+
32. Machine Information Collect
54+
33. heartbeat
55+
5356
## install
5457

5558
#### XEngine Evn

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,8 @@ c c++ interface api service
4949
29. 图像处理
5050
30. 进程守护
5151
31. 行政区域ID转换
52+
32. 机器信息收集
53+
33. 心跳处理
5254

5355
## 安装教程
5456

XEngine_APPClient/APPClient_IDExample/APPClient_IDExample.cpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,14 +29,21 @@ int main()
2929
#endif
3030
int nLen = 0;
3131
XCHAR* ptszMsgBuffer = NULL;
32-
LPCXSTR lpszUrl = _X("http://127.0.0.1:5501/api?function=id&params1=511025191101018792&params2=0");
32+
LPCXSTR lpszUrl = _X("http://127.0.0.1:5501/api?function=id&params1=511025198807018792&params2=0");
3333

3434
if (!APIClient_Http_Request(_X("GET"), lpszUrl, NULL, NULL, &ptszMsgBuffer, &nLen))
3535
{
3636
printf("发送投递失败!\n");
3737
return 0;
3838
}
39+
#ifdef _MSC_BUILD
40+
XCHAR tszGBKBuffer[1024] = {};
41+
BaseLib_OperatorCharset_UTFToAnsi(ptszMsgBuffer, tszGBKBuffer, &nLen);
42+
printf("接受到数据,大小:%d,内容:%s\n", nLen, tszGBKBuffer);
43+
#else
3944
printf("接受到数据,大小:%d,内容:%s\n", nLen, ptszMsgBuffer);
45+
#endif
46+
4047
BaseLib_OperatorMemory_FreeCStyle((XPPMEM)&ptszMsgBuffer);
4148

4249
#ifdef _MSC_BUILD

XEngine_APPClient/APPClient_ImageExample/APPClient_ImageExample.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ bool APPClient_ImageExample_GetAttr(LPCXSTR lpszMsgBuffer, int nMsgLen, int* pIn
5858
}
5959
int test_imgzoom()
6060
{
61-
LPCXSTR lpszFileDir = _X("D:\\Image\\*.png");
61+
LPCXSTR lpszFileDir = _X("D:\\Image\\*");
6262

6363
int nListCount = 0;
6464
XCHAR** pptszListFile;
@@ -100,8 +100,6 @@ int test_imgzoom()
100100

101101
BaseLib_OperatorMemory_FreeCStyle((XPPMEM)&ptszMsgBuffer);
102102
}
103-
104-
105103
return 0;
106104
}
107105

Lines changed: 120 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,120 @@
1+
#ifdef _MSC_BUILD
2+
#include <Windows.h>
3+
#include <tchar.h>
4+
#pragma comment(lib,"Ws2_32")
5+
#pragma comment(lib,"jsoncpp")
6+
#pragma comment(lib,"XEngine_BaseLib/XEngine_BaseLib")
7+
#pragma comment(lib,"XEngine_Client/XClient_APIHelp")
8+
#pragma comment(lib,"XEngine_SystemSdk/XEngine_SystemApi")
9+
#endif
10+
#include <stdio.h>
11+
#include <stdlib.h>
12+
#include <string.h>
13+
#include <inttypes.h>
14+
#include <json/json.h>
15+
#include <XEngine_Include/XEngine_CommHdr.h>
16+
#include <XEngine_Include/XEngine_ProtocolHdr.h>
17+
#include <XEngine_Include/XEngine_BaseLib/BaseLib_Define.h>
18+
#include <XEngine_Include/XEngine_BaseLib/BaseLib_Error.h>
19+
#include <XEngine_Include/XEngine_Client/APIClient_Define.h>
20+
#include <XEngine_Include/XEngine_Client/APIClient_Error.h>
21+
#include <XEngine_Include/XEngine_SystemSdk/SystemApi_Define.h>
22+
#include <XEngine_Include/XEngine_SystemSdk/SystemApi_Error.h>
23+
24+
//需要优先配置XEngine
25+
//WINDOWS支持VS2022 x64 debug 编译调试
26+
//g++ -std=c++17 -Wall -g APPClient_MachineExample.cpp -o APPClient_MachineExample.exe -lXEngine_BaseLib -lXClient_APIHelp -lXEngine_SystemApi
27+
28+
29+
int test_insert()
30+
{
31+
int nLen = 0;
32+
int nCode = 0;
33+
LPCXSTR lpszAPIUrl = _X("http://127.0.0.1:5501/api?function=machine&params1=0");
34+
35+
XCHAR tszOSName[128] = {};
36+
XCHAR tszOSVersion[128] = {};
37+
XCHAR tszOSBuild[128] = {};
38+
XCHAR tszComputerName[128] = {};
39+
XLONG nOSArch = 0;
40+
SYSTEMAPI_SERIAL_INFOMATION st_SDKSerial = {};
41+
SystemApi_System_GetSystemVer(tszOSName, tszOSVersion, tszOSBuild, &nOSArch);
42+
SystemApi_System_GetSysName(NULL, tszComputerName);
43+
SystemApi_HardWare_GetSerial(&st_SDKSerial);
44+
45+
Json::Value st_JsonRoot;
46+
Json::StreamWriterBuilder st_JsonBuilder;
47+
st_JsonRoot["tszMachineName"] = tszOSName;
48+
st_JsonRoot["tszMachineCode"] = st_SDKSerial.tszSystemSerial;
49+
st_JsonRoot["tszMachineSystem"] = tszComputerName;
50+
51+
st_JsonBuilder["emitUTF8"] = true;
52+
53+
XCHAR* ptszMsgBuffer = NULL;
54+
if (!APIClient_Http_Request(_X("POST"), lpszAPIUrl, Json::writeString(st_JsonBuilder, st_JsonRoot).c_str(), &nCode, &ptszMsgBuffer, &nLen))
55+
{
56+
printf("发送投递失败!\n");
57+
return 0;
58+
}
59+
printf("接受到数据,大小:%d,内容:%s\n", nLen, ptszMsgBuffer);
60+
BaseLib_OperatorMemory_FreeCStyle((XPPMEM)&ptszMsgBuffer);
61+
62+
return 0;
63+
}
64+
int test_list()
65+
{
66+
int nLen = 0;
67+
int nCode = 0;
68+
LPCXSTR lpszAPIUrl = _X("http://127.0.0.1:5501/api?function=machine&params1=2");
69+
70+
XCHAR* ptszMsgBuffer = NULL;
71+
if (!APIClient_Http_Request(_X("POST"), lpszAPIUrl, NULL, &nCode, &ptszMsgBuffer, &nLen))
72+
{
73+
printf("发送投递失败!\n");
74+
return 0;
75+
}
76+
printf("接受到数据,大小:%d,内容:%s\n", nLen, ptszMsgBuffer);
77+
BaseLib_OperatorMemory_FreeCStyle((XPPMEM)&ptszMsgBuffer);
78+
79+
return 0;
80+
}
81+
int test_delete()
82+
{
83+
int nLen = 0;
84+
int nCode = 0;
85+
LPCXSTR lpszAPIUrl = _X("http://127.0.0.1:5501/api?function=machine&params1=1");
86+
87+
SYSTEMAPI_SERIAL_INFOMATION st_SDKSerial = {};
88+
SystemApi_HardWare_GetSerial(&st_SDKSerial);
89+
90+
Json::Value st_JsonRoot;
91+
st_JsonRoot["tszMachineCode"] = st_SDKSerial.tszSystemSerial;
92+
93+
XCHAR* ptszMsgBuffer = NULL;
94+
if (!APIClient_Http_Request(_X("POST"), lpszAPIUrl, st_JsonRoot.toStyledString().c_str(), &nCode, &ptszMsgBuffer, &nLen))
95+
{
96+
printf("发送投递失败!\n");
97+
return 0;
98+
}
99+
printf("接受到数据,大小:%d,内容:%s\n", nLen, ptszMsgBuffer);
100+
BaseLib_OperatorMemory_FreeCStyle((XPPMEM)&ptszMsgBuffer);
101+
102+
return 0;
103+
}
104+
105+
int main()
106+
{
107+
#ifdef _MSC_BUILD
108+
WSADATA st_WSAData;
109+
WSAStartup(MAKEWORD(2, 2), &st_WSAData);
110+
#endif
111+
test_insert();
112+
test_insert();
113+
test_list();
114+
test_delete();
115+
116+
#ifdef _MSC_BUILD
117+
WSACleanup();
118+
#endif
119+
return 0;
120+
}
Lines changed: 139 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,139 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<ItemGroup Label="ProjectConfigurations">
4+
<ProjectConfiguration Include="Debug|Win32">
5+
<Configuration>Debug</Configuration>
6+
<Platform>Win32</Platform>
7+
</ProjectConfiguration>
8+
<ProjectConfiguration Include="Release|Win32">
9+
<Configuration>Release</Configuration>
10+
<Platform>Win32</Platform>
11+
</ProjectConfiguration>
12+
<ProjectConfiguration Include="Debug|x64">
13+
<Configuration>Debug</Configuration>
14+
<Platform>x64</Platform>
15+
</ProjectConfiguration>
16+
<ProjectConfiguration Include="Release|x64">
17+
<Configuration>Release</Configuration>
18+
<Platform>x64</Platform>
19+
</ProjectConfiguration>
20+
</ItemGroup>
21+
<PropertyGroup Label="Globals">
22+
<VCProjectVersion>17.0</VCProjectVersion>
23+
<Keyword>Win32Proj</Keyword>
24+
<ProjectGuid>{7b5fb530-dbe4-4954-bc02-6c9411825a1d}</ProjectGuid>
25+
<RootNamespace>APPClientMachineExample</RootNamespace>
26+
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
27+
</PropertyGroup>
28+
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
29+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
30+
<ConfigurationType>Application</ConfigurationType>
31+
<UseDebugLibraries>true</UseDebugLibraries>
32+
<PlatformToolset>v143</PlatformToolset>
33+
<CharacterSet>Unicode</CharacterSet>
34+
</PropertyGroup>
35+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
36+
<ConfigurationType>Application</ConfigurationType>
37+
<UseDebugLibraries>false</UseDebugLibraries>
38+
<PlatformToolset>v143</PlatformToolset>
39+
<WholeProgramOptimization>true</WholeProgramOptimization>
40+
<CharacterSet>Unicode</CharacterSet>
41+
</PropertyGroup>
42+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
43+
<ConfigurationType>Application</ConfigurationType>
44+
<UseDebugLibraries>true</UseDebugLibraries>
45+
<PlatformToolset>v143</PlatformToolset>
46+
<CharacterSet>Unicode</CharacterSet>
47+
</PropertyGroup>
48+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
49+
<ConfigurationType>Application</ConfigurationType>
50+
<UseDebugLibraries>false</UseDebugLibraries>
51+
<PlatformToolset>v143</PlatformToolset>
52+
<WholeProgramOptimization>true</WholeProgramOptimization>
53+
<CharacterSet>Unicode</CharacterSet>
54+
</PropertyGroup>
55+
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
56+
<ImportGroup Label="ExtensionSettings">
57+
</ImportGroup>
58+
<ImportGroup Label="Shared">
59+
</ImportGroup>
60+
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
61+
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
62+
</ImportGroup>
63+
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
64+
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
65+
</ImportGroup>
66+
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
67+
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
68+
</ImportGroup>
69+
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
70+
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
71+
</ImportGroup>
72+
<PropertyGroup Label="UserMacros" />
73+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
74+
<IncludePath>$(XEngine_Include);../../XEngine_Source/XEngine_ThirdPart/jsoncpp;$(IncludePath)</IncludePath>
75+
<LibraryPath>$(XEngine_Lib64);../../XEngine_Source/x64/Debug;$(LibraryPath)</LibraryPath>
76+
</PropertyGroup>
77+
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
78+
<ClCompile>
79+
<WarningLevel>Level3</WarningLevel>
80+
<SDLCheck>true</SDLCheck>
81+
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
82+
<ConformanceMode>true</ConformanceMode>
83+
</ClCompile>
84+
<Link>
85+
<SubSystem>Console</SubSystem>
86+
<GenerateDebugInformation>true</GenerateDebugInformation>
87+
</Link>
88+
</ItemDefinitionGroup>
89+
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
90+
<ClCompile>
91+
<WarningLevel>Level3</WarningLevel>
92+
<FunctionLevelLinking>true</FunctionLevelLinking>
93+
<IntrinsicFunctions>true</IntrinsicFunctions>
94+
<SDLCheck>true</SDLCheck>
95+
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
96+
<ConformanceMode>true</ConformanceMode>
97+
</ClCompile>
98+
<Link>
99+
<SubSystem>Console</SubSystem>
100+
<EnableCOMDATFolding>true</EnableCOMDATFolding>
101+
<OptimizeReferences>true</OptimizeReferences>
102+
<GenerateDebugInformation>true</GenerateDebugInformation>
103+
</Link>
104+
</ItemDefinitionGroup>
105+
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
106+
<ClCompile>
107+
<WarningLevel>Level3</WarningLevel>
108+
<SDLCheck>true</SDLCheck>
109+
<PreprocessorDefinitions>_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
110+
<ConformanceMode>true</ConformanceMode>
111+
</ClCompile>
112+
<Link>
113+
<SubSystem>Console</SubSystem>
114+
<GenerateDebugInformation>true</GenerateDebugInformation>
115+
</Link>
116+
</ItemDefinitionGroup>
117+
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
118+
<ClCompile>
119+
<WarningLevel>Level3</WarningLevel>
120+
<FunctionLevelLinking>true</FunctionLevelLinking>
121+
<IntrinsicFunctions>true</IntrinsicFunctions>
122+
<SDLCheck>true</SDLCheck>
123+
<PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
124+
<ConformanceMode>true</ConformanceMode>
125+
</ClCompile>
126+
<Link>
127+
<SubSystem>Console</SubSystem>
128+
<EnableCOMDATFolding>true</EnableCOMDATFolding>
129+
<OptimizeReferences>true</OptimizeReferences>
130+
<GenerateDebugInformation>true</GenerateDebugInformation>
131+
</Link>
132+
</ItemDefinitionGroup>
133+
<ItemGroup>
134+
<ClCompile Include="APPClient_MachineExample.cpp" />
135+
</ItemGroup>
136+
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
137+
<ImportGroup Label="ExtensionTargets">
138+
</ImportGroup>
139+
</Project>
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<ItemGroup>
4+
<Filter Include="源文件">
5+
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
6+
<Extensions>cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
7+
</Filter>
8+
<Filter Include="头文件">
9+
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
10+
<Extensions>h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd</Extensions>
11+
</Filter>
12+
<Filter Include="资源文件">
13+
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
14+
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
15+
</Filter>
16+
</ItemGroup>
17+
<ItemGroup>
18+
<ClCompile Include="APPClient_MachineExample.cpp">
19+
<Filter>源文件</Filter>
20+
</ClCompile>
21+
</ItemGroup>
22+
</Project>
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<PropertyGroup />
4+
</Project>

0 commit comments

Comments
 (0)