diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml new file mode 100644 index 0000000..6e30ff1 --- /dev/null +++ b/.github/workflows/codeql.yml @@ -0,0 +1,68 @@ +name: CodeQL Advanced + +on: + push: + branches: + - 'develop' + paths: + - 'XEngine_Source/**' + - 'XEngine_Release/**' + - '.github/**' + +jobs: + analyze: + runs-on: ubuntu-24.04 + permissions: + security-events: write + packages: read + actions: read + contents: read + + strategy: + fail-fast: false + matrix: + include: + - language: c-cpp + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + ref: 'develop' + + - name: Checkout dependency repository (xengine) + uses: actions/checkout@v4 + with: + repository: libxengine/libxengine + path: libxengine + + - name: sub module checkout (opensource) + run: | + git submodule init + git submodule update + + - name: install library + run: | + sudo apt update -y + sudo apt upgrade -y + sudo apt install liblua5.4-dev libopencv-dev libopencv-contrib-dev libqrencode-dev libleptonica-dev libtesseract-dev -y + + - name: Set up Dependency Environment + run: | + cd libxengine + chmod +x ./XEngine_LINEnv.sh + sudo ./XEngine_LINEnv.sh -i 3 + + - name: Initialize CodeQL + uses: github/codeql-action/init@v3 + with: + languages: ${{ matrix.language }} + + - name: make + run: | + cd XEngine_Source + make + + - name: Perform CodeQL Analysis + uses: github/codeql-action/analyze@v3 + with: + category: "/language:${{ matrix.language }}" diff --git a/.github/workflows/cppcheck.yml b/.github/workflows/cppcheck.yml new file mode 100644 index 0000000..279b03f --- /dev/null +++ b/.github/workflows/cppcheck.yml @@ -0,0 +1,35 @@ +name: cpp check workflows + +on: + push: + branches: + - 'develop' + paths: + - 'XEngine_Source/**' + - 'XEngine_Release/**' + - '.github/**' + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - name: Checkout main repository code + uses: actions/checkout@v4 + with: + ref: 'develop' + + - name: Create static_analysis directory + run: mkdir -p static_analysis + + - name: Run Cppcheck + run: | + sudo apt-get install -y cppcheck + cppcheck --enable=all --language=c++ --std=c++20 ./XEngine_Source/ --output-file=static_analysis/log.xml --xml + continue-on-error: true + + - name: Upload Cppcheck Results + uses: actions/upload-artifact@v4 + with: + name: cppcheck_results + path: static_analysis/log.xml \ No newline at end of file diff --git a/.github/workflows/macbuild.yml b/.github/workflows/macbuild.yml index 860d1e8..aec8b17 100644 --- a/.github/workflows/macbuild.yml +++ b/.github/workflows/macbuild.yml @@ -2,15 +2,13 @@ name: macos build workflows on: push: - branches: [ "develop" ] + branches: + - 'develop' paths: - 'XEngine_Source/**' - 'XEngine_Release/**' - '.github/**' -permissions: - contents: read - jobs: build: strategy: @@ -89,9 +87,11 @@ jobs: with: name: XEngine_APIServiceApp-x86_64-Mac path: XEngine_Release/ + retention-days: 1 - name: Upload folder as artifact with mac arm if: matrix.os == 'macos-14' uses: actions/upload-artifact@v4 with: name: XEngine_APIServiceApp-Arm64-Mac - path: XEngine_Release/ \ No newline at end of file + path: XEngine_Release/ + retention-days: 1 \ No newline at end of file diff --git a/.github/workflows/msbuild.yml b/.github/workflows/msbuild.yml index cd5c468..e4e6e42 100644 --- a/.github/workflows/msbuild.yml +++ b/.github/workflows/msbuild.yml @@ -2,14 +2,13 @@ name: windows build workflows on: push: - branches: [ "develop" ] + branches: + - 'develop' paths: - 'XEngine_Source/**' - 'XEngine_Release/**' - '.github/**' -permissions: - contents: read jobs: build: @@ -121,6 +120,7 @@ jobs: with: name: XEngine_APIServiceApp-x86_32-Windows path: XEngine_Release/ + retention-days: 1 - name: Upload folder as artifact with x64 if: matrix.configuration == 'Release' && matrix.platform == 'x64' @@ -128,3 +128,4 @@ jobs: with: name: XEngine_APIServiceApp-x86_64-Windows path: XEngine_Release/ + retention-days: 1 diff --git a/.github/workflows/ubuntubuild.yml b/.github/workflows/ubuntubuild.yml index 4b5fd4e..773a770 100644 --- a/.github/workflows/ubuntubuild.yml +++ b/.github/workflows/ubuntubuild.yml @@ -2,14 +2,13 @@ name: ubuntu build workflows on: push: - branches: [ "develop" ] + branches: + - 'develop' paths: - 'XEngine_Source/**' - 'XEngine_Release/**' - '.github/**' -permissions: - contents: read jobs: build: @@ -92,9 +91,12 @@ jobs: with: name: XEngine_APIServiceApp-x86_64-Ubuntu-22.04 path: XEngine_Release/ + retention-days: 1 + - name: Upload folder as artifact with ubuntu24.04 if: matrix.os == 'ubuntu-24.04' uses: actions/upload-artifact@v4 with: name: XEngine_APIServiceApp-x86_64-Ubuntu-24.04 - path: XEngine_Release/ \ No newline at end of file + path: XEngine_Release/ + retention-days: 1 \ No newline at end of file diff --git a/CHANGELOG b/CHANGELOG index 1768e83..5af41fd 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,33 @@ +XEngine_APIService V3.9.0.1001 + +增加:设置日志类型配置支持 +更新:依赖库 +更新:makefile的g++ +更新:配置增加模型文件 +修改:报告次数现在直接在发送的时候获取了 +修改:守护进程新的重试次数参数支持 +修改:支持其他语言系统 +修改:油价查询实现通过http api了 +修正:编译问题 +修正:启用和禁用图像处理不正确的问题 +修正:密码插件不工作的问题 +修正:天气查询问题 +删除:守护功能启动程序失败不在重试 + +added:set log type support +update:depend library +update:make file g++ version +update:configure file and add model file +modify:reply time count when send report for machine protocol +modify:new parameter re-number support for deamon +modify:other language system supported +modify:imp oil price query thought http api +fixed:build problem +fixed:enable or disable handle failed for image +fixed:lib module password not work +fixed:weather query is incorrect +delete:not retry when start process failed +====================================================================================== XEngine_APIService V3.8.0.1001 增加:OCR图片文本支持 diff --git a/README.en.md b/README.en.md index 78b85a8..eae15b9 100644 --- a/README.en.md +++ b/README.en.md @@ -87,13 +87,13 @@ git submodule init git submodule update #### Linux -ubuntu:sudo apt install sudo apt install liblua5.4-dev libopencv-dev libopencv-contrib-dev libqrencode-dev +ubuntu:sudo apt install sudo apt install liblua5.4-dev libopencv-dev libopencv-contrib-dev libqrencode-dev libleptonica-dev libtesseract-dev centos:compile by self use makefile compile,UBUNTU24.04 x64 or RockyLinux 9 x64 Run it on the terminal #### Macos -install opencc:brew install lua opencv qrencode +install environment:brew install lua opencv qrencode leptonica tesseract use makefile compile,mac 13 and above Run it on the terminal diff --git a/README.md b/README.md index 56d119a..8d6aed8 100644 --- a/README.md +++ b/README.md @@ -94,13 +94,13 @@ git clone https://gitee.com/xengine/XEngine_PhoneData.git XEngine_Source/XEngine 直接运行即可 #### Linux -ubuntu:sudo apt install liblua5.4-dev libopencv-dev libopencv-contrib-dev libqrencode-dev +ubuntu:sudo apt install liblua5.4-dev libopencv-dev libopencv-contrib-dev libqrencode-dev libleptonica-dev libtesseract-dev centos:需要自己编译 Linux使用Makefile编译,UBUNTU24.04 x64或者RockyLinux 9 x64 在控制台运行 #### Macos -安装opencc,执行命令:brew install lua opencv qrencode +安装环境,执行命令:brew install lua opencv qrencode leptonica tesseract 使用makefile编译,控制台运行,需要mac 13以及以上版本 在控制台运行 diff --git a/XEngine_APPClient/APPClient_APIQueryExample/APPClient_APIQueryExample.cpp b/XEngine_APPClient/APPClient_APIQueryExample/APPClient_APIQueryExample.cpp new file mode 100644 index 0000000..fd9ce3b --- /dev/null +++ b/XEngine_APPClient/APPClient_APIQueryExample/APPClient_APIQueryExample.cpp @@ -0,0 +1,70 @@ +#ifdef _MSC_BUILD +#include +#include +#pragma comment(lib,"Ws2_32") +#pragma comment(lib,"jsoncpp") +#pragma comment(lib,"XEngine_BaseLib/XEngine_BaseLib") +#pragma comment(lib,"XEngine_Client/XClient_APIHelp") +#endif +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +//需要优先配置XEngine +//WINDOWS支持VS2022 x64 debug 编译调试 +//g++ -std=c++17 -Wall -g APPClient_APIQueryExample.cpp -o APPClient_APIQueryExample.exe -I ../../XEngine_Source/XEngine_Depend/XEngine_Module/jsoncpp -L ../../XEngine_Release -lXEngine_BaseLib -lXClient_APIHelp -ljsoncpp -Wl,-rpath=../../XEngine_Release + +int main() +{ +#ifdef _MSC_BUILD + WSADATA st_WSAData; + WSAStartup(MAKEWORD(2, 2), &st_WSAData); +#endif + int nLen = 0; + int nCode = 0; + XCHAR tszMsgBuffer[1024]; + LPCXSTR lpszTypeOne = _X("http://127.0.0.1:5501/api?function=ip¶m=117.172.221.14"); + memset(tszMsgBuffer, '\0', sizeof(tszMsgBuffer)); + XCHAR* ptszMsgBuffer = NULL; + if (!APIClient_Http_Request(_X("GET"), lpszTypeOne, NULL, &nCode, &ptszMsgBuffer, &nLen)) + { + printf("发送投递失败!\n"); + return 0; + } +#ifdef _MSC_BUILD + BaseLib_Charset_UTFToAnsi(ptszMsgBuffer, tszMsgBuffer, &nLen); + printf("接受到数据,大小:%d,内容:%s\n", nLen, tszMsgBuffer); +#else + printf("接受到数据,大小:%d,内容:%s\n", nLen, ptszMsgBuffer); +#endif + BaseLib_Memory_FreeCStyle((XPPMEM)&ptszMsgBuffer); + ////////////////////////////////////////////////////////////////////////// + nLen = 0; + nCode = 0; + LPCXSTR lpszTypeZ = _X("http://127.0.0.1:5501/api?function=mac¶m=00:00:0C"); + memset(tszMsgBuffer, '\0', sizeof(tszMsgBuffer)); + if (!APIClient_Http_Request(_X("GET"), lpszTypeZ, NULL, &nCode, &ptszMsgBuffer, &nLen)) + { + printf("发送投递失败!\n"); + return 0; + } +#ifdef _MSC_BUILD + BaseLib_Charset_UTFToAnsi(ptszMsgBuffer, tszMsgBuffer, &nLen); + printf("接受到数据,大小:%d,内容:%s\n", nLen, tszMsgBuffer); +#else + printf("接受到数据,大小:%d,内容:%s\n", nLen, ptszMsgBuffer); +#endif + BaseLib_Memory_FreeCStyle((XPPMEM)&ptszMsgBuffer); +#ifdef _MSC_BUILD + WSACleanup(); +#endif + return 0; +} \ No newline at end of file diff --git a/XEngine_APPClient/APPClient_LanguageExample/APPClient_LanguageExample.vcxproj b/XEngine_APPClient/APPClient_APIQueryExample/APPClient_APIQueryExample.vcxproj similarity index 89% rename from XEngine_APPClient/APPClient_LanguageExample/APPClient_LanguageExample.vcxproj rename to XEngine_APPClient/APPClient_APIQueryExample/APPClient_APIQueryExample.vcxproj index 64f3d70..9032c4f 100644 --- a/XEngine_APPClient/APPClient_LanguageExample/APPClient_LanguageExample.vcxproj +++ b/XEngine_APPClient/APPClient_APIQueryExample/APPClient_APIQueryExample.vcxproj @@ -19,10 +19,10 @@ - 16.0 + 17.0 Win32Proj - {1b028466-937d-4d6c-a7ed-a0bd5c312878} - APPClientLanguageExample + {58ebbc6b-e384-4f7a-ae1c-99f5fbfd63ac} + APPClientAPIQueryExample 10.0 @@ -43,7 +43,7 @@ Application true v143 - MultiByte + Unicode Application @@ -71,18 +71,12 @@ - true - - - false + $(XEngine_Include);../../XEngine_Source/XEngine_Depend/XEngine_Module/jsoncpp;$(IncludePath) + $(XEngine_Lib32);../../XEngine_Source/Debug;$(LibraryPath) - true - $(XEngine_Include);$(IncludePath) - $(XEngine_Lib64);$(LibraryPath) - - - false + $(XEngine_Include);../../XEngine_Source/XEngine_Depend/XEngine_Module/jsoncpp;$(IncludePath) + $(XEngine_Lib64);../../XEngine_Source/x64/Debug;$(LibraryPath) @@ -141,7 +135,7 @@ - + diff --git a/XEngine_APPClient/APPClient_LanguageExample/APPClient_LanguageExample.vcxproj.filters b/XEngine_APPClient/APPClient_APIQueryExample/APPClient_APIQueryExample.vcxproj.filters similarity index 94% rename from XEngine_APPClient/APPClient_LanguageExample/APPClient_LanguageExample.vcxproj.filters rename to XEngine_APPClient/APPClient_APIQueryExample/APPClient_APIQueryExample.vcxproj.filters index 2697f12..ee690c8 100644 --- a/XEngine_APPClient/APPClient_LanguageExample/APPClient_LanguageExample.vcxproj.filters +++ b/XEngine_APPClient/APPClient_APIQueryExample/APPClient_APIQueryExample.vcxproj.filters @@ -15,7 +15,7 @@ - + 源文件 diff --git a/XEngine_APPClient/APPClient_LanguageExample/APPClient_LanguageExample.vcxproj.user b/XEngine_APPClient/APPClient_APIQueryExample/APPClient_APIQueryExample.vcxproj.user similarity index 100% rename from XEngine_APPClient/APPClient_LanguageExample/APPClient_LanguageExample.vcxproj.user rename to XEngine_APPClient/APPClient_APIQueryExample/APPClient_APIQueryExample.vcxproj.user diff --git a/XEngine_APPClient/APPClient_BackExample/APPClient_BackExample.cpp b/XEngine_APPClient/APPClient_BackExample/APPClient_BackExample.cpp index 228e4f9..3af5c95 100644 --- a/XEngine_APPClient/APPClient_BackExample/APPClient_BackExample.cpp +++ b/XEngine_APPClient/APPClient_BackExample/APPClient_BackExample.cpp @@ -32,7 +32,7 @@ int test_query() XCHAR* ptszMsgBuffer = NULL; Json::Value st_JsonRoot; - st_JsonRoot["tszSrcBuffer"] = "D:\\XEngine_APIService\\XEngine_Release\\*"; + st_JsonRoot["tszSrcBuffer"] = "D:\\XEngine_APIService\\XEngine_Release\\"; if (!APIClient_Http_Request(_X("POST"), lpszAPIUrl, st_JsonRoot.toStyledString().c_str(), &nCode, &ptszMsgBuffer, &nLen)) { diff --git a/XEngine_APPClient/APPClient_BackExample/APPClient_BackExample.vcxproj b/XEngine_APPClient/APPClient_BackExample/APPClient_BackExample.vcxproj index a2eba31..fa2fe77 100644 --- a/XEngine_APPClient/APPClient_BackExample/APPClient_BackExample.vcxproj +++ b/XEngine_APPClient/APPClient_BackExample/APPClient_BackExample.vcxproj @@ -74,6 +74,10 @@ $(XEngine_Include);../../XEngine_Source/XEngine_Depend/XEngine_Module/jsoncpp;$(IncludePath) $(XEngine_Lib64);../../XEngine_Source/x64/Debug;$(LibraryPath) + + $(XEngine_Include);../../XEngine_Source/XEngine_Depend/XEngine_Module/jsoncpp;$(IncludePath) + $(XEngine_Lib32);../../XEngine_Source/Debug;$(LibraryPath) + Level3 diff --git a/XEngine_APPClient/APPClient_BankExample/APPClient_BankExample.vcxproj b/XEngine_APPClient/APPClient_BankExample/APPClient_BankExample.vcxproj index 189f8c2..a55366d 100644 --- a/XEngine_APPClient/APPClient_BankExample/APPClient_BankExample.vcxproj +++ b/XEngine_APPClient/APPClient_BankExample/APPClient_BankExample.vcxproj @@ -72,6 +72,8 @@ true + $(XEngine_Include);../../XEngine_Source/XEngine_Depend/XEngine_Module/jsoncpp;$(IncludePath) + $(XEngine_Lib32);../../XEngine_Source/Debug;$(LibraryPath) false diff --git a/XEngine_APPClient/APPClient_DTestExample/APPClient_DTestExample.vcxproj b/XEngine_APPClient/APPClient_DTestExample/APPClient_DTestExample.vcxproj index 9142727..cca8621 100644 --- a/XEngine_APPClient/APPClient_DTestExample/APPClient_DTestExample.vcxproj +++ b/XEngine_APPClient/APPClient_DTestExample/APPClient_DTestExample.vcxproj @@ -74,6 +74,10 @@ $(XEngine_Include);$(IncludePath) $(XEngine_Lib64);$(LibraryPath) + + $(XEngine_Include);../../XEngine_Source/XEngine_Depend/XEngine_Module/jsoncpp;$(IncludePath) + $(XEngine_Lib32);../../XEngine_Source/Debug;$(LibraryPath) + Level3 diff --git a/XEngine_APPClient/APPClient_DeamonExample/APPClient_DeamonExample.cpp b/XEngine_APPClient/APPClient_DeamonExample/APPClient_DeamonExample.cpp index 2cd417d..c4eb69e 100644 --- a/XEngine_APPClient/APPClient_DeamonExample/APPClient_DeamonExample.cpp +++ b/XEngine_APPClient/APPClient_DeamonExample/APPClient_DeamonExample.cpp @@ -33,7 +33,8 @@ int test_insert() Json::Value st_JsonRoot; st_JsonRoot["bEnable"] = true; - st_JsonRoot["nRetime"] = 3; + st_JsonRoot["nRetime"] = 0; + st_JsonRoot["nReNumber"] = 3; st_JsonRoot["tszAPPName"] = "Fairdell_HexCmp2.exe"; st_JsonRoot["tszAPPPath"] = "D:\\"; diff --git a/XEngine_APPClient/APPClient_DeamonExample/APPClient_DeamonExample.vcxproj b/XEngine_APPClient/APPClient_DeamonExample/APPClient_DeamonExample.vcxproj index 549fb15..e8926ec 100644 --- a/XEngine_APPClient/APPClient_DeamonExample/APPClient_DeamonExample.vcxproj +++ b/XEngine_APPClient/APPClient_DeamonExample/APPClient_DeamonExample.vcxproj @@ -74,6 +74,10 @@ $(XEngine_Include);../../XEngine_Source/XEngine_Depend/XEngine_Module/jsoncpp;$(IncludePath) $(XEngine_Lib64);../../XEngine_Source/x64/Debug;$(LibraryPath) + + $(XEngine_Include);../../XEngine_Source/XEngine_Depend/XEngine_Module/jsoncpp;$(IncludePath) + $(XEngine_Lib32);../../XEngine_Source/Debug;$(LibraryPath) + Level3 diff --git a/XEngine_APPClient/APPClient_IDExample/APPClient_IDExample.cpp b/XEngine_APPClient/APPClient_IDExample/APPClient_IDExample.cpp index b1c0c63..3a3be49 100644 --- a/XEngine_APPClient/APPClient_IDExample/APPClient_IDExample.cpp +++ b/XEngine_APPClient/APPClient_IDExample/APPClient_IDExample.cpp @@ -29,7 +29,7 @@ int main() #endif int nLen = 0; XCHAR* ptszMsgBuffer = NULL; - LPCXSTR lpszUrl = _X("http://127.0.0.1:5501/api?function=id¶ms1=511025198807018792¶ms2=0"); + LPCXSTR lpszUrl = _X("http://127.0.0.1:5501/api?function=id¶ms1=511000191107018112¶ms2=0"); if (!APIClient_Http_Request(_X("GET"), lpszUrl, NULL, NULL, &ptszMsgBuffer, &nLen)) { diff --git a/XEngine_APPClient/APPClient_IDExample/APPClient_IDExample.vcxproj b/XEngine_APPClient/APPClient_IDExample/APPClient_IDExample.vcxproj index e589072..893c656 100644 --- a/XEngine_APPClient/APPClient_IDExample/APPClient_IDExample.vcxproj +++ b/XEngine_APPClient/APPClient_IDExample/APPClient_IDExample.vcxproj @@ -72,6 +72,8 @@ true + $(XEngine_Include);../../XEngine_Source/XEngine_Depend/XEngine_Module/jsoncpp;$(IncludePath) + $(XEngine_Lib32);../../XEngine_Source/Debug;$(LibraryPath) false diff --git a/XEngine_APPClient/APPClient_IPExample/APPClient_IPExample.vcxproj b/XEngine_APPClient/APPClient_IPExample/APPClient_IPExample.vcxproj index a1ab432..c6401d8 100644 --- a/XEngine_APPClient/APPClient_IPExample/APPClient_IPExample.vcxproj +++ b/XEngine_APPClient/APPClient_IPExample/APPClient_IPExample.vcxproj @@ -72,6 +72,8 @@ true + $(XEngine_Include);../../XEngine_Source/XEngine_Depend/XEngine_Module/jsoncpp;$(IncludePath) + $(XEngine_Lib32);../../XEngine_Source/Debug;$(LibraryPath) false diff --git a/XEngine_APPClient/APPClient_ImageExample/APPClient_ImageExample.cpp b/XEngine_APPClient/APPClient_ImageExample/APPClient_ImageExample.cpp index 787b714..df7fe83 100644 --- a/XEngine_APPClient/APPClient_ImageExample/APPClient_ImageExample.cpp +++ b/XEngine_APPClient/APPClient_ImageExample/APPClient_ImageExample.cpp @@ -4,6 +4,7 @@ #pragma comment(lib,"Ws2_32") #pragma comment(lib,"jsoncpp") #pragma comment(lib,"XEngine_BaseLib/XEngine_BaseLib") +#pragma comment(lib,"XEngine_BaseLib/XEngine_BaseSafe") #pragma comment(lib,"XEngine_Client/XClient_APIHelp") #pragma comment(lib,"XEngine_SystemSdk/XEngine_SystemApi") #endif @@ -17,6 +18,8 @@ #include #include #include +#include +#include #include #include #include @@ -25,13 +28,13 @@ //需要优先配置XEngine //WINDOWS支持VS2022 x64 debug 编译调试 -//g++ -std=c++17 -Wall -g APPClient_ImageExample.cpp -o APPClient_ImageExample.exe -I ../../XEngine_Source/XEngine_Depend/XEngine_Module/jsoncpp -L ../../XEngine_Release -lXEngine_BaseLib -lXClient_APIHelp -ljsoncpp -Wl,-rpath=../../XEngine_Release +//g++ -std=c++17 -Wall -g APPClient_ImageExample.cpp -o APPClient_ImageExample.exe -I ../../XEngine_Source/XEngine_Depend/XEngine_Module/jsoncpp -L ../../XEngine_Release -lXEngine_BaseLib -lXEngine_BaseSafe -lXClient_APIHelp -ljsoncpp -Wl,-rpath=../../XEngine_Release bool APPClient_ImageExample_GetAttr(LPCXSTR lpszMsgBuffer, int nMsgLen, int* pInt_Width, int* pInt_Height) { int nCode = 0; - LPCXSTR lpszAPIUrl = _X("http://127.0.0.1:5501/api?function=image¶ms1=0"); + LPCXSTR lpszAPIUrl = _X("http://127.0.0.1:5501/api?function=image¶ms1=1"); XCHAR* ptszMsgBuffer = NULL; if (!APIClient_Http_Request(_X("POST"), lpszAPIUrl, lpszMsgBuffer, &nCode, &ptszMsgBuffer, &nMsgLen)) @@ -58,12 +61,12 @@ bool APPClient_ImageExample_GetAttr(LPCXSTR lpszMsgBuffer, int nMsgLen, int* pIn } int test_imgzoom() { - LPCXSTR lpszFileDir = _X("D:\\Image\\*"); + LPCXSTR lpszFileDir = _X("D:\\Image\\"); int nListCount = 0; XCHAR** pptszListFile; - SystemApi_File_EnumFile(lpszFileDir, &pptszListFile, &nListCount); + SystemApi_File_EnumFile(lpszFileDir, &pptszListFile, &nListCount, false, 1); for (int i = 0; i < nListCount; i++) { int nCode = 0; @@ -76,8 +79,12 @@ int test_imgzoom() } memset(ptszFileBuffer, '\0', XENGINE_MEMORY_SIZE_MAX); - FILE* pSt_File = _xtfopen(pptszListFile[i], _X("rb")); - int nRet = (int)fread(ptszFileBuffer, 1, XENGINE_MEMORY_SIZE_MAX, pSt_File); + FILE* pSt_File = _xfopen(pptszListFile[i], _X("rb")); + if (NULL == pSt_File) + { + continue; + } + int nRet = fread(ptszFileBuffer, 1, XENGINE_MEMORY_SIZE_MAX, pSt_File); fclose(pSt_File); APPClient_ImageExample_GetAttr(ptszFileBuffer, nRet, &nWidth, &nHeight); @@ -86,7 +93,7 @@ int test_imgzoom() XCHAR tszFileExt[64] = {}; BaseLib_String_GetFileAndPath(pptszListFile[i], NULL, NULL, NULL, tszFileExt); - _xstprintf(tszAPIUrl, _X("http://127.0.0.1:5501/api?function=image&type=1&ext=%s&width=%d&height=%d"), tszFileExt, nWidth / 2, nHeight / 2); + _xstprintf(tszAPIUrl, _X("http://127.0.0.1:5501/api?function=image&type=2&ext=%s&width=%d&height=%d"), tszFileExt, nWidth / 2, nHeight / 2); XCHAR* ptszMsgBuffer = NULL; if (!APIClient_Http_Request(_X("POST"), tszAPIUrl, ptszFileBuffer, &nCode, &ptszMsgBuffer, &nRet)) diff --git a/XEngine_APPClient/APPClient_ImageExample/APPClient_ImageExample.vcxproj b/XEngine_APPClient/APPClient_ImageExample/APPClient_ImageExample.vcxproj index af04fc0..bbe6637 100644 --- a/XEngine_APPClient/APPClient_ImageExample/APPClient_ImageExample.vcxproj +++ b/XEngine_APPClient/APPClient_ImageExample/APPClient_ImageExample.vcxproj @@ -74,11 +74,15 @@ $(XEngine_Include);../../XEngine_Source/XEngine_Depend/XEngine_Module/jsoncpp;$(IncludePath) $(XEngine_Lib64);../../XEngine_Source/x64/Debug;$(LibraryPath) + + $(XEngine_Include);../../XEngine_Source/XEngine_Depend/XEngine_Module/jsoncpp;$(IncludePath) + $(XEngine_Lib32);../../XEngine_Source/Debug;$(LibraryPath) + Level3 true - WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) + WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) true diff --git a/XEngine_APPClient/APPClient_LibPluginExample/APPClient_LibPluginExample.vcxproj b/XEngine_APPClient/APPClient_LibPluginExample/APPClient_LibPluginExample.vcxproj index 895aa6e..da82337 100644 --- a/XEngine_APPClient/APPClient_LibPluginExample/APPClient_LibPluginExample.vcxproj +++ b/XEngine_APPClient/APPClient_LibPluginExample/APPClient_LibPluginExample.vcxproj @@ -74,6 +74,10 @@ $(XEngine_Include);$(IncludePath) $(XEngine_Lib64);$(LibraryPath) + + $(XEngine_Include);../../XEngine_Source/XEngine_Depend/XEngine_Module/jsoncpp;$(IncludePath) + $(XEngine_Lib32);../../XEngine_Source/Debug;$(LibraryPath) + Level3 diff --git a/XEngine_APPClient/APPClient_LockExample/APPClient_LockExample.vcxproj b/XEngine_APPClient/APPClient_LockExample/APPClient_LockExample.vcxproj index 1b45399..81db6d6 100644 --- a/XEngine_APPClient/APPClient_LockExample/APPClient_LockExample.vcxproj +++ b/XEngine_APPClient/APPClient_LockExample/APPClient_LockExample.vcxproj @@ -74,6 +74,10 @@ $(XEngine_Include);$(IncludePath) $(XEngine_Lib64);$(LibraryPath) + + $(XEngine_Include);../../XEngine_Source/XEngine_Depend/XEngine_Module/jsoncpp;$(IncludePath) + $(XEngine_Lib32);../../XEngine_Source/Debug;$(LibraryPath) + Level3 diff --git a/XEngine_APPClient/APPClient_LuaPluginExample/APPClient_LuaPluginExample.cpp b/XEngine_APPClient/APPClient_LuaPluginExample/APPClient_LuaPluginExample.cpp index 1e44cb1..3ef7fab 100644 --- a/XEngine_APPClient/APPClient_LuaPluginExample/APPClient_LuaPluginExample.cpp +++ b/XEngine_APPClient/APPClient_LuaPluginExample/APPClient_LuaPluginExample.cpp @@ -37,7 +37,6 @@ int main() printf("接受到数据,大小:%d,内容:%s\n", nLen, ptszMsgBuffer); BaseLib_Memory_FreeCStyle((XPPMEM)&ptszMsgBuffer); - getchar(); #ifdef _MSC_BUILD WSACleanup(); #endif diff --git a/XEngine_APPClient/APPClient_LuaPluginExample/APPClient_LuaPluginExample.vcxproj b/XEngine_APPClient/APPClient_LuaPluginExample/APPClient_LuaPluginExample.vcxproj index 8e9f21e..3754859 100644 --- a/XEngine_APPClient/APPClient_LuaPluginExample/APPClient_LuaPluginExample.vcxproj +++ b/XEngine_APPClient/APPClient_LuaPluginExample/APPClient_LuaPluginExample.vcxproj @@ -74,6 +74,10 @@ $(XEngine_Include);$(IncludePath) $(XEngine_Lib64);$(LibraryPath) + + $(XEngine_Include);../../XEngine_Source/XEngine_Depend/XEngine_Module/jsoncpp;$(IncludePath) + $(XEngine_Lib32);../../XEngine_Source/Debug;$(LibraryPath) + Level3 diff --git a/XEngine_APPClient/APPClient_MachineExample/APPClient_MachineExample.vcxproj b/XEngine_APPClient/APPClient_MachineExample/APPClient_MachineExample.vcxproj index 51375f4..9cfb213 100644 --- a/XEngine_APPClient/APPClient_MachineExample/APPClient_MachineExample.vcxproj +++ b/XEngine_APPClient/APPClient_MachineExample/APPClient_MachineExample.vcxproj @@ -74,6 +74,10 @@ $(XEngine_Include);../../XEngine_Source/XEngine_Depend/XEngine_Module/jsoncpp;$(IncludePath) $(XEngine_Lib64);../../XEngine_Source/x64/Debug;$(LibraryPath) + + $(XEngine_Include);../../XEngine_Source/XEngine_Depend/XEngine_Module/jsoncpp;$(IncludePath) + $(XEngine_Lib32);../../XEngine_Source/Debug;$(LibraryPath) + Level3 diff --git a/XEngine_APPClient/APPClient_OilQuery/APPClient_OilQuery.cpp b/XEngine_APPClient/APPClient_OilQuery/APPClient_OilQuery.cpp index a90dd6b..4e2cfc5 100644 --- a/XEngine_APPClient/APPClient_OilQuery/APPClient_OilQuery.cpp +++ b/XEngine_APPClient/APPClient_OilQuery/APPClient_OilQuery.cpp @@ -30,7 +30,7 @@ int main() int nLen = 0; XCHAR* ptszMsgBuffer = NULL; //四川 - LPCXSTR lpszUrl = _X("http://127.0.0.1:5501/api?function=oil¶m=%E5%9B%9B%E5%B7%9D"); + LPCXSTR lpszUrl = _X("http://127.0.0.1:5501/api?function=oil¶ms1=%E5%8C%97%E4%BA%AC"); if (!APIClient_Http_Request(_X("GET"), lpszUrl, NULL, NULL, &ptszMsgBuffer, &nLen)) { diff --git a/XEngine_APPClient/APPClient_OilQuery/APPClient_OilQuery.vcxproj b/XEngine_APPClient/APPClient_OilQuery/APPClient_OilQuery.vcxproj index 05caf9c..be43147 100644 --- a/XEngine_APPClient/APPClient_OilQuery/APPClient_OilQuery.vcxproj +++ b/XEngine_APPClient/APPClient_OilQuery/APPClient_OilQuery.vcxproj @@ -74,6 +74,10 @@ $(XEngine_Include);$(IncludePath) $(XEngine_Lib64);$(LibraryPath) + + $(XEngine_Include);../../XEngine_Source/XEngine_Depend/XEngine_Module/jsoncpp;$(IncludePath) + $(XEngine_Lib32);../../XEngine_Source/Debug;$(LibraryPath) + Level3 diff --git a/XEngine_APPClient/APPClient_P2PExample/APPClient_P2PExample.cpp b/XEngine_APPClient/APPClient_P2PExample/APPClient_P2PExample.cpp index 554e0bd..ab2c2e3 100644 --- a/XEngine_APPClient/APPClient_P2PExample/APPClient_P2PExample.cpp +++ b/XEngine_APPClient/APPClient_P2PExample/APPClient_P2PExample.cpp @@ -5,8 +5,12 @@ #pragma comment(lib,"XEngine_Client/XClient_APIHelp") #pragma comment(lib,"XEngine_NetHelp/NetHelp_XSocket") #pragma comment(lib,"Ws2_32") +#ifdef _WIN64 #pragma comment(lib,"../../XEngine_Source/x64/Debug/jsoncpp") #else +#pragma comment(lib,"../../XEngine_Source/Debug/jsoncpp") +#endif +#else #include #include #endif diff --git a/XEngine_APPClient/APPClient_P2PExample/APPClient_P2PExample.vcxproj b/XEngine_APPClient/APPClient_P2PExample/APPClient_P2PExample.vcxproj index e2cb05d..ed3d099 100644 --- a/XEngine_APPClient/APPClient_P2PExample/APPClient_P2PExample.vcxproj +++ b/XEngine_APPClient/APPClient_P2PExample/APPClient_P2PExample.vcxproj @@ -72,17 +72,17 @@ $(XEngine_Include);../../XEngine_Source/XEngine_Depend/XEngine_Module/jsoncpp;$(IncludePath) - $(XEngine_Lib64);$(LibraryPath) + $(XEngine_Lib64);../../XEngine_Source/x64/Debug;$(LibraryPath) - $(XEngine_Include);$(IncludePath) - $(XEngine_Lib32);$(LibraryPath) + $(XEngine_Include);../../XEngine_Source/XEngine_Depend/XEngine_Module/jsoncpp;$(IncludePath) + $(XEngine_Lib32);../../XEngine_Source/Debug;$(LibraryPath) Level3 true - WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) + WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) true diff --git a/XEngine_APPClient/APPClient_PhoneExample/APPClient_PhoneExample.vcxproj b/XEngine_APPClient/APPClient_PhoneExample/APPClient_PhoneExample.vcxproj index 90d4518..3d5ab30 100644 --- a/XEngine_APPClient/APPClient_PhoneExample/APPClient_PhoneExample.vcxproj +++ b/XEngine_APPClient/APPClient_PhoneExample/APPClient_PhoneExample.vcxproj @@ -72,6 +72,8 @@ true + $(XEngine_Include);../../XEngine_Source/XEngine_Depend/XEngine_Module/jsoncpp;$(IncludePath) + $(XEngine_Lib32);../../XEngine_Source/Debug;$(LibraryPath) false diff --git a/XEngine_APPClient/APPClient_QRExample/APPClient_QRExample.vcxproj b/XEngine_APPClient/APPClient_QRExample/APPClient_QRExample.vcxproj index c07cf52..d548966 100644 --- a/XEngine_APPClient/APPClient_QRExample/APPClient_QRExample.vcxproj +++ b/XEngine_APPClient/APPClient_QRExample/APPClient_QRExample.vcxproj @@ -74,11 +74,15 @@ $(XEngine_Include);../../XEngine_Source/XEngine_Depend/XEngine_Module/jsoncpp;$(IncludePath) $(XEngine_Lib64);../../XEngine_Source/x64/Debug;$(LibraryPath) + + $(XEngine_Include);../../XEngine_Source/XEngine_Depend/XEngine_Module/jsoncpp;$(IncludePath) + $(XEngine_Lib32);../../XEngine_Source/Debug;$(LibraryPath) + Level3 true - WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) + WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) true diff --git a/XEngine_APPClient/APPClient_RegionExample/APPClient_RegionExample.cpp b/XEngine_APPClient/APPClient_RegionExample/APPClient_RegionExample.cpp new file mode 100644 index 0000000..8d7eff0 --- /dev/null +++ b/XEngine_APPClient/APPClient_RegionExample/APPClient_RegionExample.cpp @@ -0,0 +1,70 @@ +#ifdef _MSC_BUILD +#include +#include +#pragma comment(lib,"Ws2_32") +#pragma comment(lib,"jsoncpp") +#pragma comment(lib,"XEngine_BaseLib/XEngine_BaseLib") +#pragma comment(lib,"XEngine_Client/XClient_APIHelp") +#endif +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +//需要优先配置XEngine +//WINDOWS支持VS2022 x64 debug 编译调试 +//g++ -std=c++17 -Wall -g APPClient_RegionExample.cpp -o APPClient_RegionExample.exe -I ../../XEngine_Source/XEngine_Depend/XEngine_Module/jsoncpp -L ../../XEngine_Release -lXEngine_BaseLib -lXClient_APIHelp -ljsoncpp -Wl,-rpath=../../XEngine_Release + +int main() +{ +#ifdef _MSC_BUILD + WSADATA st_WSAData; + WSAStartup(MAKEWORD(2, 2), &st_WSAData); +#endif + int nLen = 0; + int nCode = 0; + XCHAR tszMsgBuffer[1024]; + LPCXSTR lpszTypeOne = _X("http://127.0.0.1:5501/api?function=region&type=1¶ms1=%E5%9B%9B%E5%B7%9D%E7%9C%81¶ms=%E6%88%90%E9%83%BD%E5%B8%82¶ms=%E9%BE%99%E6%B3%89%E9%A9%BF%E5%8C%BA"); + memset(tszMsgBuffer, '\0', sizeof(tszMsgBuffer)); + XCHAR* ptszMsgBuffer = NULL; + if (!APIClient_Http_Request(_X("GET"), lpszTypeOne, NULL, &nCode, &ptszMsgBuffer, &nLen)) + { + printf("发送投递失败!\n"); + return 0; + } +#ifdef _MSC_BUILD + BaseLib_Charset_UTFToAnsi(ptszMsgBuffer, tszMsgBuffer, &nLen); + printf("接受到数据,大小:%d,内容:%s\n", nLen, tszMsgBuffer); +#else + printf("接受到数据,大小:%d,内容:%s\n", nLen, ptszMsgBuffer); +#endif + BaseLib_Memory_FreeCStyle((XPPMEM)&ptszMsgBuffer); + ////////////////////////////////////////////////////////////////////////// + nLen = 0; + nCode = 0; + LPCXSTR lpszTypeZ = _X("http://127.0.0.1:5501/api?function=region&type=0¶ms1=510112"); + memset(tszMsgBuffer, '\0', sizeof(tszMsgBuffer)); + if (!APIClient_Http_Request(_X("GET"), lpszTypeZ, NULL, &nCode, &ptszMsgBuffer, &nLen)) + { + printf("发送投递失败!\n"); + return 0; + } +#ifdef _MSC_BUILD + BaseLib_Charset_UTFToAnsi(ptszMsgBuffer, tszMsgBuffer, &nLen); + printf("接受到数据,大小:%d,内容:%s\n", nLen, tszMsgBuffer); +#else + printf("接受到数据,大小:%d,内容:%s\n", nLen, ptszMsgBuffer); +#endif + BaseLib_Memory_FreeCStyle((XPPMEM)&ptszMsgBuffer); +#ifdef _MSC_BUILD + WSACleanup(); +#endif + return 0; +} \ No newline at end of file diff --git a/XEngine_APPClient/APPClient_RegionExample/APPClient_RegionExample.vcxproj b/XEngine_APPClient/APPClient_RegionExample/APPClient_RegionExample.vcxproj new file mode 100644 index 0000000..579dfb5 --- /dev/null +++ b/XEngine_APPClient/APPClient_RegionExample/APPClient_RegionExample.vcxproj @@ -0,0 +1,143 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + Debug + x64 + + + Release + x64 + + + + 17.0 + Win32Proj + {532ffaff-0a8f-40ce-a2a0-b183576aaa5b} + APPClientRegionExample + 10.0 + + + + Application + true + v143 + Unicode + + + Application + false + v143 + true + Unicode + + + Application + true + v143 + Unicode + + + Application + false + v143 + true + Unicode + + + + + + + + + + + + + + + + + + + + + $(XEngine_Include);../../XEngine_Source/XEngine_Depend/XEngine_Module/jsoncpp;$(IncludePath) + $(XEngine_Lib32);../../XEngine_Source/Debug;$(LibraryPath) + + + $(XEngine_Include);../../XEngine_Source/XEngine_Depend/XEngine_Module/jsoncpp;$(IncludePath) + $(XEngine_Lib64);../../XEngine_Source/x64/Debug;$(LibraryPath) + + + + Level3 + true + WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + + + Console + true + + + + + Level3 + true + true + true + WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + + + Console + true + true + true + + + + + Level3 + true + _DEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + + + Console + true + + + + + Level3 + true + true + true + NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + + + Console + true + true + true + + + + + + + + + \ No newline at end of file diff --git a/XEngine_APPClient/APPClient_RegionExample/APPClient_RegionExample.vcxproj.filters b/XEngine_APPClient/APPClient_RegionExample/APPClient_RegionExample.vcxproj.filters new file mode 100644 index 0000000..b029eec --- /dev/null +++ b/XEngine_APPClient/APPClient_RegionExample/APPClient_RegionExample.vcxproj.filters @@ -0,0 +1,22 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms + + + + + 源文件 + + + \ No newline at end of file diff --git a/XEngine_APPClient/APPClient_RegionExample/APPClient_RegionExample.vcxproj.user b/XEngine_APPClient/APPClient_RegionExample/APPClient_RegionExample.vcxproj.user new file mode 100644 index 0000000..88a5509 --- /dev/null +++ b/XEngine_APPClient/APPClient_RegionExample/APPClient_RegionExample.vcxproj.user @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/XEngine_APPClient/APPClient_SLinkExample/APPClient_SLinkExample.vcxproj b/XEngine_APPClient/APPClient_SLinkExample/APPClient_SLinkExample.vcxproj index 4bd66fe..da98f99 100644 --- a/XEngine_APPClient/APPClient_SLinkExample/APPClient_SLinkExample.vcxproj +++ b/XEngine_APPClient/APPClient_SLinkExample/APPClient_SLinkExample.vcxproj @@ -74,6 +74,10 @@ $(XEngine_Include);../../XEngine_Source/XEngine_Depend/XEngine_Module/jsoncpp;$(IncludePath) $(XEngine_Lib64);../../XEngine_Source/x64/Debug;$(LibraryPath) + + $(XEngine_Include);../../XEngine_Source/XEngine_Depend/XEngine_Module/jsoncpp;$(IncludePath) + $(XEngine_Lib32);../../XEngine_Source/Debug;$(LibraryPath) + Level3 diff --git a/XEngine_APPClient/APPClient_SocketExample/APPClient_SocketExample.vcxproj b/XEngine_APPClient/APPClient_SocketExample/APPClient_SocketExample.vcxproj index a46afb0..0a6f780 100644 --- a/XEngine_APPClient/APPClient_SocketExample/APPClient_SocketExample.vcxproj +++ b/XEngine_APPClient/APPClient_SocketExample/APPClient_SocketExample.vcxproj @@ -74,6 +74,10 @@ $(XEngine_Include);../../XEngine_Source/XEngine_Depend/XEngine_Module/jsoncpp;$(IncludePath) $(XEngine_Lib64);../../XEngine_Source/x64/Debug;$(LibraryPath) + + $(XEngine_Include);../../XEngine_Source/XEngine_Depend/XEngine_Module/jsoncpp;$(IncludePath) + $(XEngine_Lib32);../../XEngine_Source/Debug;$(LibraryPath) + Level3 diff --git a/XEngine_APPClient/APPClient_TranslationExample/APPClient_TranslationExample.cpp b/XEngine_APPClient/APPClient_TranslationExample/APPClient_TranslationExample.cpp index 4ea5f67..c9cb876 100644 --- a/XEngine_APPClient/APPClient_TranslationExample/APPClient_TranslationExample.cpp +++ b/XEngine_APPClient/APPClient_TranslationExample/APPClient_TranslationExample.cpp @@ -28,7 +28,7 @@ int main() #endif int nLen = 0; XCHAR* ptszMsgBuffer = NULL; - LPCXSTR lpszUrl = _X("http://127.0.0.1:5501/api?function=translation¶ms1=中国¶ms2=0¶m3=0"); + LPCXSTR lpszUrl = _X("http://127.0.0.1:5501/api?function=translation¶ms1=chinese¶ms2=0¶m3=0"); if (!APIClient_Http_Request(_X("GET"), lpszUrl, NULL, NULL, &ptszMsgBuffer, &nLen)) { diff --git a/XEngine_APPClient/APPClient_TranslationExample/APPClient_TranslationExample.vcxproj b/XEngine_APPClient/APPClient_TranslationExample/APPClient_TranslationExample.vcxproj index 76274fa..b033914 100644 --- a/XEngine_APPClient/APPClient_TranslationExample/APPClient_TranslationExample.vcxproj +++ b/XEngine_APPClient/APPClient_TranslationExample/APPClient_TranslationExample.vcxproj @@ -72,6 +72,8 @@ true + $(XEngine_Include);../../XEngine_Source/XEngine_Depend/XEngine_Module/jsoncpp;$(IncludePath) + $(XEngine_Lib32);../../XEngine_Source/Debug;$(LibraryPath) false diff --git a/XEngine_APPClient/APPClient_LanguageExample/APPClient_LanguageExample.cpp b/XEngine_APPClient/APPClient_WeatherExample/APPClient_WeatherExample.cpp similarity index 58% rename from XEngine_APPClient/APPClient_LanguageExample/APPClient_LanguageExample.cpp rename to XEngine_APPClient/APPClient_WeatherExample/APPClient_WeatherExample.cpp index dc35640..450dea6 100644 --- a/XEngine_APPClient/APPClient_LanguageExample/APPClient_LanguageExample.cpp +++ b/XEngine_APPClient/APPClient_WeatherExample/APPClient_WeatherExample.cpp @@ -2,6 +2,7 @@ #include #include #pragma comment(lib,"Ws2_32") +#pragma comment(lib,"jsoncpp") #pragma comment(lib,"XEngine_BaseLib/XEngine_BaseLib") #pragma comment(lib,"XEngine_Client/XClient_APIHelp") #endif @@ -9,6 +10,7 @@ #include #include #include +#include #include #include #include @@ -18,8 +20,7 @@ //需要优先配置XEngine //WINDOWS支持VS2022 x64 debug 编译调试 -//linux使用下面的命令编译 -//g++ -std=c++17 -Wall -g APPClient_LanguageExample.cpp -o APPClient_LanguageExample.exe -lXEngine_BaseLib -lXClient_APIHelp +//g++ -std=c++17 -Wall -g APPClient_WeatherExample.cpp -o APPClient_WeatherExample.exe -I ../../XEngine_Source/XEngine_Depend/XEngine_Module/jsoncpp -L ../../XEngine_Release -lXEngine_BaseLib -lXClient_APIHelp -ljsoncpp -Wl,-rpath=../../XEngine_Release int main() { @@ -28,15 +29,24 @@ int main() WSAStartup(MAKEWORD(2, 2), &st_WSAData); #endif int nLen = 0; - XCHAR* ptszMsgBuffer = NULL; - LPCXSTR lpszUrl = _X("http://127.0.0.1:5501/api?function=language¶ms1=简体¶ms2=0¶m3=1"); + int nCode = 0; + XCHAR tszMsgBuffer[1024]; + LPCXSTR lpszCreateUrl = _X("http://127.0.0.1:5501/api?function=weather¶ms1=110101"); + + memset(tszMsgBuffer, '\0', sizeof(tszMsgBuffer)); - if (!APIClient_Http_Request(_X("GET"), lpszUrl, NULL, NULL, &ptszMsgBuffer, &nLen)) + XCHAR* ptszMsgBuffer = NULL; + if (!APIClient_Http_Request(_X("GET"), lpszCreateUrl, NULL, &nCode, &ptszMsgBuffer, &nLen)) { printf("发送投递失败!\n"); return 0; } +#ifdef _MSC_BUILD + BaseLib_Charset_UTFToAnsi(ptszMsgBuffer, tszMsgBuffer, &nLen); + printf("接受到数据,大小:%d,内容:%s\n", nLen, tszMsgBuffer); +#else printf("接受到数据,大小:%d,内容:%s\n", nLen, ptszMsgBuffer); +#endif BaseLib_Memory_FreeCStyle((XPPMEM)&ptszMsgBuffer); #ifdef _MSC_BUILD diff --git a/XEngine_APPClient/APPClient_WeatherExample/APPClient_WeatherExample.vcxproj b/XEngine_APPClient/APPClient_WeatherExample/APPClient_WeatherExample.vcxproj new file mode 100644 index 0000000..f143064 --- /dev/null +++ b/XEngine_APPClient/APPClient_WeatherExample/APPClient_WeatherExample.vcxproj @@ -0,0 +1,143 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + Debug + x64 + + + Release + x64 + + + + 17.0 + Win32Proj + {65b65e38-c316-4c64-b164-68f564c9dcf9} + APPClientWeatherExample + 10.0 + + + + Application + true + v143 + Unicode + + + Application + false + v143 + true + Unicode + + + Application + true + v143 + Unicode + + + Application + false + v143 + true + Unicode + + + + + + + + + + + + + + + + + + + + + $(XEngine_Include);../../XEngine_Source/XEngine_Depend/XEngine_Module/jsoncpp;$(IncludePath) + $(XEngine_Lib32);../../XEngine_Source/Debug;$(LibraryPath) + + + $(XEngine_Include);../../XEngine_Source/XEngine_Depend/XEngine_Module/jsoncpp;$(IncludePath) + $(XEngine_Lib64);../../XEngine_Source/x64/Debug;$(LibraryPath) + + + + Level3 + true + WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + + + Console + true + + + + + Level3 + true + true + true + WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + + + Console + true + true + true + + + + + Level3 + true + _DEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + + + Console + true + + + + + Level3 + true + true + true + NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + + + Console + true + true + true + + + + + + + + + \ No newline at end of file diff --git a/XEngine_APPClient/APPClient_WeatherExample/APPClient_WeatherExample.vcxproj.filters b/XEngine_APPClient/APPClient_WeatherExample/APPClient_WeatherExample.vcxproj.filters new file mode 100644 index 0000000..b7982d6 --- /dev/null +++ b/XEngine_APPClient/APPClient_WeatherExample/APPClient_WeatherExample.vcxproj.filters @@ -0,0 +1,22 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms + + + + + 源文件 + + + \ No newline at end of file diff --git a/XEngine_APPClient/APPClient_WeatherExample/APPClient_WeatherExample.vcxproj.user b/XEngine_APPClient/APPClient_WeatherExample/APPClient_WeatherExample.vcxproj.user new file mode 100644 index 0000000..88a5509 --- /dev/null +++ b/XEngine_APPClient/APPClient_WeatherExample/APPClient_WeatherExample.vcxproj.user @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/XEngine_APPClient/APPClient_WordFilter/APPClient_WordFilter.vcxproj b/XEngine_APPClient/APPClient_WordFilter/APPClient_WordFilter.vcxproj index 00605ef..7aafcb6 100644 --- a/XEngine_APPClient/APPClient_WordFilter/APPClient_WordFilter.vcxproj +++ b/XEngine_APPClient/APPClient_WordFilter/APPClient_WordFilter.vcxproj @@ -75,8 +75,8 @@ $(XEngine_Lib64);../../XEngine_Source/x64/Debug;$(LibraryPath) - $(XEngine_Include);../../XEngine_Source/XEngine_ThirdPart/jsoncpp;$(IncludePath) - $(XEngine_Lib32);$(LibraryPath) + $(XEngine_Include);../../XEngine_Source/XEngine_Depend/XEngine_Module/jsoncpp;$(IncludePath) + $(XEngine_Lib32);../../XEngine_Source/Debug;$(LibraryPath) diff --git a/XEngine_APPClient/APPClient_XLogExample/APPClient_XLogExample.cpp b/XEngine_APPClient/APPClient_XLogExample/APPClient_XLogExample.cpp index beaa61b..af391e0 100644 --- a/XEngine_APPClient/APPClient_XLogExample/APPClient_XLogExample.cpp +++ b/XEngine_APPClient/APPClient_XLogExample/APPClient_XLogExample.cpp @@ -12,6 +12,7 @@ #include #include #include +#include #include #include #include @@ -55,7 +56,7 @@ int test_insert() Json::StreamWriterBuilder st_JsonBuilder; st_JsonRoot["tszTableName"] = lpszTableName; st_JsonRoot["tszLogBuffer"] = lpszMsgBuffer; - st_JsonRoot["nLogSize"] = _tcslen(lpszMsgBuffer); + st_JsonRoot["nLogSize"] = _tcsxlen(lpszMsgBuffer); st_JsonRoot["tszFileName"] = "file.cpp"; st_JsonRoot["tszFuncName"] = "xengine_file_insert"; diff --git a/XEngine_APPClient/APPClient_XLogExample/APPClient_XLogExample.vcxproj b/XEngine_APPClient/APPClient_XLogExample/APPClient_XLogExample.vcxproj index 25c5efe..d48e8f9 100644 --- a/XEngine_APPClient/APPClient_XLogExample/APPClient_XLogExample.vcxproj +++ b/XEngine_APPClient/APPClient_XLogExample/APPClient_XLogExample.vcxproj @@ -74,11 +74,15 @@ $(XEngine_Include);../../XEngine_Source/XEngine_Depend/XEngine_Module/jsoncpp;$(IncludePath) $(XEngine_Lib64);../../XEngine_Source/x64/Debug;$(LibraryPath) + + $(XEngine_Include);../../XEngine_Source/XEngine_Depend/XEngine_Module/jsoncpp;$(IncludePath) + $(XEngine_Lib32);../../XEngine_Source/Debug;$(LibraryPath) + Level3 true - WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) + WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) true diff --git a/XEngine_APPClient/APPClient_ZIPCodeExample/APPClient_ZIPCodeExample.vcxproj b/XEngine_APPClient/APPClient_ZIPCodeExample/APPClient_ZIPCodeExample.vcxproj index e557bfc..292515d 100644 --- a/XEngine_APPClient/APPClient_ZIPCodeExample/APPClient_ZIPCodeExample.vcxproj +++ b/XEngine_APPClient/APPClient_ZIPCodeExample/APPClient_ZIPCodeExample.vcxproj @@ -74,6 +74,10 @@ $(XEngine_Include);../../XEngine_Source/XEngine_Depend/XEngine_Module/jsoncpp;$(IncludePath) $(XEngine_Lib64);../../XEngine_Source/x64/Debug;$(LibraryPath) + + $(XEngine_Include);../../XEngine_Source/XEngine_Depend/XEngine_Module/jsoncpp;$(IncludePath) + $(XEngine_Lib32);../../XEngine_Source/Debug;$(LibraryPath) + Level3 diff --git a/XEngine_APPClient/VSCopy-x32.bat b/XEngine_APPClient/VSCopy-x32.bat new file mode 100644 index 0000000..91dabfe --- /dev/null +++ b/XEngine_APPClient/VSCopy-x32.bat @@ -0,0 +1,5 @@ +copy /y "%XEngine_Lib32%\XEngine_BaseLib\XEngine_BaseLib.dll" "./" +copy /y "%XEngine_Lib32%\XEngine_BaseLib\XEngine_BaseSafe.dll" "./" +copy /y "%XEngine_Lib32%\XEngine_Client\XClient_APIHelp.dll" "./" +copy /y "%XEngine_Lib32%\XEngine_NetHelp\NetHelp_XSocket.dll" "./" +copy /y "%XEngine_Lib32%\XEngine_SystemSdk\XEngine_SystemApi.dll" "./" \ No newline at end of file diff --git a/XEngine_APPClient/VSCopy-x64.bat b/XEngine_APPClient/VSCopy-x64.bat index b32c333..cf2762d 100644 --- a/XEngine_APPClient/VSCopy-x64.bat +++ b/XEngine_APPClient/VSCopy-x64.bat @@ -1,3 +1,5 @@ copy /y "%XEngine_Lib64%\XEngine_BaseLib\XEngine_BaseLib.dll" "./" +copy /y "%XEngine_Lib64%\XEngine_BaseLib\XEngine_BaseSafe.dll" "./" copy /y "%XEngine_Lib64%\XEngine_Client\XClient_APIHelp.dll" "./" +copy /y "%XEngine_Lib64%\XEngine_NetHelp\NetHelp_XSocket.dll" "./" copy /y "%XEngine_Lib64%\XEngine_SystemSdk\XEngine_SystemApi.dll" "./" \ No newline at end of file diff --git a/XEngine_APPClient/XEngine_APPClient.sln b/XEngine_APPClient/XEngine_APPClient.sln index da0b293..8ca7a44 100644 --- a/XEngine_APPClient/XEngine_APPClient.sln +++ b/XEngine_APPClient/XEngine_APPClient.sln @@ -11,8 +11,6 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "APPClient_PhoneExample", "A EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "APPClient_BankExample", "APPClient_BankExample\APPClient_BankExample.vcxproj", "{B8D8B3C8-1E09-4762-9B4A-849373CE3FF4}" EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "APPClient_LanguageExample", "APPClient_LanguageExample\APPClient_LanguageExample.vcxproj", "{1B028466-937D-4D6C-A7ED-A0BD5C312878}" -EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "APPClient_TranslationExample", "APPClient_TranslationExample\APPClient_TranslationExample.vcxproj", "{B98E33E1-7128-4E04-A328-70665C01CF34}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "APPClient_P2PExample", "APPClient_P2PExample\APPClient_P2PExample.vcxproj", "{D3C54AFE-44F5-4D2F-B4C6-7B3F9FAED95B}" @@ -47,6 +45,12 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "APPClient_MachineExample", EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "APPClient_OilQuery", "APPClient_OilQuery\APPClient_OilQuery.vcxproj", "{018DE3E3-1B0F-4550-8E7F-518B2F2C1381}" EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "APPClient_WeatherExample", "APPClient_WeatherExample\APPClient_WeatherExample.vcxproj", "{65B65E38-C316-4C64-B164-68F564C9DCF9}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "APPClient_RegionExample", "APPClient_RegionExample\APPClient_RegionExample.vcxproj", "{532FFAFF-0A8F-40CE-A2A0-B183576AAA5B}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "APPClient_APIQueryExample", "APPClient_APIQueryExample\APPClient_APIQueryExample.vcxproj", "{58EBBC6B-E384-4F7A-AE1C-99F5FBFD63AC}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|x64 = Debug|x64 @@ -87,14 +91,6 @@ Global {B8D8B3C8-1E09-4762-9B4A-849373CE3FF4}.Release|x64.Build.0 = Release|x64 {B8D8B3C8-1E09-4762-9B4A-849373CE3FF4}.Release|x86.ActiveCfg = Release|Win32 {B8D8B3C8-1E09-4762-9B4A-849373CE3FF4}.Release|x86.Build.0 = Release|Win32 - {1B028466-937D-4D6C-A7ED-A0BD5C312878}.Debug|x64.ActiveCfg = Debug|x64 - {1B028466-937D-4D6C-A7ED-A0BD5C312878}.Debug|x64.Build.0 = Debug|x64 - {1B028466-937D-4D6C-A7ED-A0BD5C312878}.Debug|x86.ActiveCfg = Debug|Win32 - {1B028466-937D-4D6C-A7ED-A0BD5C312878}.Debug|x86.Build.0 = Debug|Win32 - {1B028466-937D-4D6C-A7ED-A0BD5C312878}.Release|x64.ActiveCfg = Release|x64 - {1B028466-937D-4D6C-A7ED-A0BD5C312878}.Release|x64.Build.0 = Release|x64 - {1B028466-937D-4D6C-A7ED-A0BD5C312878}.Release|x86.ActiveCfg = Release|Win32 - {1B028466-937D-4D6C-A7ED-A0BD5C312878}.Release|x86.Build.0 = Release|Win32 {B98E33E1-7128-4E04-A328-70665C01CF34}.Debug|x64.ActiveCfg = Debug|x64 {B98E33E1-7128-4E04-A328-70665C01CF34}.Debug|x64.Build.0 = Debug|x64 {B98E33E1-7128-4E04-A328-70665C01CF34}.Debug|x86.ActiveCfg = Debug|Win32 @@ -231,6 +227,30 @@ Global {018DE3E3-1B0F-4550-8E7F-518B2F2C1381}.Release|x64.Build.0 = Release|x64 {018DE3E3-1B0F-4550-8E7F-518B2F2C1381}.Release|x86.ActiveCfg = Release|Win32 {018DE3E3-1B0F-4550-8E7F-518B2F2C1381}.Release|x86.Build.0 = Release|Win32 + {65B65E38-C316-4C64-B164-68F564C9DCF9}.Debug|x64.ActiveCfg = Debug|x64 + {65B65E38-C316-4C64-B164-68F564C9DCF9}.Debug|x64.Build.0 = Debug|x64 + {65B65E38-C316-4C64-B164-68F564C9DCF9}.Debug|x86.ActiveCfg = Debug|Win32 + {65B65E38-C316-4C64-B164-68F564C9DCF9}.Debug|x86.Build.0 = Debug|Win32 + {65B65E38-C316-4C64-B164-68F564C9DCF9}.Release|x64.ActiveCfg = Release|x64 + {65B65E38-C316-4C64-B164-68F564C9DCF9}.Release|x64.Build.0 = Release|x64 + {65B65E38-C316-4C64-B164-68F564C9DCF9}.Release|x86.ActiveCfg = Release|Win32 + {65B65E38-C316-4C64-B164-68F564C9DCF9}.Release|x86.Build.0 = Release|Win32 + {532FFAFF-0A8F-40CE-A2A0-B183576AAA5B}.Debug|x64.ActiveCfg = Debug|x64 + {532FFAFF-0A8F-40CE-A2A0-B183576AAA5B}.Debug|x64.Build.0 = Debug|x64 + {532FFAFF-0A8F-40CE-A2A0-B183576AAA5B}.Debug|x86.ActiveCfg = Debug|Win32 + {532FFAFF-0A8F-40CE-A2A0-B183576AAA5B}.Debug|x86.Build.0 = Debug|Win32 + {532FFAFF-0A8F-40CE-A2A0-B183576AAA5B}.Release|x64.ActiveCfg = Release|x64 + {532FFAFF-0A8F-40CE-A2A0-B183576AAA5B}.Release|x64.Build.0 = Release|x64 + {532FFAFF-0A8F-40CE-A2A0-B183576AAA5B}.Release|x86.ActiveCfg = Release|Win32 + {532FFAFF-0A8F-40CE-A2A0-B183576AAA5B}.Release|x86.Build.0 = Release|Win32 + {58EBBC6B-E384-4F7A-AE1C-99F5FBFD63AC}.Debug|x64.ActiveCfg = Debug|x64 + {58EBBC6B-E384-4F7A-AE1C-99F5FBFD63AC}.Debug|x64.Build.0 = Debug|x64 + {58EBBC6B-E384-4F7A-AE1C-99F5FBFD63AC}.Debug|x86.ActiveCfg = Debug|Win32 + {58EBBC6B-E384-4F7A-AE1C-99F5FBFD63AC}.Debug|x86.Build.0 = Debug|Win32 + {58EBBC6B-E384-4F7A-AE1C-99F5FBFD63AC}.Release|x64.ActiveCfg = Release|x64 + {58EBBC6B-E384-4F7A-AE1C-99F5FBFD63AC}.Release|x64.Build.0 = Release|x64 + {58EBBC6B-E384-4F7A-AE1C-99F5FBFD63AC}.Release|x86.ActiveCfg = Release|Win32 + {58EBBC6B-E384-4F7A-AE1C-99F5FBFD63AC}.Release|x86.Build.0 = Release|Win32 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/XEngine_Docment/Docment_en.docx b/XEngine_Docment/Docment_en.docx index 1011bf8..672f913 100644 Binary files a/XEngine_Docment/Docment_en.docx and b/XEngine_Docment/Docment_en.docx differ diff --git a/XEngine_Docment/Docment_zh.docx b/XEngine_Docment/Docment_zh.docx index 9b89f4f..769e456 100644 Binary files a/XEngine_Docment/Docment_zh.docx and b/XEngine_Docment/Docment_zh.docx differ diff --git a/XEngine_Release/XEngine_Config/XEngine_Config.json b/XEngine_Release/XEngine_Config/XEngine_Config.json index c5754d3..6b55fb8 100644 --- a/XEngine_Release/XEngine_Config/XEngine_Config.json +++ b/XEngine_Release/XEngine_Config/XEngine_Config.json @@ -14,14 +14,14 @@ "XTime":{ "nTimeCheck":3, "nHttpTimeOut":5, - "nP2PTimeOut":60, - "nDeamonTime":3 + "nP2PTimeOut":60 }, "XLog":{ "tszLogFile":"./XEngine_Log/XEngine_HttpApp.Log", "MaxSize":1024000, "MaxCount":10, - "LogLeave":17 + "LogLeave":17, + "LogType":32 }, "XSql":{ "bEnable":true, @@ -33,6 +33,7 @@ "XApi":{ "tszWeatherUrl":"https://restapi.amap.com/v3/weather/weatherInfo?city=%s&key=3239fc302d6480ce49973f4d1c59e5d8", "tszBankUrl":"https://ccdcapi.alipay.com/validateAndCacheCardInfo.json?cardNo=%s&cardBinCheck=true", + "tszOilUrl":"https://www.iamwawa.cn/oilprice/api?area=%s", "tszTranslationUrl":"https://fanyi-api.baidu.com/api/trans/vip/translate", "st_TranslationInfo":{ "appid":"20231228001924304", @@ -51,7 +52,7 @@ "tszConfigHTTPCode":"./XEngine_Config/HttpCode.types" }, "XImageText":{ - "bEnable":false, + "bEnable":true, "tszImagePath":"./XEngine_Config/tessdata", "tszImageLanguage":"chi_sim+eng" }, diff --git a/XEngine_Release/XEngine_Config/XEngine_DeamonConfig.json b/XEngine_Release/XEngine_Config/XEngine_DeamonConfig.json index 04a0f2a..65d3f9f 100644 --- a/XEngine_Release/XEngine_Config/XEngine_DeamonConfig.json +++ b/XEngine_Release/XEngine_Config/XEngine_DeamonConfig.json @@ -1,16 +1,18 @@ { - "ListArray":[ - { - "bEnable":false, - "tszAPPName":"RadarVision_APPExample.exe", - "tszAPPPath":"D:\\radar-vision\\RV_Sdk\\RVRelease\\", - "nAPPReTime":5 - }, - { - "bEnable":false, - "tszAPPName":"ifconfig", - "tszAPPPath":"/usr/sbin/", - "nAPPReTime":0 - } - ] -} \ No newline at end of file + "ListArray":[ + { + "bEnable":false, + "tszAPPName":"RadarVision_APPExample.exe", + "tszAPPPath":"D:\\radar-vision\\RV_Sdk\\RVRelease\\", + "nAPPReTime":5, + "nAPPReNumber":0 + }, + { + "bEnable":false, + "tszAPPName":"ifconfig", + "tszAPPPath":"/usr/sbin/", + "nAPPReTime":0, + "nAPPReNumber":0 + } + ] + } \ No newline at end of file diff --git a/XEngine_Release/XEngine_Config/XEngine_VersionConfig.json b/XEngine_Release/XEngine_Config/XEngine_VersionConfig.json index 282944b..ba716eb 100644 --- a/XEngine_Release/XEngine_Config/XEngine_VersionConfig.json +++ b/XEngine_Release/XEngine_Config/XEngine_VersionConfig.json @@ -1,6 +1,7 @@ { "XVer":[ - "3.8.0.1001 Build20241230", + "3.9.0.1001 Build20250224", + "3.8.0.1001 Build20241227", "3.7.0.1001 Build20240927", "3.6.0.1001 Build20240705", "3.5.0.1001 Build20240510", diff --git a/XEngine_Release/XEngine_Config/tessdata/chi_sim.traineddata b/XEngine_Release/XEngine_Config/tessdata/chi_sim.traineddata new file mode 100644 index 0000000..eeb66cf Binary files /dev/null and b/XEngine_Release/XEngine_Config/tessdata/chi_sim.traineddata differ diff --git a/XEngine_Release/XEngine_Config/tessdata/eng.traineddata b/XEngine_Release/XEngine_Config/tessdata/eng.traineddata new file mode 100644 index 0000000..f4744c2 Binary files /dev/null and b/XEngine_Release/XEngine_Config/tessdata/eng.traineddata differ diff --git a/XEngine_Source/XEngine_DBDepend/XEngine_IPMacData b/XEngine_Source/XEngine_DBDepend/XEngine_IPMacData index f06fc84..7a18771 160000 --- a/XEngine_Source/XEngine_DBDepend/XEngine_IPMacData +++ b/XEngine_Source/XEngine_DBDepend/XEngine_IPMacData @@ -1 +1 @@ -Subproject commit f06fc84a8c20e77e7a947ca8dd7eeca059416725 +Subproject commit 7a18771f470eda7f82a65afc360451a0900c3dc6 diff --git a/XEngine_Source/XEngine_DBDepend/XEngine_PhoneData b/XEngine_Source/XEngine_DBDepend/XEngine_PhoneData index f3353b8..130e094 160000 --- a/XEngine_Source/XEngine_DBDepend/XEngine_PhoneData +++ b/XEngine_Source/XEngine_DBDepend/XEngine_PhoneData @@ -1 +1 @@ -Subproject commit f3353b8a2d2ef711be97e1730a88ef8cd11ec06e +Subproject commit 130e0949ab52913140f8fa78d86df5ac3a987aa4 diff --git a/XEngine_Source/XEngine_Depend b/XEngine_Source/XEngine_Depend index 60eac07..d022f0c 160000 --- a/XEngine_Source/XEngine_Depend +++ b/XEngine_Source/XEngine_Depend @@ -1 +1 @@ -Subproject commit 60eac0753192a4a66fc90b561d8fde4e5282e2d9 +Subproject commit d022f0c7d2298275d663543afd33e18243c5f25d diff --git a/XEngine_Source/XEngine_ModuleConfigure/Makefile b/XEngine_Source/XEngine_ModuleConfigure/Makefile index 0fbfcf1..8ef323f 100644 --- a/XEngine_Source/XEngine_ModuleConfigure/Makefile +++ b/XEngine_Source/XEngine_ModuleConfigure/Makefile @@ -1,4 +1,4 @@ -CC = g++ -Wall -std=c++17 -fPIC +CC = g++ -Wall -std=c++20 -fPIC PLATFORM = linux PLATVER = PLATDIR = diff --git a/XEngine_Source/XEngine_ModuleConfigure/ModuleConfig_Define.h b/XEngine_Source/XEngine_ModuleConfigure/ModuleConfig_Define.h index 4084439..bf8d056 100644 --- a/XEngine_Source/XEngine_ModuleConfigure/ModuleConfig_Define.h +++ b/XEngine_Source/XEngine_ModuleConfigure/ModuleConfig_Define.h @@ -33,7 +33,6 @@ typedef struct int nTimeCheck; //检测次数 int nHTTPTimeOut; //HTTP超时时间 int nP2PTimeOut; //P2P客户端超时时间 - int nDeamonTime; //进程守护失败执行次数 }st_XTime; //次数*时间=超时 struct { @@ -41,6 +40,7 @@ typedef struct int nMaxSize; //最大日志大小 int nMaxCount; //最大日志个数 int nLogLeave; //日志等级 + int nLogType; //日志类型 }st_XLog; struct { @@ -55,6 +55,7 @@ typedef struct { XCHAR tszWeatherUrl[MAX_PATH]; //天气接口 XCHAR tszBankUrl[MAX_PATH]; //银行卡验证地址 + XCHAR tszOilUrl[MAX_PATH]; //油价接口 XCHAR tszTranslationUrl[MAX_PATH]; //翻译接口 struct { @@ -158,6 +159,7 @@ typedef struct XCHAR tszAPPName[MAX_PATH]; //应用程序名称 XCHAR tszAPPPath[MAX_PATH]; //应用程序路径 int nReTime; //是否自动重启 + int nReNumber; //自定义 int nErrorTime; __int64x nStartTime; diff --git a/XEngine_Source/XEngine_ModuleConfigure/ModuleConfigure_Json/ModuleConfigure_Json.cpp b/XEngine_Source/XEngine_ModuleConfigure/ModuleConfigure_Json/ModuleConfigure_Json.cpp index 6fd1fa6..7ee9327 100644 --- a/XEngine_Source/XEngine_ModuleConfigure/ModuleConfigure_Json/ModuleConfigure_Json.cpp +++ b/XEngine_Source/XEngine_ModuleConfigure/ModuleConfigure_Json/ModuleConfigure_Json.cpp @@ -100,7 +100,7 @@ bool CModuleConfigure_Json::ModuleConfigure_Json_File(LPCXSTR lpszConfigFile, XE pSt_ServerConfig->st_XMax.nIOThread = st_JsonXMax["nIOThread"].asInt(); pSt_ServerConfig->st_XMax.nHTTPThread = st_JsonXMax["nHttpThread"].asInt(); - if (st_JsonRoot["XTime"].empty() || (4 != st_JsonRoot["XTime"].size())) + if (st_JsonRoot["XTime"].empty() || (3 != st_JsonRoot["XTime"].size())) { Config_IsErrorOccur = true; Config_dwErrorCode = ERROR_MODULE_CONFIGURE_JSON_XTIME; @@ -110,9 +110,8 @@ bool CModuleConfigure_Json::ModuleConfigure_Json_File(LPCXSTR lpszConfigFile, XE pSt_ServerConfig->st_XTime.nTimeCheck = st_JsonXTime["nTimeCheck"].asInt(); pSt_ServerConfig->st_XTime.nHTTPTimeOut = st_JsonXTime["nHttpTimeOut"].asInt(); pSt_ServerConfig->st_XTime.nP2PTimeOut = st_JsonXTime["nP2PTimeOut"].asInt(); - pSt_ServerConfig->st_XTime.nDeamonTime = st_JsonXTime["nDeamonTime"].asInt(); - if (st_JsonRoot["XLog"].empty() || (4 != st_JsonRoot["XLog"].size())) + if (st_JsonRoot["XLog"].empty() || (5 != st_JsonRoot["XLog"].size())) { Config_IsErrorOccur = true; Config_dwErrorCode = ERROR_MODULE_CONFIGURE_JSON_XLOG; @@ -122,9 +121,10 @@ bool CModuleConfigure_Json::ModuleConfigure_Json_File(LPCXSTR lpszConfigFile, XE pSt_ServerConfig->st_XLog.nMaxSize = st_JsonXLog["MaxSize"].asInt(); pSt_ServerConfig->st_XLog.nMaxCount = st_JsonXLog["MaxCount"].asInt(); pSt_ServerConfig->st_XLog.nLogLeave = st_JsonXLog["LogLeave"].asInt(); + pSt_ServerConfig->st_XLog.nLogType = st_JsonXLog["LogType"].asInt(); _tcsxcpy(pSt_ServerConfig->st_XLog.tszLogFile, st_JsonXLog["tszLogFile"].asCString()); - if (st_JsonRoot["XApi"].empty() || (4 != st_JsonRoot["XApi"].size())) + if (st_JsonRoot["XApi"].empty() || (5 != st_JsonRoot["XApi"].size())) { Config_IsErrorOccur = true; Config_dwErrorCode = ERROR_MODULE_CONFIGURE_JSON_XAPI; @@ -134,6 +134,7 @@ bool CModuleConfigure_Json::ModuleConfigure_Json_File(LPCXSTR lpszConfigFile, XE _tcsxcpy(pSt_ServerConfig->st_XApi.tszWeatherUrl, st_JsonXApi["tszWeatherUrl"].asCString()); _tcsxcpy(pSt_ServerConfig->st_XApi.tszBankUrl, st_JsonXApi["tszBankUrl"].asCString()); + _tcsxcpy(pSt_ServerConfig->st_XApi.tszOilUrl, st_JsonXApi["tszOilUrl"].asCString()); _tcsxcpy(pSt_ServerConfig->st_XApi.tszTranslationUrl, st_JsonXApi["tszTranslationUrl"].asCString()); Json::Value st_JsonTranslationInfo = st_JsonXApi["st_TranslationInfo"]; _tcsxcpy(pSt_ServerConfig->st_XApi.st_TranslationInfo.tszAPPID, st_JsonTranslationInfo["appid"].asCString()); @@ -544,6 +545,7 @@ bool CModuleConfigure_Json::ModuleConfigure_Json_DeamonList(LPCXSTR lpszConfigFi strcpy(st_APPInfo.tszAPPPath, st_JsonArray[i]["tszAPPPath"].asCString()); st_APPInfo.bEnable = st_JsonArray[i]["bEnable"].asBool(); st_APPInfo.nReTime = st_JsonArray[i]["nAPPReTime"].asInt(); + st_APPInfo.nReNumber = st_JsonArray[i]["nAPPReNumber"].asInt(); pSt_AppConfig->stl_ListDeamonApp.push_back(st_APPInfo); } diff --git a/XEngine_Source/XEngine_ModuleConfigure/XEngine_ModuleConfigure.vcxproj b/XEngine_Source/XEngine_ModuleConfigure/XEngine_ModuleConfigure.vcxproj index c497a86..954c130 100644 --- a/XEngine_Source/XEngine_ModuleConfigure/XEngine_ModuleConfigure.vcxproj +++ b/XEngine_Source/XEngine_ModuleConfigure/XEngine_ModuleConfigure.vcxproj @@ -118,6 +118,7 @@ pch.h MultiThreaded 4819 + /utf-8 %(AdditionalOptions) Windows @@ -157,6 +158,7 @@ pch.h MultiThreaded 4819 + /utf-8 %(AdditionalOptions) Windows diff --git a/XEngine_Source/XEngine_ModuleDatabase/Makefile b/XEngine_Source/XEngine_ModuleDatabase/Makefile index 7c25dcc..9dc1c98 100644 --- a/XEngine_Source/XEngine_ModuleDatabase/Makefile +++ b/XEngine_Source/XEngine_ModuleDatabase/Makefile @@ -1,4 +1,4 @@ -CC = g++ -Wall -std=c++17 -fPIC +CC = g++ -Wall -std=c++20 -fPIC PLATFORM = linux PLATVER = PLATDIR = diff --git a/XEngine_Source/XEngine_ModuleDatabase/XEngine_ModuleDatabase.vcxproj b/XEngine_Source/XEngine_ModuleDatabase/XEngine_ModuleDatabase.vcxproj index ccce48d..a9826f2 100644 --- a/XEngine_Source/XEngine_ModuleDatabase/XEngine_ModuleDatabase.vcxproj +++ b/XEngine_Source/XEngine_ModuleDatabase/XEngine_ModuleDatabase.vcxproj @@ -116,6 +116,7 @@ true Use pch.h + /utf-8 %(AdditionalOptions) Windows @@ -152,6 +153,7 @@ true Use pch.h + /utf-8 %(AdditionalOptions) Windows diff --git a/XEngine_Source/XEngine_ModuleHelp/Makefile b/XEngine_Source/XEngine_ModuleHelp/Makefile index 0af0dce..53ac724 100644 --- a/XEngine_Source/XEngine_ModuleHelp/Makefile +++ b/XEngine_Source/XEngine_ModuleHelp/Makefile @@ -1,4 +1,4 @@ -CC = g++ -Wall -std=c++17 -fPIC +CC = g++ -Wall -std=c++20 -fPIC PLATFORM = linux PLATVER = PLATDIR = diff --git a/XEngine_Source/XEngine_ModuleHelp/ModuleHelp_SocketTest/ModuleHelp_SocketTest.cpp b/XEngine_Source/XEngine_ModuleHelp/ModuleHelp_SocketTest/ModuleHelp_SocketTest.cpp index aa7aa51..41b0895 100644 --- a/XEngine_Source/XEngine_ModuleHelp/ModuleHelp_SocketTest/ModuleHelp_SocketTest.cpp +++ b/XEngine_Source/XEngine_ModuleHelp/ModuleHelp_SocketTest/ModuleHelp_SocketTest.cpp @@ -391,7 +391,7 @@ XHTHREAD CModuleHelp_SocketTest::ModuleHelp_SocketTest_ThreadData(XPVOID lParam) if (pSt_DataSocket->st_SocketData.nRVLen > 0) { //是否需要可读判断 - if (XClient_OPTSocket_IOSelect(pSt_DataSocket->hSocket, true, pSt_DataSocket->st_SocketData.st_REConnect.nContWaitTime)) + if (BaseLib_IO_Select(pSt_DataSocket->hSocket, true, pSt_DataSocket->st_SocketData.st_REConnect.nContWaitTime)) { //接受数据 int nMsgLen = pSt_DataSocket->st_SocketData.nRVLen; diff --git a/XEngine_Source/XEngine_ModuleHelp/XEngine_ModuleHelp.vcxproj b/XEngine_Source/XEngine_ModuleHelp/XEngine_ModuleHelp.vcxproj index abd7751..697c52b 100644 --- a/XEngine_Source/XEngine_ModuleHelp/XEngine_ModuleHelp.vcxproj +++ b/XEngine_Source/XEngine_ModuleHelp/XEngine_ModuleHelp.vcxproj @@ -119,6 +119,7 @@ true Use pch.h + /utf-8 %(AdditionalOptions) Windows @@ -155,6 +156,7 @@ true Use pch.h + /utf-8 %(AdditionalOptions) Windows diff --git a/XEngine_Source/XEngine_ModulePlugin/Makefile b/XEngine_Source/XEngine_ModulePlugin/Makefile index cba6825..46a38cc 100644 --- a/XEngine_Source/XEngine_ModulePlugin/Makefile +++ b/XEngine_Source/XEngine_ModulePlugin/Makefile @@ -1,4 +1,4 @@ -CC = g++ -Wall -std=c++17 -fPIC +CC = g++ -Wall -std=c++20 -fPIC PLATFORM = linux PLATVER = PLATDIR = diff --git a/XEngine_Source/XEngine_ModulePlugin/XEngine_ModulePlugin.vcxproj b/XEngine_Source/XEngine_ModulePlugin/XEngine_ModulePlugin.vcxproj index c89bdd7..75efc3f 100644 --- a/XEngine_Source/XEngine_ModulePlugin/XEngine_ModulePlugin.vcxproj +++ b/XEngine_Source/XEngine_ModulePlugin/XEngine_ModulePlugin.vcxproj @@ -116,6 +116,7 @@ true Use pch.h + /utf-8 %(AdditionalOptions) Windows @@ -152,6 +153,7 @@ true Use pch.h + /utf-8 %(AdditionalOptions) Windows diff --git a/XEngine_Source/XEngine_ModuleProtocol/Makefile b/XEngine_Source/XEngine_ModuleProtocol/Makefile index 1178006..38bae13 100644 --- a/XEngine_Source/XEngine_ModuleProtocol/Makefile +++ b/XEngine_Source/XEngine_ModuleProtocol/Makefile @@ -1,4 +1,4 @@ -CC = g++ -Wall -std=c++17 -fPIC +CC = g++ -Wall -std=c++20 -fPIC PLATFORM = linux PLATVER = PLATDIR = diff --git a/XEngine_Source/XEngine_ModuleProtocol/ModuleProtocol_Define.h b/XEngine_Source/XEngine_ModuleProtocol/ModuleProtocol_Define.h index b90400f..4dc3508 100644 --- a/XEngine_Source/XEngine_ModuleProtocol/ModuleProtocol_Define.h +++ b/XEngine_Source/XEngine_ModuleProtocol/ModuleProtocol_Define.h @@ -1215,17 +1215,22 @@ extern "C" bool ModuleProtocol_Parse_Verifcation(LPCXSTR lpszMsgBuffer, int nMsg 类型:整数型指针 可空:N 意思:输出重试次数 - 参数.六:pbEnable + 参数.六:pInt_ReNumber In/Out:Out 类型:整数型指针 可空:N + 意思:输出重启次数 + 参数.七:pbEnable + In/Out:Out + 类型:逻辑型指针 + 可空:N 意思:输出是否启用 返回值 类型:逻辑型 意思:是否成功 备注: *********************************************************************/ -extern "C" bool ModuleProtocol_Parse_Deamon(LPCXSTR lpszMsgBuffer, int nMsgLen, XCHAR* ptszAPPName, XCHAR* ptszAPPPath, int* pInt_Retime, bool* pbEnable); +extern "C" bool ModuleProtocol_Parse_Deamon(LPCXSTR lpszMsgBuffer, int nMsgLen, XCHAR* ptszAPPName, XCHAR* ptszAPPPath, int* pInt_Retime, int* pInt_ReNumber, bool* pbEnable); /******************************************************************** 函数名称:ModuleProtocol_Parse_Weather 函数功能:解析天气信息 @@ -1273,4 +1278,28 @@ extern "C" bool ModuleProtocol_Parse_Weather(LPCXSTR lpszMsgBuffer, int nMsgLen, 意思:是否成功 备注: *********************************************************************/ -extern "C" bool ModuleProtocol_Parse_Machine(LPCXSTR lpszMsgBuffer, int nMsgLen, XENGINE_MACHINEINFO* pSt_MachineInfo); \ No newline at end of file +extern "C" bool ModuleProtocol_Parse_Machine(LPCXSTR lpszMsgBuffer, int nMsgLen, XENGINE_MACHINEINFO* pSt_MachineInfo); +/******************************************************************** +函数名称:ModuleProtocol_Parse_Oil +函数功能:解析油价协议 + 参数.一:lpszMsgBuffer + In/Out:In + 类型:常量字符指针 + 可空:N + 意思:输入要解析的缓冲区 + 参数.二:nMsgLen + In/Out:In + 类型:整数型 + 可空:N + 意思:输入缓冲区大小 + 参数.三:pSt_OilInfo + In/Out:Out + 类型:数据结构指针 + 可空:N + 意思:输出解析后的信息 +返回值 + 类型:逻辑型 + 意思:是否成功 +备注: +*********************************************************************/ +extern "C" bool ModuleProtocol_Parse_Oil(LPCXSTR lpszMsgBuffer, int nMsgLen, XENGINE_OILINFO* pSt_OilInfo); \ No newline at end of file diff --git a/XEngine_Source/XEngine_ModuleProtocol/ModuleProtocol_Packet/ModuleProtocol_Packet.cpp b/XEngine_Source/XEngine_ModuleProtocol/ModuleProtocol_Packet/ModuleProtocol_Packet.cpp index 7d628f2..09488a0 100644 --- a/XEngine_Source/XEngine_ModuleProtocol/ModuleProtocol_Packet/ModuleProtocol_Packet.cpp +++ b/XEngine_Source/XEngine_ModuleProtocol/ModuleProtocol_Packet/ModuleProtocol_Packet.cpp @@ -1478,7 +1478,7 @@ bool CModuleProtocol_Packet::ModuleProtocol_Packet_SoftWare(XCHAR* ptszSWInfo, i XCHAR tszUPTime[MAX_PATH]; XCHAR tszOSUser[MAX_PATH]; XCHAR tszServicePacket[MAX_PATH]; - XENGINE_LIBTIMER st_LibTimer; + XENGINE_LIBTIME st_LibTimer; memset(tszOSBuild, '\0', MAX_PATH); memset(tszOSVersion, '\0', MAX_PATH); @@ -1486,7 +1486,7 @@ bool CModuleProtocol_Packet::ModuleProtocol_Packet_SoftWare(XCHAR* ptszSWInfo, i memset(tszUPTime, '\0', MAX_PATH); memset(tszOSUser, '\0', MAX_PATH); memset(tszServicePacket, '\0', MAX_PATH); - memset(&st_LibTimer, '\0', sizeof(XENGINE_LIBTIMER)); + memset(&st_LibTimer, '\0', sizeof(XENGINE_LIBTIME)); #ifdef _MSC_BUILD XLONG dwMaxSize = MAX_PATH; diff --git a/XEngine_Source/XEngine_ModuleProtocol/ModuleProtocol_Parse/ModuleProtocol_Parse.cpp b/XEngine_Source/XEngine_ModuleProtocol/ModuleProtocol_Parse/ModuleProtocol_Parse.cpp index 876bcf6..9f237d2 100644 --- a/XEngine_Source/XEngine_ModuleProtocol/ModuleProtocol_Parse/ModuleProtocol_Parse.cpp +++ b/XEngine_Source/XEngine_ModuleProtocol/ModuleProtocol_Parse/ModuleProtocol_Parse.cpp @@ -928,18 +928,23 @@ bool CModuleProtocol_Parse::ModuleProtocol_Parse_Verifcation(LPCXSTR lpszMsgBuff In/Out:Out 类型:整数型指针 可空:N - 意思:输出重试次数 - 参数.六:pbEnable + 意思:输出每隔多少秒重启 + 参数.六:pInt_ReNumber In/Out:Out 类型:整数型指针 可空:N + 意思:输出重启次数 + 参数.七:pbEnable + In/Out:Out + 类型:逻辑型指针 + 可空:N 意思:输出是否启用 返回值 类型:逻辑型 意思:是否成功 备注: *********************************************************************/ -bool CModuleProtocol_Parse::ModuleProtocol_Parse_Deamon(LPCXSTR lpszMsgBuffer, int nMsgLen, XCHAR* ptszAPPName, XCHAR* ptszAPPPath, int* pInt_Retime, bool* pbEnable) +bool CModuleProtocol_Parse::ModuleProtocol_Parse_Deamon(LPCXSTR lpszMsgBuffer, int nMsgLen, XCHAR* ptszAPPName, XCHAR* ptszAPPPath, int* pInt_Retime, int* pInt_ReNumber, bool* pbEnable) { ModuleProtocol_IsErrorOccur = false; @@ -982,6 +987,13 @@ bool CModuleProtocol_Parse::ModuleProtocol_Parse_Deamon(LPCXSTR lpszMsgBuffer, i *pInt_Retime = st_JsonRoot["nRetime"].asInt(); } } + if (!st_JsonRoot["nReNumber"].isNull()) + { + if (NULL != pInt_ReNumber) + { + *pInt_ReNumber = st_JsonRoot["nReNumber"].asInt(); + } + } if (!st_JsonRoot["bEnable"].isNull()) { if (NULL != pbEnable) @@ -1032,10 +1044,16 @@ bool CModuleProtocol_Parse::ModuleProtocol_Parse_Weather(LPCXSTR lpszMsgBuffer, if (!pSt_JsonReader->parse(lpszMsgBuffer, lpszMsgBuffer + nMsgLen, &st_JsonRoot, &st_JsonError)) { ModuleProtocol_IsErrorOccur = true; - ModuleProtocol_dwErrorCode = ERROR_XENGINE_APISERVICE_MODULE_PROTOCOL_PARSE_PARAMENT; + ModuleProtocol_dwErrorCode = ERROR_XENGINE_APISERVICE_MODULE_PROTOCOL_PARSE_JSON; return false; } Json::Value st_JsonObject = st_JsonRoot["lives"][0]; + if (0 == st_JsonObject.size()) + { + ModuleProtocol_IsErrorOccur = true; + ModuleProtocol_dwErrorCode = ERROR_XENGINE_APISERVICE_MODULE_PROTOCOL_PARSE_VALIDATE; + return false; + } if (!st_JsonObject["province"].isNull()) { @@ -1141,4 +1159,97 @@ bool CModuleProtocol_Parse::ModuleProtocol_Parse_Machine(LPCXSTR lpszMsgBuffer, _tcsxcpy(pSt_MachineInfo->tszMachineText, st_JsonRoot["tszMachineText"].asCString()); } return true; +} +/******************************************************************** +函数名称:ModuleProtocol_Parse_Oil +函数功能:解析油价协议 + 参数.一:lpszMsgBuffer + In/Out:In + 类型:常量字符指针 + 可空:N + 意思:输入要解析的缓冲区 + 参数.二:nMsgLen + In/Out:In + 类型:整数型 + 可空:N + 意思:输入缓冲区大小 + 参数.三:pSt_OilInfo + In/Out:Out + 类型:数据结构指针 + 可空:N + 意思:输出解析后的信息 +返回值 + 类型:逻辑型 + 意思:是否成功 +备注: +*********************************************************************/ +bool CModuleProtocol_Parse::ModuleProtocol_Parse_Oil(LPCXSTR lpszMsgBuffer, int nMsgLen, XENGINE_OILINFO* pSt_OilInfo) +{ + ModuleProtocol_IsErrorOccur = false; + + if ((NULL == lpszMsgBuffer) || (0 == nMsgLen)) + { + ModuleProtocol_IsErrorOccur = true; + ModuleProtocol_dwErrorCode = ERROR_XENGINE_APISERVICE_MODULE_PROTOCOL_PARSE_PARAMENT; + return false; + } + Json::Value st_JsonRoot; + JSONCPP_STRING st_JsonError; + Json::CharReaderBuilder st_JsonBuilder; + + std::unique_ptr const pSt_JsonReader(st_JsonBuilder.newCharReader()); + if (!pSt_JsonReader->parse(lpszMsgBuffer, lpszMsgBuffer + nMsgLen, &st_JsonRoot, &st_JsonError)) + { + ModuleProtocol_IsErrorOccur = true; + ModuleProtocol_dwErrorCode = ERROR_XENGINE_APISERVICE_MODULE_PROTOCOL_PARSE_PARAMENT; + return false; + } + + if (1 != st_JsonRoot["status"].asInt()) + { + return false; + } + Json::Value st_JsonObject = st_JsonRoot["data"]; + + if (!st_JsonObject["date"].isNull()) + { + _tcsxcpy(pSt_OilInfo->tszUPTime, st_JsonObject["date"].asCString()); + } + if (!st_JsonObject["name"].isNull()) + { + _tcsxcpy(pSt_OilInfo->tszCityStr, st_JsonObject["name"].asCString()); + } + if (!st_JsonObject["p98"].isNull()) + { + pSt_OilInfo->dlValue98 = _ttxof(st_JsonObject["p98"].asCString()); + } + if (!st_JsonObject["p95"].isNull()) + { + pSt_OilInfo->dlValue95 = _ttxof(st_JsonObject["p95"].asCString()); + } + if (!st_JsonObject["p92"].isNull()) + { + pSt_OilInfo->dlValue92 = _ttxof(st_JsonObject["p92"].asCString()); + } + if (!st_JsonObject["p0"].isNull()) + { + pSt_OilInfo->dlValue0 = _ttxof(st_JsonObject["p0"].asCString()); + } + if (!st_JsonObject["p10"].isNull()) + { + pSt_OilInfo->dlValue10 = _ttxof(st_JsonObject["p10"].asCString()); + } + if (!st_JsonObject["p20"].isNull()) + { + pSt_OilInfo->dlValue20 = _ttxof(st_JsonObject["p20"].asCString()); + } + if (!st_JsonObject["p35"].isNull()) + { + pSt_OilInfo->dlValue35 = _ttxof(st_JsonObject["p35"].asCString()); + } + if (!st_JsonObject["next_update_time"].isNull()) + { + _tcsxcpy(pSt_OilInfo->tszNextTime, st_JsonObject["next_update_time"].asCString()); + } + return true; } \ No newline at end of file diff --git a/XEngine_Source/XEngine_ModuleProtocol/ModuleProtocol_Parse/ModuleProtocol_Parse.h b/XEngine_Source/XEngine_ModuleProtocol/ModuleProtocol_Parse/ModuleProtocol_Parse.h index 2305f87..a5ae7a1 100644 --- a/XEngine_Source/XEngine_ModuleProtocol/ModuleProtocol_Parse/ModuleProtocol_Parse.h +++ b/XEngine_Source/XEngine_ModuleProtocol/ModuleProtocol_Parse/ModuleProtocol_Parse.h @@ -30,8 +30,9 @@ class CModuleProtocol_Parse bool ModuleProtocol_Parse_WordFilter(LPCXSTR lpszMsgBuffer, int nMsgLen, XENGINE_WORDFILTER* pSt_WordFilter); bool ModuleProtocol_Parse_BackService(LPCXSTR lpszMsgBuffer, int nMsgLen, XCHAR* ptszSrcBuffer = NULL, XCHAR* ptszDstBuffer = NULL, int* pInt_BSType = NULL); bool ModuleProtocol_Parse_Verifcation(LPCXSTR lpszMsgBuffer, int nMsgLen, XCHAR* ptszUserName, XCHAR* ptszUserPass); - bool ModuleProtocol_Parse_Deamon(LPCXSTR lpszMsgBuffer, int nMsgLen, XCHAR* ptszAPPName, XCHAR* ptszAPPPath, int* pInt_Retime, bool* pbEnable); + bool ModuleProtocol_Parse_Deamon(LPCXSTR lpszMsgBuffer, int nMsgLen, XCHAR* ptszAPPName, XCHAR* ptszAPPPath, int* pInt_Retime, int* pInt_ReNumber, bool* pbEnable); bool ModuleProtocol_Parse_Weather(LPCXSTR lpszMsgBuffer, int nMsgLen, XENGINE_WEATHERINFO* pSt_WeatherInfo); bool ModuleProtocol_Parse_Machine(LPCXSTR lpszMsgBuffer, int nMsgLen, XENGINE_MACHINEINFO* pSt_MachineInfo); + bool ModuleProtocol_Parse_Oil(LPCXSTR lpszMsgBuffer, int nMsgLen, XENGINE_OILINFO* pSt_OilInfo); private: }; \ No newline at end of file diff --git a/XEngine_Source/XEngine_ModuleProtocol/XEngine_ModuleProtocol.def b/XEngine_Source/XEngine_ModuleProtocol/XEngine_ModuleProtocol.def index acc4d27..4c3350d 100644 --- a/XEngine_Source/XEngine_ModuleProtocol/XEngine_ModuleProtocol.def +++ b/XEngine_Source/XEngine_ModuleProtocol/XEngine_ModuleProtocol.def @@ -48,4 +48,5 @@ EXPORTS ModuleProtocol_Parse_Verifcation ModuleProtocol_Parse_Deamon ModuleProtocol_Parse_Weather - ModuleProtocol_Parse_Machine \ No newline at end of file + ModuleProtocol_Parse_Machine + ModuleProtocol_Parse_Oil \ No newline at end of file diff --git a/XEngine_Source/XEngine_ModuleProtocol/XEngine_ModuleProtocol.vcxproj b/XEngine_Source/XEngine_ModuleProtocol/XEngine_ModuleProtocol.vcxproj index 8ae1fb3..240b875 100644 --- a/XEngine_Source/XEngine_ModuleProtocol/XEngine_ModuleProtocol.vcxproj +++ b/XEngine_Source/XEngine_ModuleProtocol/XEngine_ModuleProtocol.vcxproj @@ -116,6 +116,7 @@ true Use pch.h + /utf-8 %(AdditionalOptions) Windows @@ -152,6 +153,7 @@ true Use pch.h + /utf-8 %(AdditionalOptions) Windows diff --git a/XEngine_Source/XEngine_ModuleProtocol/pch.cpp b/XEngine_Source/XEngine_ModuleProtocol/pch.cpp index e4b3536..cc258da 100644 --- a/XEngine_Source/XEngine_ModuleProtocol/pch.cpp +++ b/XEngine_Source/XEngine_ModuleProtocol/pch.cpp @@ -202,9 +202,9 @@ extern "C" bool ModuleProtocol_Parse_Verifcation(LPCXSTR lpszMsgBuffer, int nMsg { return m_ProtocolParse.ModuleProtocol_Parse_Verifcation(lpszMsgBuffer, nMsgLen, ptszUserName, ptszUserPass); } -extern "C" bool ModuleProtocol_Parse_Deamon(LPCXSTR lpszMsgBuffer, int nMsgLen, XCHAR * ptszAPPName, XCHAR * ptszAPPPath, int* pInt_Retime, bool* pbEnable) +extern "C" bool ModuleProtocol_Parse_Deamon(LPCXSTR lpszMsgBuffer, int nMsgLen, XCHAR * ptszAPPName, XCHAR * ptszAPPPath, int* pInt_Retime, int* pInt_ReNumber, bool* pbEnable) { - return m_ProtocolParse.ModuleProtocol_Parse_Deamon(lpszMsgBuffer, nMsgLen, ptszAPPName, ptszAPPPath, pInt_Retime, pbEnable); + return m_ProtocolParse.ModuleProtocol_Parse_Deamon(lpszMsgBuffer, nMsgLen, ptszAPPName, ptszAPPPath, pInt_Retime, pInt_ReNumber, pbEnable); } extern "C" bool ModuleProtocol_Parse_Weather(LPCXSTR lpszMsgBuffer, int nMsgLen, XENGINE_WEATHERINFO * pSt_WeatherInfo) { @@ -213,4 +213,8 @@ extern "C" bool ModuleProtocol_Parse_Weather(LPCXSTR lpszMsgBuffer, int nMsgLen, extern "C" bool ModuleProtocol_Parse_Machine(LPCXSTR lpszMsgBuffer, int nMsgLen, XENGINE_MACHINEINFO * pSt_MachineInfo) { return m_ProtocolParse.ModuleProtocol_Parse_Machine(lpszMsgBuffer, nMsgLen, pSt_MachineInfo); +} +extern "C" bool ModuleProtocol_Parse_Oil(LPCXSTR lpszMsgBuffer, int nMsgLen, XENGINE_OILINFO* pSt_OilInfo) +{ + return m_ProtocolParse.ModuleProtocol_Parse_Oil(lpszMsgBuffer, nMsgLen, pSt_OilInfo); } \ No newline at end of file diff --git a/XEngine_Source/XEngine_ModuleSystem/Makefile b/XEngine_Source/XEngine_ModuleSystem/Makefile index c53b94d..16002b3 100644 --- a/XEngine_Source/XEngine_ModuleSystem/Makefile +++ b/XEngine_Source/XEngine_ModuleSystem/Makefile @@ -1,4 +1,4 @@ -CC = g++ -Wall -std=c++17 -fPIC +CC = g++ -Wall -std=c++20 -fPIC PLATFORM = linux PLATVER = PLATDIR = diff --git a/XEngine_Source/XEngine_ModuleSystem/XEngine_ModuleSystem.vcxproj b/XEngine_Source/XEngine_ModuleSystem/XEngine_ModuleSystem.vcxproj index 23dd52f..fd83cc3 100644 --- a/XEngine_Source/XEngine_ModuleSystem/XEngine_ModuleSystem.vcxproj +++ b/XEngine_Source/XEngine_ModuleSystem/XEngine_ModuleSystem.vcxproj @@ -112,6 +112,7 @@ true Use pch.h + /utf-8 %(AdditionalOptions) Windows @@ -148,6 +149,7 @@ true Use pch.h + /utf-8 %(AdditionalOptions) Windows diff --git a/XEngine_Source/XEngine_PluginModule/ModulePlugin_BMIndex/Makefile b/XEngine_Source/XEngine_PluginModule/ModulePlugin_BMIndex/Makefile index 689d5ef..567c61c 100644 --- a/XEngine_Source/XEngine_PluginModule/ModulePlugin_BMIndex/Makefile +++ b/XEngine_Source/XEngine_PluginModule/ModulePlugin_BMIndex/Makefile @@ -1,4 +1,4 @@ -CC = g++ -Wall -std=c++17 -fPIC +CC = g++ -Wall -std=c++20 -fPIC PLATFORM = linux PLATVER = PLATDIR = diff --git a/XEngine_Source/XEngine_PluginModule/ModulePlugin_BMIndex/ModulePlugin_BMIndex.vcxproj b/XEngine_Source/XEngine_PluginModule/ModulePlugin_BMIndex/ModulePlugin_BMIndex.vcxproj index 801729f..8ea8729 100644 --- a/XEngine_Source/XEngine_PluginModule/ModulePlugin_BMIndex/ModulePlugin_BMIndex.vcxproj +++ b/XEngine_Source/XEngine_PluginModule/ModulePlugin_BMIndex/ModulePlugin_BMIndex.vcxproj @@ -122,6 +122,7 @@ true Use pch.h + /utf-8 %(AdditionalOptions) Windows @@ -158,6 +159,7 @@ true Use pch.h + /utf-8 %(AdditionalOptions) Windows diff --git a/XEngine_Source/XEngine_PluginModule/ModulePlugin_Meter/Makefile b/XEngine_Source/XEngine_PluginModule/ModulePlugin_Meter/Makefile index 72918d7..663ba4e 100644 --- a/XEngine_Source/XEngine_PluginModule/ModulePlugin_Meter/Makefile +++ b/XEngine_Source/XEngine_PluginModule/ModulePlugin_Meter/Makefile @@ -1,4 +1,4 @@ -CC = g++ -Wall -std=c++17 -fPIC +CC = g++ -Wall -std=c++20 -fPIC PLATFORM = linux PLATVER = PLATDIR = diff --git a/XEngine_Source/XEngine_PluginModule/ModulePlugin_Meter/ModulePlugin_Meter.vcxproj b/XEngine_Source/XEngine_PluginModule/ModulePlugin_Meter/ModulePlugin_Meter.vcxproj index 8a0a430..8d024a2 100644 --- a/XEngine_Source/XEngine_PluginModule/ModulePlugin_Meter/ModulePlugin_Meter.vcxproj +++ b/XEngine_Source/XEngine_PluginModule/ModulePlugin_Meter/ModulePlugin_Meter.vcxproj @@ -121,6 +121,7 @@ true Use pch.h + /utf-8 %(AdditionalOptions) Windows @@ -157,6 +158,7 @@ true Use pch.h + /utf-8 %(AdditionalOptions) Windows diff --git a/XEngine_Source/XEngine_PluginModule/ModulePlugin_Password/Makefile b/XEngine_Source/XEngine_PluginModule/ModulePlugin_Password/Makefile index d771472..c2924ba 100644 --- a/XEngine_Source/XEngine_PluginModule/ModulePlugin_Password/Makefile +++ b/XEngine_Source/XEngine_PluginModule/ModulePlugin_Password/Makefile @@ -1,4 +1,4 @@ -CC = g++ -Wall -std=c++17 -fPIC +CC = g++ -Wall -std=c++20 -fPIC PLATFORM = linux PLATVER = PLATDIR = diff --git a/XEngine_Source/XEngine_PluginModule/ModulePlugin_Password/ModulePlugin_Password.vcxproj b/XEngine_Source/XEngine_PluginModule/ModulePlugin_Password/ModulePlugin_Password.vcxproj index 11dfee1..75cac6b 100644 --- a/XEngine_Source/XEngine_PluginModule/ModulePlugin_Password/ModulePlugin_Password.vcxproj +++ b/XEngine_Source/XEngine_PluginModule/ModulePlugin_Password/ModulePlugin_Password.vcxproj @@ -125,6 +125,7 @@ true Use pch.h + /utf-8 %(AdditionalOptions) Windows @@ -161,6 +162,7 @@ true Use pch.h + /utf-8 %(AdditionalOptions) Windows diff --git a/XEngine_Source/XEngine_PluginModule/ModulePlugin_Password/Plugin_Password/Plugin_Password.cpp b/XEngine_Source/XEngine_PluginModule/ModulePlugin_Password/Plugin_Password/Plugin_Password.cpp index 41c9531..8d728dc 100644 --- a/XEngine_Source/XEngine_PluginModule/ModulePlugin_Password/Plugin_Password/Plugin_Password.cpp +++ b/XEngine_Source/XEngine_PluginModule/ModulePlugin_Password/Plugin_Password/Plugin_Password.cpp @@ -108,26 +108,17 @@ bool CPlugin_Password::Plugin_Password_Creator(LPCXSTR lpszPassType, LPCXSTR lps int nType = _ttxoi(lpszPassType); int nLen = _ttxoi(lpszLength); - XCHAR tszPassBuffer[MAX_PATH]; - - memset(tszPassBuffer, '\0', MAX_PATH); if (0 == nType) { - BaseLib_Handle_CreateStr(tszPassBuffer, nLen); + BaseLib_Handle_CreateStr(ptszPassStr, nLen); } else if (1 == nType) { - for (int i = 0; i < nLen; i++) - { - _xstprintf(&tszPassBuffer[i], _X("%d"), rand() % 9); - } + BaseLib_Handle_CreateStr(ptszPassStr, nLen, 1); } else if (2 == nType) { - for (int i = 0; i < nLen; i++) - { - _xstprintf(&tszPassBuffer[i], _X("%c"), (rand() % 26) + 65); - } + BaseLib_Handle_CreateStr(ptszPassStr, nLen, 2); } return true; } \ No newline at end of file diff --git a/XEngine_Source/XEngine_PluginModule/ModulePlugin_Timezone/Makefile b/XEngine_Source/XEngine_PluginModule/ModulePlugin_Timezone/Makefile index ea91a88..24bec00 100644 --- a/XEngine_Source/XEngine_PluginModule/ModulePlugin_Timezone/Makefile +++ b/XEngine_Source/XEngine_PluginModule/ModulePlugin_Timezone/Makefile @@ -1,4 +1,4 @@ -CC = g++ -Wall -std=c++17 -fPIC +CC = g++ -Wall -std=c++20 -fPIC PLATFORM = linux PLATVER = PLATDIR = diff --git a/XEngine_Source/XEngine_PluginModule/ModulePlugin_Timezone/ModulePlugin_Timezone.vcxproj b/XEngine_Source/XEngine_PluginModule/ModulePlugin_Timezone/ModulePlugin_Timezone.vcxproj index 0e932ca..c00967f 100644 --- a/XEngine_Source/XEngine_PluginModule/ModulePlugin_Timezone/ModulePlugin_Timezone.vcxproj +++ b/XEngine_Source/XEngine_PluginModule/ModulePlugin_Timezone/ModulePlugin_Timezone.vcxproj @@ -121,6 +121,7 @@ true Use pch.h + /utf-8 %(AdditionalOptions) Windows @@ -157,6 +158,7 @@ true Use pch.h + /utf-8 %(AdditionalOptions) Windows diff --git a/XEngine_Source/XEngine_PluginModule/ModulePlugin_Timezone/Plugin_Timezone/Plugin_Timezone.cpp b/XEngine_Source/XEngine_PluginModule/ModulePlugin_Timezone/Plugin_Timezone/Plugin_Timezone.cpp index 35a6ed1..6da661e 100644 --- a/XEngine_Source/XEngine_PluginModule/ModulePlugin_Timezone/Plugin_Timezone/Plugin_Timezone.cpp +++ b/XEngine_Source/XEngine_PluginModule/ModulePlugin_Timezone/Plugin_Timezone/Plugin_Timezone.cpp @@ -638,12 +638,12 @@ bool CPlugin_Timezone::Plugin_Timezone_Convert(LPCXSTR lpszConvert, LPCXSTR lpsz return false; } XCHAR tszTimeStr[64]; - XENGINE_LIBTIMER st_TimeStart; - XENGINE_LIBTIMER st_TimeEnd; + XENGINE_LIBTIME st_TimeStart; + XENGINE_LIBTIME st_TimeEnd; memset(tszTimeStr, '\0', sizeof(tszTimeStr)); - memset(&st_TimeStart, '\0', sizeof(XENGINE_LIBTIMER)); - memset(&st_TimeEnd, '\0', sizeof(XENGINE_LIBTIMER)); + memset(&st_TimeStart, '\0', sizeof(XENGINE_LIBTIME)); + memset(&st_TimeEnd, '\0', sizeof(XENGINE_LIBTIME)); st_TimeEnd = stl_MapIterator->second.st_TimeZone; diff --git a/XEngine_Source/XEngine_PluginModule/ModulePlugin_Timezone/Plugin_Timezone/Plugin_Timezone.h b/XEngine_Source/XEngine_PluginModule/ModulePlugin_Timezone/Plugin_Timezone/Plugin_Timezone.h index 2848903..98c975e 100644 --- a/XEngine_Source/XEngine_PluginModule/ModulePlugin_Timezone/Plugin_Timezone/Plugin_Timezone.h +++ b/XEngine_Source/XEngine_PluginModule/ModulePlugin_Timezone/Plugin_Timezone/Plugin_Timezone.h @@ -12,7 +12,7 @@ *********************************************************************/ typedef struct { - XENGINE_LIBTIMER st_TimeZone; + XENGINE_LIBTIME st_TimeZone; XCHAR tszTimeCountry[MAX_PATH]; }MODULEPLUGIN_TIMEZONE; diff --git a/XEngine_Source/XEngine_PluginModule/ModulePlugin_Zodiac/Makefile b/XEngine_Source/XEngine_PluginModule/ModulePlugin_Zodiac/Makefile index 8df0597..886a283 100644 --- a/XEngine_Source/XEngine_PluginModule/ModulePlugin_Zodiac/Makefile +++ b/XEngine_Source/XEngine_PluginModule/ModulePlugin_Zodiac/Makefile @@ -1,4 +1,4 @@ -CC = g++ -Wall -std=c++17 -fPIC +CC = g++ -Wall -std=c++20 -fPIC PLATFORM = linux PLATVER = PLATDIR = diff --git a/XEngine_Source/XEngine_PluginModule/ModulePlugin_Zodiac/ModulePlugin_Zodiac.vcxproj b/XEngine_Source/XEngine_PluginModule/ModulePlugin_Zodiac/ModulePlugin_Zodiac.vcxproj index 558978c..72bb449 100644 --- a/XEngine_Source/XEngine_PluginModule/ModulePlugin_Zodiac/ModulePlugin_Zodiac.vcxproj +++ b/XEngine_Source/XEngine_PluginModule/ModulePlugin_Zodiac/ModulePlugin_Zodiac.vcxproj @@ -125,6 +125,7 @@ true Use pch.h + /utf-8 %(AdditionalOptions) Windows @@ -161,6 +162,7 @@ true Use pch.h + /utf-8 %(AdditionalOptions) Windows diff --git a/XEngine_Source/XEngine_ServiceApp/XEngine_HttpApp/Makefile b/XEngine_Source/XEngine_ServiceApp/XEngine_HttpApp/Makefile index 85dbe29..34ec08e 100644 --- a/XEngine_Source/XEngine_ServiceApp/XEngine_HttpApp/Makefile +++ b/XEngine_Source/XEngine_ServiceApp/XEngine_HttpApp/Makefile @@ -1,4 +1,4 @@ -CC = g++ -Wall -std=c++17 -fPIC +CC = g++ -Wall -std=c++20 -fPIC PLATFORM = linux PLATVER = PLATDIR = @@ -51,7 +51,7 @@ ifeq ($(PLATFORM),linux) FILEEXT = so LIBFLAG = -shared LIBEX = -lpthread -lrt -ldl - LOADBIN = -Wl,-rpath=./,--disable-new-dtags + LOADBIN = -Wl,-rpath=./:/usr/local/ffmpeg-xengine/lib,--disable-new-dtags else ifeq ($(PLATFORM),mac) CC += -Wno-deprecated-declarations PLATVER = -D __MACOS__ diff --git a/XEngine_Source/XEngine_ServiceApp/XEngine_HttpApp/XEngine_HTTPTask.cpp b/XEngine_Source/XEngine_ServiceApp/XEngine_HttpApp/XEngine_HTTPTask.cpp index 652266d..5f912f0 100644 --- a/XEngine_Source/XEngine_ServiceApp/XEngine_HttpApp/XEngine_HTTPTask.cpp +++ b/XEngine_Source/XEngine_ServiceApp/XEngine_HttpApp/XEngine_HTTPTask.cpp @@ -398,7 +398,7 @@ bool HTTPTask_TastPost_Handle(RFCCOMPONENTS_HTTP_REQPARAM* pSt_HTTPParam, LPCXST } else if (0 == _tcsxnicmp(lpszParamRegion, tszValue, _tcsxlen(lpszParamRegion))) { - //天气:http://127.0.0.1:5501/api?function=region&type=1¶ms=省份¶ms=市区¶ms=县级 + //地区ID:http://127.0.0.1:5501/api?function=region&type=1¶ms=省份¶ms=市区¶ms=县级 int nType = 0; memset(tszValue, '\0', sizeof(tszValue)); diff --git a/XEngine_Source/XEngine_ServiceApp/XEngine_HttpApp/XEngine_Hdr.h b/XEngine_Source/XEngine_ServiceApp/XEngine_HttpApp/XEngine_Hdr.h index 4d14845..6ca152b 100644 --- a/XEngine_Source/XEngine_ServiceApp/XEngine_HttpApp/XEngine_Hdr.h +++ b/XEngine_Source/XEngine_ServiceApp/XEngine_HttpApp/XEngine_Hdr.h @@ -5,6 +5,7 @@ #include #include #include +#include #include #include #include diff --git a/XEngine_Source/XEngine_ServiceApp/XEngine_HttpApp/XEngine_HttpApp.cpp b/XEngine_Source/XEngine_ServiceApp/XEngine_HttpApp/XEngine_HttpApp.cpp index c7d6c00..d78312e 100644 --- a/XEngine_Source/XEngine_ServiceApp/XEngine_HttpApp/XEngine_HttpApp.cpp +++ b/XEngine_Source/XEngine_ServiceApp/XEngine_HttpApp/XEngine_HttpApp.cpp @@ -133,7 +133,13 @@ int main(int argc, char** argv) WSAStartup(MAKEWORD(2, 2), &st_WSAData); SetUnhandledExceptionFilter(Coredump_ExceptionFilter); - SetConsoleOutputCP(CP_UTF8); +#ifndef _DEBUG + if (setlocale(LC_ALL, ".UTF8") == NULL) + { + printf("Error setting locale.\n"); + return -1; + } +#endif #endif bIsRun = true; int nRet = -1; @@ -178,7 +184,7 @@ int main(int argc, char** argv) goto XENGINE_SERVICEAPP_EXIT; } //设置日志打印级别 - HelpComponents_XLog_SetLogPriority(xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_INFO); + HelpComponents_XLog_SetLogPriority(xhLog, st_ServiceConfig.st_XLog.nLogType); XLOG_PRINT(xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_INFO, _X("启动服务中,初始化日志系统成功")); signal(SIGINT, ServiceApp_Stop); @@ -512,10 +518,9 @@ int main(int argc, char** argv) //发送信息报告 if (st_ServiceConfig.st_XReport.bEnable && !bIsTest) { - if (InfoReport_APIMachine_Send(st_ServiceConfig.st_XReport.tszAPIUrl, st_ServiceConfig.st_XReport.tszServiceName)) + __int64x nTimeNumber = 0; + if (InfoReport_APIMachine_Send(st_ServiceConfig.st_XReport.tszAPIUrl, st_ServiceConfig.st_XReport.tszServiceName, &nTimeNumber)) { - __int64x nTimeNumber = 0; - InfoReport_APIMachine_GetTime(st_ServiceConfig.st_XReport.tszAPIUrl, st_ServiceConfig.st_XReport.tszServiceName, &nTimeNumber); XLOG_PRINT(xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_INFO, _X("启动服务中,启动信息报告给API服务器:%s 成功,报告次数:%lld"), st_ServiceConfig.st_XReport.tszAPIUrl, nTimeNumber); } else diff --git a/XEngine_Source/XEngine_ServiceApp/XEngine_HttpApp/XEngine_HttpApp.vcxproj b/XEngine_Source/XEngine_ServiceApp/XEngine_HttpApp/XEngine_HttpApp.vcxproj index c0fe737..e23feb9 100644 --- a/XEngine_Source/XEngine_ServiceApp/XEngine_HttpApp/XEngine_HttpApp.vcxproj +++ b/XEngine_Source/XEngine_ServiceApp/XEngine_HttpApp/XEngine_HttpApp.vcxproj @@ -113,6 +113,7 @@ true MultiThreaded 4819 + /utf-8 %(AdditionalOptions) Console @@ -144,6 +145,7 @@ true MultiThreaded 4819 + /utf-8 %(AdditionalOptions) Console diff --git a/XEngine_Source/XEngine_ServiceApp/XEngine_HttpApp/XEngine_HttpApp.vcxproj.filters b/XEngine_Source/XEngine_ServiceApp/XEngine_HttpApp/XEngine_HttpApp.vcxproj.filters index 0f31a8a..00f7282 100644 --- a/XEngine_Source/XEngine_ServiceApp/XEngine_HttpApp/XEngine_HttpApp.vcxproj.filters +++ b/XEngine_Source/XEngine_ServiceApp/XEngine_HttpApp/XEngine_HttpApp.vcxproj.filters @@ -9,25 +9,25 @@ {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms + + {9bf2e74a-551b-4d8d-ad34-ccd13e64e985} + + + {3d1f325b-4812-45f1-b04b-0056a7b2ce72} + + + {7dbb6197-ab74-46a9-b43f-64edef792af2} + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx - - {9bf2e74a-551b-4d8d-ad34-ccd13e64e985} - {a205153f-6995-49dc-ae5f-cd2bc0d31549} - - {3d1f325b-4812-45f1-b04b-0056a7b2ce72} - {a904cf8f-7387-403f-8686-0f5c35c6b72c} - - {7dbb6197-ab74-46a9-b43f-64edef792af2} - {0dfcfd07-5186-4d04-9266-c2cc9e221421} diff --git a/XEngine_Source/XEngine_ServiceApp/XEngine_HttpApp/XEngine_TaskGet/TaskGet_Oil.cpp b/XEngine_Source/XEngine_ServiceApp/XEngine_HttpApp/XEngine_TaskGet/TaskGet_Oil.cpp index e58926e..3cbeffd 100644 --- a/XEngine_Source/XEngine_ServiceApp/XEngine_HttpApp/XEngine_TaskGet/TaskGet_Oil.cpp +++ b/XEngine_Source/XEngine_ServiceApp/XEngine_HttpApp/XEngine_TaskGet/TaskGet_Oil.cpp @@ -4,9 +4,12 @@ bool HTTPTask_TaskGet_Oil(LPCXSTR lpszClientAddr, LPCXSTR lpszCityStr) { int nMsgLen = 4096; int nPktLen = 4096; + int nBLen = 0; + XCHAR* ptszBodyBuffer; XCHAR tszMsgBuffer[4096]; XCHAR tszPktBuffer[4096]; - + XCHAR tszUrlBuffer[MAX_PATH] = {}; + XENGINE_OILINFO st_OilInfo = {}; RFCCOMPONENTS_HTTP_HDRPARAM st_HDRParam = {}; //发送给客户端的参数 @@ -16,21 +19,32 @@ bool HTTPTask_TaskGet_Oil(LPCXSTR lpszClientAddr, LPCXSTR lpszCityStr) st_HDRParam.nHttpCode = 200; //HTTP CODE码 st_HDRParam.bIsClose = true; //收到回复后就关闭 - if (!st_ServiceConfig.st_XSql.bEnable) - { - ModuleProtocol_Packet_Common(tszPktBuffer, &nPktLen, 501, _X("function is closed")); - HttpProtocol_Server_SendMsgEx(xhHTTPPacket, tszMsgBuffer, &nMsgLen, &st_HDRParam, tszPktBuffer, nPktLen); - XEngine_Network_Send(lpszClientAddr, tszMsgBuffer, nMsgLen); - XLOG_PRINT(xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_INFO, _X("HTTP客户端:%s,请求的油价查询功能已经被服务器关闭,无法继续"), lpszClientAddr); - return false; - } - _tcsxcpy(st_OilInfo.tszCityStr, lpszCityStr); - if (!ModuleDatabase_OilInfo_Query(&st_OilInfo)) + XCHAR tszURLEncoder[MAX_PATH] = {}; + _xstprintf(tszUrlBuffer, st_ServiceConfig.st_XApi.tszOilUrl, lpszCityStr); + +#ifdef _MSC_BUILD + XCHAR tszUTFEncoder[MAX_PATH] = {}; + BaseLib_Charset_AnsiToUTF(tszUrlBuffer, tszUTFEncoder); + Cryption_Codec_UrlEnCodec(tszUTFEncoder, _tcsxlen(tszUTFEncoder), tszURLEncoder); +#else + Cryption_Codec_UrlEnCodec(tszUrlBuffer, _tcsxlen(tszUrlBuffer), tszURLEncoder); +#endif + + APIClient_Http_Request(_X("GET"), tszURLEncoder, NULL, NULL, &ptszBodyBuffer, &nBLen); + XCHAR tszGBKStr[1024] = {}; +#ifdef _MSC_BUILD + BaseLib_Charset_UTFToAnsi(ptszBodyBuffer, tszGBKStr, &nBLen); +#else + _tcsxcpy(tszGBKStr, ptszBodyBuffer); +#endif + BaseLib_Memory_FreeCStyle((XPPMEM)&ptszBodyBuffer); + //解析JSON信息 + if (!ModuleProtocol_Parse_Oil(tszGBKStr, nBLen, &st_OilInfo)) { - ModuleProtocol_Packet_IDQuery(tszPktBuffer, &nPktLen, NULL, NULL, 1001, _X("city name is incorrent")); + ModuleProtocol_Packet_Common(tszPktBuffer, &nPktLen, 404, _X("get oil failed.maybe address is incorrect")); HttpProtocol_Server_SendMsgEx(xhHTTPPacket, tszMsgBuffer, &nMsgLen, &st_HDRParam, tszPktBuffer, nPktLen); XEngine_Network_Send(lpszClientAddr, tszMsgBuffer, nMsgLen); - XLOG_PRINT(xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_INFO, _X("HTTP客户端:%s,请求的油价查询不正确,城市名:%s"), lpszClientAddr, lpszCityStr); + XLOG_PRINT(xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_INFO, _X("HTTP客户端:%s,请求的油价查询错误,可能地址:%s,不正确"), lpszClientAddr, lpszCityStr); return false; } ModuleProtocol_Packet_OilInfo(tszPktBuffer, &nPktLen, &st_OilInfo); diff --git a/XEngine_Source/XEngine_ServiceApp/XEngine_HttpApp/XEngine_TaskGet/TaskGet_Weather.cpp b/XEngine_Source/XEngine_ServiceApp/XEngine_HttpApp/XEngine_TaskGet/TaskGet_Weather.cpp index e66511c..fef5bde 100644 --- a/XEngine_Source/XEngine_ServiceApp/XEngine_HttpApp/XEngine_TaskGet/TaskGet_Weather.cpp +++ b/XEngine_Source/XEngine_ServiceApp/XEngine_HttpApp/XEngine_TaskGet/TaskGet_Weather.cpp @@ -32,7 +32,7 @@ bool HTTPTask_TaskGet_WeatherInfo(LPCXSTR lpszClientAddr, LPCXSTR lpszAddrCode) //解析JSON信息 if (!ModuleProtocol_Parse_Weather(tszGBKStr, nBLen, &st_WeatherInfo)) { - ModuleProtocol_Packet_Common(tszPktBuffer, &nPktLen, 404, _X("address id is incorrect")); + ModuleProtocol_Packet_Common(tszPktBuffer, &nPktLen, 404, _X("get weather failed.maybe id is incorrect")); HttpProtocol_Server_SendMsgEx(xhHTTPPacket, tszMsgBuffer, &nMsgLen, &st_HDRParam, tszPktBuffer, nPktLen); XEngine_Network_Send(lpszClientAddr, tszMsgBuffer, nMsgLen); XLOG_PRINT(xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_INFO, _X("HTTP客户端:%s,请求的实时天气信息错误,可能ID:%s,不正确"), lpszClientAddr, lpszAddrCode); diff --git a/XEngine_Source/XEngine_ServiceApp/XEngine_HttpApp/XEngine_TaskPost/TaskPost_Deamon.cpp b/XEngine_Source/XEngine_ServiceApp/XEngine_HttpApp/XEngine_TaskPost/TaskPost_Deamon.cpp index 6c45e47..1190960 100644 --- a/XEngine_Source/XEngine_ServiceApp/XEngine_HttpApp/XEngine_TaskPost/TaskPost_Deamon.cpp +++ b/XEngine_Source/XEngine_ServiceApp/XEngine_HttpApp/XEngine_TaskPost/TaskPost_Deamon.cpp @@ -12,11 +12,10 @@ void CALLBACK HTTPTask_TaskPost_Thread() { continue; } - //重试次数判断 - if (stl_ListIterator->nErrorTime > st_ServiceConfig.st_XTime.nDeamonTime) + if (stl_ListIterator->nErrorTime >= stl_ListIterator->nReNumber) { stl_ListIterator->bEnable = false; - XLOG_PRINT(xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_ERROR, _X("服务名:%s,由于超过指定启动失败次数:%d,这个服务检测功能被关闭..."), stl_ListIterator->tszAPPName, st_ServiceConfig.st_XTime.nDeamonTime); + XLOG_PRINT(xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_ERROR, _X("服务名:%s,由于超过指定启动失败次数:%d,这个服务检测功能被关闭..."), stl_ListIterator->tszAPPName, stl_ListIterator->nReNumber); continue; } @@ -40,9 +39,10 @@ void CALLBACK HTTPTask_TaskPost_Thread() } else { - stl_ListIterator->nErrorTime++; - XLOG_PRINT(xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_ERROR, _X("自动重启,重启进程:%s 失败,错误码:%lX..."), stl_ListIterator->tszAPPName, SystemApi_GetLastError()); + stl_ListIterator->bEnable = false; + XLOG_PRINT(xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_ERROR, _X("自动重启,重启进程:%s 失败,此服务将被禁用,错误码:%lX..."), stl_ListIterator->tszAPPName, SystemApi_GetLastError()); } + stl_ListIterator->nErrorTime++; } } else @@ -78,9 +78,10 @@ void CALLBACK HTTPTask_TaskPost_Thread() } else { - stl_ListIterator->nErrorTime++; - XLOG_PRINT(xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_ERROR, "崩溃重启,检查到进程不存在,启动进程:%s 失败,错误码:%lX...", stl_ListIterator->tszAPPName, SystemApi_GetLastError()); + stl_ListIterator->bEnable = false; + XLOG_PRINT(xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_ERROR, "崩溃重启,检查到进程不存在,启动进程:%s 失败,此服务将被禁用,错误码:%lX...", stl_ListIterator->tszAPPName, SystemApi_GetLastError()); } + stl_ListIterator->nErrorTime++; } } //休眠用户配置的时间 @@ -129,7 +130,7 @@ bool HTTPTask_TaskPost_Deamon(LPCXSTR lpszClientAddr, LPCXSTR lpszMsgBuffer, int } } - if (!ModuleProtocol_Parse_Deamon(lpszMsgBuffer, nMsgLen, st_DeamonApp.tszAPPName, st_DeamonApp.tszAPPPath, &st_DeamonApp.nReTime, &st_DeamonApp.bEnable)) + if (!ModuleProtocol_Parse_Deamon(lpszMsgBuffer, nMsgLen, st_DeamonApp.tszAPPName, st_DeamonApp.tszAPPPath, &st_DeamonApp.nReTime, &st_DeamonApp.nReNumber, &st_DeamonApp.bEnable)) { st_HDRParam.nHttpCode = 400; HttpProtocol_Server_SendMsgEx(xhHTTPPacket, ptszSDBuffer, &nSDLen, &st_HDRParam); diff --git a/XEngine_Source/XEngine_ServiceApp/XEngine_HttpApp/XEngine_TaskPost/TaskPost_Image.cpp b/XEngine_Source/XEngine_ServiceApp/XEngine_HttpApp/XEngine_TaskPost/TaskPost_Image.cpp index 91920f0..0146eff 100644 --- a/XEngine_Source/XEngine_ServiceApp/XEngine_HttpApp/XEngine_TaskPost/TaskPost_Image.cpp +++ b/XEngine_Source/XEngine_ServiceApp/XEngine_HttpApp/XEngine_TaskPost/TaskPost_Image.cpp @@ -15,6 +15,7 @@ bool HTTPTask_TaskPost_Image(LPCXSTR lpszClientAddr, LPCXSTR lpszMsgBuffer, int HttpProtocol_Server_SendMsgEx(xhHTTPPacket, tszMSGBuffer, &nMLen, &st_HDRParam); XEngine_Network_Send(lpszClientAddr, tszMSGBuffer, nMLen); XLOG_PRINT(xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_ERROR, _X("HTTP客户端:%s,请求图片操作失败,服务器没有启用此功能"), lpszClientAddr); + return false; #else int nSDLen = 0; int nRVLen = 0; @@ -31,8 +32,19 @@ bool HTTPTask_TaskPost_Image(LPCXSTR lpszClientAddr, LPCXSTR lpszMsgBuffer, int BaseLib_String_GetKeyValue((*ppptszList)[1], "=", tszHTTPKey, tszHTTPVlu); int nOPCode = _ttxoi(tszHTTPVlu); //0获取,1设置 - if (0 == nOPCode && st_ServiceConfig.st_XImageText.bEnable) + if (0 == nOPCode) { + if (!st_ServiceConfig.st_XImageText.bEnable) + { + int nMLen = 0; + XCHAR tszMSGBuffer[MAX_PATH] = {}; + + st_HDRParam.nHttpCode = 501; + HttpProtocol_Server_SendMsgEx(xhHTTPPacket, tszMSGBuffer, &nMLen, &st_HDRParam); + XEngine_Network_Send(lpszClientAddr, tszMSGBuffer, nMLen); + XLOG_PRINT(xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_ERROR, _X("HTTP客户端:%s,请求图片转文本操作失败,服务器没有启用此功能"), lpszClientAddr); + return false; + } XCHAR** pptszListStr; int nListCount = 0; if (ModuleHelp_ImageGet_TextGet(lpszMsgBuffer, nMsgLen, &pptszListStr, &nListCount)) diff --git a/XEngine_Source/XEngine_ServiceApp/XEngine_HttpApp/XEngine_TaskPost/TaskPost_Machine.cpp b/XEngine_Source/XEngine_ServiceApp/XEngine_HttpApp/XEngine_TaskPost/TaskPost_Machine.cpp index d96efbc..31f5dcf 100644 --- a/XEngine_Source/XEngine_ServiceApp/XEngine_HttpApp/XEngine_TaskPost/TaskPost_Machine.cpp +++ b/XEngine_Source/XEngine_ServiceApp/XEngine_HttpApp/XEngine_TaskPost/TaskPost_Machine.cpp @@ -49,9 +49,15 @@ bool HTTPTask_TastPost_Machine(LPCXSTR lpszClientAddr, LPCXSTR lpszMsgBuffer, in return false; } } - ModuleProtocol_Packet_Common(tszRVBuffer, &nRVLen); + int nListCount = 1; + XENGINE_MACHINEINFO** ppSt_MachineInfo; + BaseLib_Memory_Malloc((XPPPMEM)&ppSt_MachineInfo, nListCount, sizeof(XENGINE_MACHINEINFO)); + (*ppSt_MachineInfo)[0] = st_MachineInfo; + ModuleProtocol_Packet_Machine(tszRVBuffer, &nRVLen, &ppSt_MachineInfo, nListCount); + HttpProtocol_Server_SendMsgEx(xhHTTPPacket, tszSDBuffer, &nSDLen, &st_HDRParam, tszRVBuffer, nRVLen); XEngine_Network_Send(lpszClientAddr, tszSDBuffer, nSDLen); + BaseLib_Memory_Free((XPPPMEM)&ppSt_MachineInfo, nListCount); XLOG_PRINT(xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_INFO, _X("HTTP客户端:%s,请求插入一条信息收集数据成功,机器名:%s,服务名称:%s"), lpszClientAddr, st_MachineInfo.tszMachineSystem, st_MachineInfo.tszServiceName); } else if (1 == nType) diff --git a/XEngine_Source/XEngine_UserProtocol.h b/XEngine_Source/XEngine_UserProtocol.h index ccf7106..c4d6f2e 100644 --- a/XEngine_Source/XEngine_UserProtocol.h +++ b/XEngine_Source/XEngine_UserProtocol.h @@ -289,5 +289,6 @@ typedef struct double dlValue20; double dlValue35; XCHAR tszUPTime[64]; //更新时间 + XCHAR tszNextTime[64]; //更新时间 }XENGINE_OILINFO; #pragma pack(pop) \ No newline at end of file