Skip to content

Commit 5ca3180

Browse files
authored
Merge pull request #11 from libxengine/develop
V2.8.0.1001 Merge
2 parents fcb765c + 97462e7 commit 5ca3180

File tree

60 files changed

+5730
-207
lines changed

Some content is hidden

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

60 files changed

+5730
-207
lines changed

CHANGELOG

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,15 @@
1+
XEngine_APIService V2.8.0.1001
2+
3+
添加:二维码识别与创建功能
4+
添加:网络测试与数据验证功能
5+
修改:现在错误请求会响应
6+
修正:http请求的日志打印标记不正确
7+
8+
added:qr code parse and create
9+
added:network test
10+
modify:reply failed requestion now
11+
fixed:http request log flag is incorrent
12+
======================================================================================
113
XEngine_APIService V2.7.0.1001
214

315
增加:日志信息操作API相关函数

README.en.md

Lines changed: 24 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,12 @@ Support privatization deployment, free, safe, open source, controllable
3333
13. Administrative zip code
3434
14. Bank card verification
3535
15. Exchange rate calculation (planned)
36-
16. QR code generation and parse (planned)
36+
16. QR code generation and parse
3737
17. Simplified and Traditional Conversion
3838
18. Twenty-four solar terms (planned)
3939
19. Xinhua Dictionary
4040
20. Metering Conversion
41-
21. CDKey Creator
41+
21. network test
4242
22. Distributed lock
4343
23. short url creator(planned)
4444
24. local system time
@@ -64,7 +64,7 @@ MYSQL database version 8.0 or above is required. Create a table through CreateDa
6464
Modify the database configuration in XSQL in the configuration file to your
6565

6666
#### Windows
67-
need to vcpkg configure third-part env.refer vcpkg install guide.after installed and execution:vcpkg.exe install lua lua:x64-windows opencc opencc:x64-windows
67+
need to vcpkg configure third-part env.refer vcpkg install guide.after installed and execution:vcpkg.exe install lua lua:x64-windows opencc opencc:x64-windows opencv[contrib] libqrencode opencv[contrib]:x64-windows libqrencode:x64-windows
6868
use vs open and compile,suport windows 7sp1 and above
6969
Just Run it
7070

@@ -176,29 +176,6 @@ api:http://app.xyry.org:5501/api?function=translation&params1=中国&params2=0
176176
"msg":"success"
177177
}
178178
```
179-
Authorize CDKey
180-
Api:http://app.xyry.org:5501/api?function=cdkey&params1=0
181-
```json
182-
{
183-
"tszAddr":"服务器地址",
184-
"nPort":5000,
185-
"st_AuthAppInfo":{
186-
"tszAppName":"自定义名称",
187-
"tszAppVer":"自定义版本"
188-
},
189-
"st_AuthRegInfo":{
190-
"tszHardware":"硬件吗",
191-
"enSerialType":1,
192-
"enRegType":1,
193-
"enHWType":1
194-
},
195-
"st_AuthUserInfo":{
196-
"tszUserName":"注册的用户名",
197-
"tszUserContact":"联系方式",
198-
"tszCustom":"自定义,可选参数"
199-
}
200-
}
201-
```
202179
Distributed Lock
203180
Api:http://app.xyry.org:5501/api?function=lock&params1=1000154321&params2=1
204181
```json
@@ -210,6 +187,27 @@ Api:http://app.xyry.org:5501/api?function=lock&params1=1000154321&params2=1
210187
"msg":"success"
211188
}
212189
```
190+
ZIPCode
191+
Api:http://app.xyry.org:5501/api?function=zipcode&params1=0
192+
```json
193+
{
194+
"nZipCode":100010
195+
}
196+
```
197+
Log
198+
Api:http://app.xyry.org:5501/api?function=log&params1=1
199+
```json
200+
{
201+
"tszTableName":"xengine",
202+
"tszLogBuffer":"d12d",
203+
"nLogSize":4,
204+
"tszFileName":"file.cpp",
205+
"tszFuncName":"xengine_file_insert",
206+
"tszLogTimer":"2023-01-13 22:10:01",
207+
"nLogLine":102,
208+
"nLogLevel":4
209+
}
210+
```
213211
## Participate in contribution
214212
I hope you will submit more code to participate in the contribution
215213

README.md

Lines changed: 25 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,12 @@ c c++ interface api service
3333
13. 行政邮编
3434
14. 银行卡验证
3535
15. 汇率计算(计划中)
36-
16. 二维码生成解析(计划中)
36+
16. 二维码生成解析
3737
17. 简繁转换
3838
18. 二十四节气(计划中)
3939
19. 新华词典
4040
20. 计量转换
41-
21. CDKey创建支持
41+
21. 网络测试
4242
22. 分布式锁API
4343
23. 短连接生成(计划中)
4444
24. 本地标准时间
@@ -64,12 +64,12 @@ macos执行:./XEngine_LINEnv.sh -i 3
6464
修改配置文件里面XSQL里面的数据库配置为你的
6565

6666
#### Windows
67-
需要vcpkg配置第三方环境,具体参考vcpkg安装方式,安装好后执行:vcpkg.exe install lua lua:x64-windows opencc opencc:x64-windows
67+
需要vcpkg配置第三方环境,具体参考vcpkg安装方式,安装好后执行:vcpkg.exe install lua lua:x64-windows opencc opencc:x64-windows opencv[contrib] libqrencode opencv[contrib]:x64-windows libqrencode:x64-windows
6868
使用VS打开并且编译,支持WINDOWS 7SP1以上系统
6969
直接运行即可
7070

7171
#### Linux
72-
ubuntu:sudo apt install liblua5.3-dev libopencc-dev
72+
ubuntu:sudo apt install liblua5.3-dev libopencc-dev libopencv-dev libopencv-contrib-dev libqrencode-dev
7373
centos:需要自己编译
7474
Linux使用Makefile编译,UBUNTU20.04 x64或者CENTOS8 x64
7575
在控制台运行
@@ -174,29 +174,6 @@ make FLAGS=CleanAll 清理编译
174174
"msg":"success"
175175
}
176176
```
177-
CDKey授权
178-
接口:http://app.xyry.org:5501/api?function=cdkey&params1=0
179-
```json
180-
{
181-
"tszAddr":"服务器地址",
182-
"nPort":5000,
183-
"st_AuthAppInfo":{
184-
"tszAppName":"自定义名称",
185-
"tszAppVer":"自定义版本"
186-
},
187-
"st_AuthRegInfo":{
188-
"tszHardware":"硬件吗",
189-
"enSerialType":1,
190-
"enRegType":1,
191-
"enHWType":1
192-
},
193-
"st_AuthUserInfo":{
194-
"tszUserName":"注册的用户名",
195-
"tszUserContact":"联系方式",
196-
"tszCustom":"自定义,可选参数"
197-
}
198-
}
199-
```
200177
分布式锁
201178
接口:http://app.xyry.org:5501/api?function=lock&params1=1000154321&params2=1
202179
```json
@@ -208,6 +185,27 @@ CDKey授权
208185
"msg":"success"
209186
}
210187
```
188+
行政邮编
189+
接口:http://app.xyry.org:5501/api?function=zipcode&params1=0
190+
```json
191+
{
192+
"nZipCode":100010
193+
}
194+
```
195+
日志操作
196+
接口:http://app.xyry.org:5501/api?function=log&params1=1
197+
```json
198+
{
199+
"tszTableName":"xengine",
200+
"tszLogBuffer":"d12d",
201+
"nLogSize":4,
202+
"tszFileName":"file.cpp",
203+
"tszFuncName":"xengine_file_insert",
204+
"tszLogTimer":"2023-01-13 22:10:01",
205+
"nLogLine":102,
206+
"nLogLevel":4
207+
}
208+
```
211209
## 参与贡献
212210
希望大家多多提交代码参与贡献
213211

XEngine_APPClient/APPClient_CDKeyExample/APPClient_CDKeyExample.cpp

Lines changed: 0 additions & 110 deletions
This file was deleted.
Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
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_NetHelp/NetHelp_APIClient")
8+
#endif
9+
#include <stdio.h>
10+
#include <stdlib.h>
11+
#include <string.h>
12+
#include <inttypes.h>
13+
#include <json/json.h>
14+
#include <XEngine_Include/XEngine_CommHdr.h>
15+
#include <XEngine_Include/XEngine_ProtocolHdr.h>
16+
#include <XEngine_Include/XEngine_BaseLib/BaseLib_Define.h>
17+
#include <XEngine_Include/XEngine_BaseLib/BaseLib_Error.h>
18+
#include <XEngine_Include/XEngine_NetHelp/APIClient_Define.h>
19+
#include <XEngine_Include/XEngine_NetHelp/APIClient_Error.h>
20+
21+
//需要优先配置XEngine
22+
//WINDOWS支持VS2022 x64 debug 编译调试
23+
//linux::g++ -std=c++17 -Wall -g APPClient_QRExample.cpp -o APPClient_QRExample.exe -L /usr/local/lib/XEngine_Release/XEngine_BaseLib -L /usr/local/lib/XEngine_Release/XEngine_NetHelp -lXEngine_BaseLib -lNetHelp_APIClient
24+
//macos::g++ -std=c++17 -Wall -g APPClient_QRExample.cpp -o APPClient_QRExample.exe -lXEngine_BaseLib -lNetHelp_APIClient
25+
26+
#define QRCODE_BUFFER_SIZE 1024 * 1024 * 10
27+
28+
LPCTSTR lpszFileName = _T("D:\\XEngine_APIService\\XEngine_APPClient\\x64\\Debug\\1.png");
29+
30+
int test_create()
31+
{
32+
int nLen = 0;
33+
int nCode = 0;
34+
LPCTSTR lpszAPIUrl = _T("http://127.0.0.1:5501/api?function=qrcode&params1=0");
35+
36+
Json::Value st_JsonRoot;
37+
st_JsonRoot["tszMsgBuffer"] = lpszAPIUrl;
38+
st_JsonRoot["tszFmtBuffer"] = ".png";
39+
40+
TCHAR* ptszMsgBuffer = NULL;
41+
if (!APIClient_Http_Request(_T("POST"), lpszAPIUrl, st_JsonRoot.toStyledString().c_str(), &nCode, &ptszMsgBuffer, &nLen))
42+
{
43+
printf("发送投递失败!\n");
44+
return 0;
45+
}
46+
FILE* pSt_File = fopen(lpszFileName, "wb");
47+
if (NULL != pSt_File)
48+
{
49+
fwrite(ptszMsgBuffer, 1, nLen, pSt_File);
50+
fclose(pSt_File);
51+
}
52+
printf("接受到数据,大小:%d,内容:%s\n", nLen, ptszMsgBuffer);
53+
BaseLib_OperatorMemory_FreeCStyle((XPPMEM)&ptszMsgBuffer);
54+
55+
return 0;
56+
}
57+
int test_parse()
58+
{
59+
int nCode = 0;
60+
TCHAR* ptszMsgBuffer = (TCHAR*)malloc(QRCODE_BUFFER_SIZE);
61+
62+
LPCTSTR lpszAPIUrl = _T("http://127.0.0.1:5501/api?function=qrcode&params1=1");
63+
FILE* pSt_File = fopen(lpszFileName, "rb");
64+
if (NULL != pSt_File)
65+
{
66+
LPCTSTR lpszCustomHdr = _T("Content-Type: image/png\r\n");
67+
memset(ptszMsgBuffer, '\0', QRCODE_BUFFER_SIZE);
68+
int nRet = fread(ptszMsgBuffer, 1, QRCODE_BUFFER_SIZE, pSt_File);
69+
70+
TCHAR* ptszBodyBuffer = NULL;
71+
if (!APIClient_Http_Request(_T("POST"), lpszAPIUrl, ptszMsgBuffer, &nCode, &ptszBodyBuffer, &nRet, lpszCustomHdr))
72+
{
73+
printf("发送投递失败!\n");
74+
return 0;
75+
}
76+
printf("接受到数据,大小:%d,内容:%s\n", nRet, ptszBodyBuffer);
77+
BaseLib_OperatorMemory_FreeCStyle((XPPMEM)&ptszBodyBuffer);
78+
}
79+
return 0;
80+
}
81+
82+
int main()
83+
{
84+
#ifdef _MSC_BUILD
85+
WSADATA st_WSAData;
86+
WSAStartup(MAKEWORD(2, 2), &st_WSAData);
87+
#endif
88+
test_create();
89+
test_parse();
90+
91+
#ifdef _MSC_BUILD
92+
WSACleanup();
93+
#endif
94+
return 0;
95+
}

0 commit comments

Comments
 (0)