diff --git a/.github/workflows/msbuild.yml b/.github/workflows/msbuild.yml new file mode 100644 index 0000000000000000000000000000000000000000..ba707c37527c13eb6bb1e3a62c0177801d8b3ff8 --- /dev/null +++ b/.github/workflows/msbuild.yml @@ -0,0 +1,50 @@ +name: C++ Build with Dependencies + +#on: [push] # 触发条件,推送和拉取请求时, +on: + workflow_dispatch: # 添加这行来启用手动触发 + +permissions: + contents: write + +jobs: + build: + strategy: + matrix: + configuration: [Release] + platform: [x86] + + runs-on: windows-latest # 最新的 Windows 环境 + + steps: + # 检出您的主仓库代码 + - name: Checkout main repository code + uses: actions/checkout@v3 + + # 检出依赖的xengine仓库到指定的xengine目录 + - name: Checkout dependency repository (xengine) + uses: actions/checkout@v3 + with: + repository: libxengine/xengine + path: xengine + + - name: Checkout dependency repository (vcpkg) + uses: actions/checkout@v3 + with: + repository: https://github.com/microsoft/vcpkg.git + path: vcpkg + + # 设置依赖库的环境变量 + - name: Set up Dependency Environment Variables + run: | + echo "XENGINE_INCLUDE=${{ github.workspace }}/xengine" | Out-File -FilePath $env:GITHUB_ENV -Append + echo "XENGINE_LIB32=${{ github.workspace }}/xengine/XEngine_Windows/x86" | Out-File -FilePath $env:GITHUB_ENV -Append + echo "XENGINE_LIB64=${{ github.workspace }}/xengine/XEngine_Windows/x64" | Out-File -FilePath $env:GITHUB_ENV -Append + shell: pwsh + + # 配置 MSBuild 的路径,准备构建 VC++ 项目 + - name: Setup MSBuild + uses: microsoft/setup-msbuild@v1.0.2 + #编译 + - name: Build Solution + run: msbuild XEngine_Source/XEngine.sln /p:Configuration=${{ matrix.configuration }} /p:Platform=${{ matrix.platform }} \ No newline at end of file diff --git a/.gitmodules b/.gitmodules index 1cc19745580726e61fcd1fbffbc1582904a552e0..1dde6ebf033a65193595f5baf6b851d9c11e4f6f 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +1,9 @@ [submodule "XEngine_Source/XEngine_Depend"] path = XEngine_Source/XEngine_Depend url = https://github.com/libxengine/XEngine_OPenSource.git +[submodule "XEngine_Source/XEngine_DBDepend/phonedata"] + path = XEngine_Source/XEngine_DBDepend/XEngine_PhoneData + url = https://github.com/libxengine/XEngine_PhoneData.git +[submodule "XEngine_Source/XEngine_DBDepend/XEngine_IPMacData"] + path = XEngine_Source/XEngine_DBDepend/XEngine_IPMacData + url = https://github.com/libxengine/XEngine_IPMacData.git diff --git a/CHANGELOG b/CHANGELOG index 93aed374c163a3ccea9e8c554583e32a6b9332b7..a865e5182f0964ba8aa3c03fcccb2250fc8de910 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,27 @@ +XEngine_APIService V3.6.0.1001 + +增加:mac地址供应商查询 +增加:ip和phone子模块替换插件模块 +增加:机器信息最后更新日期 +更新:ip和phone数据库并且添加mac数据库 +更新:配置文件以及增加数据库配置 +修改:机器信息的编码改为用户信息 +修改:机器信息不在兼容以往的版本 +修正:机器信息数据查询错误 +修正:windows石油查询名称乱码问题 +修正:windows下翻译乱码问题 + +added:mac address vendor query +added:ip sub module to plugin instead +added:last update time for machine +update:ip phone database and added mac addr database +update:configure file and added apimodule database +modify:code to user for machine info +modify:not compatible with previous version +fixed:sql query is incorrect for machine +fixed:oil query name is Garbled on window +fixed:transfer language chinese Garbled characters on windows +====================================================================================== XEngine_APIService V3.5.0.1001 增加:机器信息收集增加服务名字段 diff --git a/README.en.md b/README.en.md index c20bdd5c71b17b8e6edd7ebcd0529000ade1d455..9f872ea7352331bf12cde8ebb8e1dd3fac38f879 100644 --- a/README.en.md +++ b/README.en.md @@ -54,6 +54,7 @@ Support privatization deployment, free, safe, open source, controllable 33. heartbeat 34. STUN NAT Protocol 35. NTP Time Sync Protocol +36. mac address vendor query ## install diff --git a/README.md b/README.md index 3ff1335ed83d61dce7d0ff3aac8218b393ba0b1d..29732721d9ecad886d62137133b61a2d2f16259f 100644 --- a/README.md +++ b/README.md @@ -53,6 +53,7 @@ c c++ interface api service 33. 心跳处理 34. STUN NAT协议 35. NTP时间同步协议 +36. 支持MAC地址厂商查询 ## 安装教程 diff --git a/XEngine_Docment/Docment_en.docx b/XEngine_Docment/Docment_en.docx index b6f6ac111f2b9b205dea80def18e792d4d60bae6..75e92e03486ffebabb7b0bc7452d7fab8e7017d5 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 ce549778e1127b63a92881ccbfd984598238329a..1cb180e86c1f3efc41d235317305b458a5cfc4e0 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 bb334a280e360a3d0158fb7eea317a2097d900d8..a4d044d82c17e466042a505f158ceedfb2605936 100644 --- a/XEngine_Release/XEngine_Config/XEngine_Config.json +++ b/XEngine_Release/XEngine_Config/XEngine_Config.json @@ -62,6 +62,12 @@ "bDeamon":false } }, + "XAPIModule": { + "bEnable": true, + "tszDBPhone": "./XEngine_DBFile/phone.xdb", + "tszDBMac": "./XEngine_DBFile/macaddr.xdb", + "tszDBIPAddr": "./XEngine_DBFile/ip2region.xdb" + }, "XReport":{ "bEnable":true, "tszAPIUrl":"http://app.xyry.org:5501/api?function=machine", diff --git a/XEngine_Release/XEngine_Config/XEngine_PluginLib.json b/XEngine_Release/XEngine_Config/XEngine_PluginLib.json index dba093a37f0ffa6585ad5b49761556eb18a1d785..5bc54eccf7a06c2c267f01ba29cea6e99c15dabe 100644 --- a/XEngine_Release/XEngine_Config/XEngine_PluginLib.json +++ b/XEngine_Release/XEngine_Config/XEngine_PluginLib.json @@ -24,16 +24,6 @@ "PluginEnable":true, "PluginMethod":"meter", "PluginFile":"./XEngine_LibPlugin/libModulePlugin_Meter" - }, - { - "PluginEnable":true, - "PluginMethod":"phone", - "PluginFile":"./XEngine_LibPlugin/libModulePlugin_Phone" - }, - { - "PluginEnable":true, - "PluginMethod":"ip", - "PluginFile":"./XEngine_LibPlugin/libModulePlugin_IPAddr" } ] } \ 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 d5814dea3f4b99925306f244e7fe3e0240cf8549..5d9097f4a43cca739714420c345b17d3ff4a7e50 100644 --- a/XEngine_Release/XEngine_Config/XEngine_VersionConfig.json +++ b/XEngine_Release/XEngine_Config/XEngine_VersionConfig.json @@ -1,5 +1,6 @@ { "XVer":[ + "3.6.0.1001 Build20240705", "3.5.0.1001 Build20240510", "3.4.0.1001 Build20240411", "3.3.0.1001 Build20240308", diff --git a/XEngine_Release/XEngine_DBFile/ip2region.xdb b/XEngine_Release/XEngine_DBFile/ip2region.xdb index c78b792844dbbe2a3cd5aa1919dd75772ae7aa6e..7052c057104ddd0c57f3ec9a8a457e4ec8f7139d 100644 Binary files a/XEngine_Release/XEngine_DBFile/ip2region.xdb and b/XEngine_Release/XEngine_DBFile/ip2region.xdb differ diff --git a/XEngine_Release/XEngine_DBFile/macaddr.xdb b/XEngine_Release/XEngine_DBFile/macaddr.xdb new file mode 100644 index 0000000000000000000000000000000000000000..f32058d45c7602817a9d2d33584d2acfc0e1f2a4 Binary files /dev/null and b/XEngine_Release/XEngine_DBFile/macaddr.xdb differ diff --git a/XEngine_Release/XEngine_DBFile/phone.dat b/XEngine_Release/XEngine_DBFile/phone.xdb similarity index 30% rename from XEngine_Release/XEngine_DBFile/phone.dat rename to XEngine_Release/XEngine_DBFile/phone.xdb index 34bcab7fba2282eddbf95b59d88b39a41ffbb401..406dd99625ef4ab2a060e61625eaee56dde1566b 100644 Binary files a/XEngine_Release/XEngine_DBFile/phone.dat and b/XEngine_Release/XEngine_DBFile/phone.xdb differ diff --git a/XEngine_SQL/OilUPDate.sql b/XEngine_SQL/OilUPDate.sql new file mode 100644 index 0000000000000000000000000000000000000000..2964421245bfaced326766dc7b7bf5f39b31d9ca --- /dev/null +++ b/XEngine_SQL/OilUPDate.sql @@ -0,0 +1,31 @@ +UPDATE `OilPrice` SET `98` = 10.02, `95` = 8.52, `92` = 8.00, `0` = 7.72, `-10` = 8.18, `-20` = 8.57, `-35` = 8.88 WHERE `tszRegion` = '北京'; +UPDATE `OilPrice` SET `98` = 9.97, `95` = 8.47, `92` = 7.96, `0` = 7.65, `-10` = 8.11, `-20` = 0, `-35` = 0 WHERE `tszRegion` = '上海'; +UPDATE `OilPrice` SET `98` = 10.28, `95` = 8.48, `92` = 7.97, `0` = 7.63, `-10` = 8.09, `-20` = 0, `-35` = 0 WHERE `tszRegion` = '江苏'; +UPDATE `OilPrice` SET `98` = 9.95, `95` = 8.45, `92` = 7.99, `0` = 7.67, `-10` = 8.14, `-20` = 8.52, `-35` = 0 WHERE `tszRegion` = '天津'; +UPDATE `OilPrice` SET `98` = 10.28, `95` = 8.52, `92` = 8.06, `0` = 7.73, `-10` = 8.20, `-20` = 0, `-35` = 0 WHERE `tszRegion` = '重庆'; +UPDATE `OilPrice` SET `98` = 10.04, `95` = 8.54, `92` = 7.96, `0` = 7.72, `-10` = 8.25, `-20` = 0, `-35` = 0 WHERE `tszRegion` = '江西'; +UPDATE `OilPrice` SET `98` = 9.45, `95` = 8.67, `92` = 8.15, `0` = 7.57, `-10` = 0, `-20` = 0, `-35` = 8.68 WHERE `tszRegion` = '辽宁'; +UPDATE `OilPrice` SET `98` = 9.71, `95` = 8.51, `92` = 7.95, `0` = 7.71, `-10` = 8.17, `-20` = 0, `-35` = 0 WHERE `tszRegion` = '安徽'; +UPDATE `OilPrice` SET `98` = 9.29, `95` = 8.47, `92` = 7.93, `0` = 7.54, `-10` = 8.01, `-20` = 8.37, `-35` = 8.61 WHERE `tszRegion` = '内蒙古'; +UPDATE `OilPrice` SET `98` = 10.00, `95` = 8.50, `92` = 7.96, `0` = 7.66, `-10` = 8.12, `-20` = 0, `-35` = 0 WHERE `tszRegion` = '福建'; +UPDATE `OilPrice` SET `98` = 9.51, `95` = 8.35, `92` = 7.90, `0` = 7.55, `-10` = 8.01, `-20` = 8.38, `-35` = 8.69 WHERE `tszRegion` = '宁夏'; +UPDATE `OilPrice` SET `98` = 9.11, `95` = 8.54, `92` = 8.00, `0` = 7.57, `-10` = 8.03, `-20` = 8.46, `-35` = 8.72 WHERE `tszRegion` = '甘肃'; +UPDATE `OilPrice` SET `98` = 9.29, `95` = 8.53, `92` = 7.96, `0` = 7.59, `-10` = 8.05, `-20` = 8.43, `-35` = 8.73 WHERE `tszRegion` = '青海'; +UPDATE `OilPrice` SET `98` = 10.69, `95` = 8.69, `92` = 8.02, `0` = 7.68, `-10` = 0, `-20` = 0, `-35` = 0 WHERE `tszRegion` = '广东'; +UPDATE `OilPrice` SET `98` = 9.26, `95` = 8.54, `92` = 7.96, `0` = 7.58, `-10` = 8.02, `-20` = 8.37, `-35` = 8.67 WHERE `tszRegion` = '山东'; +UPDATE `OilPrice` SET `98` = 9.84, `95` = 8.71, `92` = 8.06, `0` = 7.73, `-10` = 0, `-20` = 0, `-35` = 0 WHERE `tszRegion` = '广西'; +UPDATE `OilPrice` SET `98` = 9.78, `95` = 8.58, `92` = 7.95, `0` = 7.74, `-10` = 8.21, `-20` = 8.59, `-35` = 8.90 WHERE `tszRegion` = '山西'; +UPDATE `OilPrice` SET `98` = 9.49, `95` = 8.59, `92` = 8.13, `0` = 7.77, `-10` = 8.24, `-20` = 0, `-35` = 0 WHERE `tszRegion` = '贵州'; +UPDATE `OilPrice` SET `98` = 10.94, `95` = 8.33, `92` = 7.88, `0` = 7.56, `-10` = 8.01, `-20` = 8.39, `-35` = 8.69 WHERE `tszRegion` = '陕西'; +UPDATE `OilPrice` SET `98` = 10.97, `95` = 9.68, `92` = 9.11, `0` = 7.76, `-10` = 0, `-20` = 0, `-35` = 0 WHERE `tszRegion` = '海南'; +UPDATE `OilPrice` SET `98` = 9.40, `95` = 8.65, `92` = 8.10, `0` = 7.72, `-10` = 8.18, `-20` = 8.48, `-35` = 0 WHERE `tszRegion` = '四川'; +UPDATE `OilPrice` SET `98` = 9.27, `95` = 8.45, `92` = 7.99, `0` = 7.67, `-10` = 8.14, `-20` = 8.52, `-35` = 8.83 WHERE `tszRegion` = '河北'; +UPDATE `OilPrice` SET `98` = 10.47, `95` = 9.39, `92` = 8.88, `0` = 8.21, `-10` = 8.72, `-20` = 9.15, `-35` = 9.44 WHERE `tszRegion` = '西藏'; +UPDATE `OilPrice` SET `98` = 9.44, `95` = 8.55, `92` = 8.01, `0` = 7.66, `-10` = 8.12, `-20` = 0, `-35` = 0 WHERE `tszRegion` = '河南'; +UPDATE `OilPrice` SET `98` = 9.32, `95` = 8.34, `92` = 7.80, `0` = 7.44, `-10` = 0, `-20` = 7.95, `-35` = 8.33 WHERE `tszRegion` = '新疆'; +UPDATE `OilPrice` SET `98` = 9.67, `95` = 8.53, `92` = 7.96, `0` = 7.47, `-10` = 0, `-20` = 0, `-35` = 8.59 WHERE `tszRegion` = '黑龙江'; +UPDATE `OilPrice` SET `98` = 9.36, `95` = 8.59, `92` = 7.96, `0` = 7.59, `-10` = 8.00, `-20` = 8.41, `-35` = 8.65 WHERE `tszRegion` = '吉林'; +UPDATE `OilPrice` SET `98` = 9.42, `95` = 8.74, `92` = 8.15, `0` = 7.74, `-10` = 0, `-20` = 0, `-35` = 0 WHERE `tszRegion` = '云南'; +UPDATE `OilPrice` SET `98` = 9.96, `95` = 8.58, `92` = 8.01, `0` = 7.66, `-10` = 0, `-20` = 0, `-35` = 0 WHERE `tszRegion` = '湖北'; +UPDATE `OilPrice` SET `98` = 9.29, `95` = 8.48, `92` = 7.97, `0` = 7.65, `-10` = 8.11, `-20` = 0, `-35` = 0 WHERE `tszRegion` = '浙江'; +UPDATE `OilPrice` SET `98` = 9.45, `95` = 8.45, `92` = 7.95, `0` = 7.74, `-10` = 0, `-20` = 0, `-35` = 0 WHERE `tszRegion` = '湖南'; \ No newline at end of file diff --git a/XEngine_SQL/XEngine_APIMachine.sql b/XEngine_SQL/XEngine_APIMachine.sql index 0c880b55a5c4c0928c6730bbb5aabf90446a32d8..2ae16b3b2dfa956b755e7a750f5601bdcaa99dfd 100644 --- a/XEngine_SQL/XEngine_APIMachine.sql +++ b/XEngine_SQL/XEngine_APIMachine.sql @@ -3,15 +3,15 @@ Source Server : mysql Source Server Type : MySQL - Source Server Version : 80036 (8.0.36-0ubuntu0.22.04.1) + Source Server Version : 80037 (8.0.37-0ubuntu0.22.04.3) Source Host : 10.0.3.154:3306 Source Schema : XEngine_APIMachine Target Server Type : MySQL - Target Server Version : 80036 (8.0.36-0ubuntu0.22.04.1) + Target Server Version : 80037 (8.0.37-0ubuntu0.22.04.3) File Encoding : 65001 - Date: 08/05/2024 15:41:55 + Date: 20/06/2024 17:32:50 */ SET NAMES utf8mb4; @@ -25,12 +25,13 @@ CREATE TABLE `XEngine_MachineList` ( `ID` int NOT NULL AUTO_INCREMENT COMMENT 'ID', `tszServiceName` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '服务名称', `tszMachineName` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '机器名称', - `tszMachineCode` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '机器序列', + `tszMachineUser` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '机器用户', `tszMachineSystem` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '系统名称', `tszMachineText` varchar(2048) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '机器信息', `nTimeNumber` bigint NOT NULL COMMENT '启动次数', + `tszLastTime` datetime NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', `tszCreateTime` datetime NOT NULL COMMENT '注册时间', PRIMARY KEY (`ID`) USING BTREE -) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci ROW_FORMAT = DYNAMIC; +) ENGINE = InnoDB AUTO_INCREMENT = 2 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci ROW_FORMAT = DYNAMIC; SET FOREIGN_KEY_CHECKS = 1; diff --git a/XEngine_Source/Makefile b/XEngine_Source/Makefile index 919d0bc1c50bbce39e72a15851a274066bf27114..456169d2b3c76aaa92c5ee61f60ecd06ba34b4de 100644 --- a/XEngine_Source/Makefile +++ b/XEngine_Source/Makefile @@ -4,9 +4,6 @@ PLATFORM=linux FLAGS= #要编译的模块 -THIRDPART_MODULE_JSONCPP = ./XEngine_Depend/XEngine_Module/jsoncpp -THIRDPART_MODULE_REPORT = ./XEngine_Depend/XEngine_Module/XEngine_InfoReport - MODULE_CONFIGURE_PATH = ./XEngine_ModuleConfigure MODULE_DATABASE_PATH = ./XEngine_ModuleDatabase MODULE_PROTOCOL_PATH = ./XEngine_ModuleProtocol @@ -19,25 +16,24 @@ PLUGIN_MODULE_PASSWORD = ./XEngine_PluginModule/ModulePlugin_Password PLUGIN_MODULE_TIMEZONE = ./XEngine_PluginModule/ModulePlugin_Timezone PLUGIN_MODULE_BMINDEX = ./XEngine_PluginModule/ModulePlugin_BMIndex PLUGIN_MODULE_METER = ./XEngine_PluginModule/ModulePlugin_Meter -PLUGIN_MODULE_PHONE = ./XEngine_PluginModule/ModulePlugin_Phone -PLUGIN_MODULE_IPADDR = ./XEngine_PluginModule/ModulePlugin_IPAddr -APP_CENTER_PATH = ./XEngine_ServiceApp/XEngine_CenterApp +THIRDPART_MODULE_JSONCPP = ./XEngine_Depend/XEngine_Module/jsoncpp +THIRDPART_MODULE_REPORT = ./XEngine_Depend/XEngine_Module/XEngine_InfoReport + +APIMODULE_PHONE_PATH = ./XEngine_DBDepend/XEngine_PhoneData/Source/C/XEngine_APIModulePhone +APIMODULE_IPMAC_PATH = ./XEngine_DBDepend/XEngine_IPMacData/XEngine_Source/XEngine_APIModuleIPMac + APP_HTTP_PATH = ./XEngine_ServiceApp/XEngine_HttpApp XENGINE_MODULES = libjsoncpp.so libXEngine_InfoReport.so \ - libXEngine_ModuleConfigure.so libXEngine_ModuleDatabase.so libXEngine_ModuleProtocol.so libXEngine_ModuleSystem.so libXEngine_ModuleHelp.so libXEngine_ModulePlugin.so \ - libModulePlugin_Zodiac.so libModulePlugin_Password.so libModulePlugin_Timezone.so libModulePlugin_BMIndex.so libModulePlugin_Meter.so libModulePlugin_Phone.so libModulePlugin_IPAddr.so \ + libXEngine_ModuleConfigure.so libXEngine_ModuleDatabase.so libXEngine_ModuleProtocol.so libXEngine_ModuleSystem.so libXEngine_ModuleHelp.so libXEngine_ModulePlugin.so \ + libModulePlugin_Zodiac.so libModulePlugin_Password.so libModulePlugin_Timezone.so libModulePlugin_BMIndex.so libModulePlugin_Meter.so \ + libXEngine_APIModulePhone.so libXEngine_APIModuleIPMac.so \ XEngine_HttpApp.exe .PHONY:MakeAll MakeAll:$(XENGINE_MODULES) -libjsoncpp.so: - make -C $(THIRDPART_MODULE_JSONCPP) PLATFORM=$(PLATFORM) $(FLAGS) -libXEngine_InfoReport.so: - make -C $(THIRDPART_MODULE_REPORT) PLATFORM=$(PLATFORM) $(FLAGS) - libXEngine_ModuleConfigure.so: make -C $(MODULE_CONFIGURE_PATH) PLATFORM=$(PLATFORM) $(FLAGS) libXEngine_ModuleDatabase.so: @@ -61,10 +57,32 @@ libModulePlugin_BMIndex.so: make -C $(PLUGIN_MODULE_BMINDEX) PLATFORM=$(PLATFORM) $(FLAGS) libModulePlugin_Meter.so: make -C $(PLUGIN_MODULE_METER) PLATFORM=$(PLATFORM) $(FLAGS) -libModulePlugin_Phone.so: - make -C $(PLUGIN_MODULE_PHONE) PLATFORM=$(PLATFORM) $(FLAGS) -libModulePlugin_IPAddr.so: - make -C $(PLUGIN_MODULE_IPADDR) PLATFORM=$(PLATFORM) $(FLAGS) +libjsoncpp.so: +ifeq ($(FLAGS), InstallAll) + cp $(THIRDPART_MODULE_JSONCPP)/libjsoncpp.so ../XEngine_Release/ +else + make -C $(THIRDPART_MODULE_JSONCPP) PLATFORM=$(PLATFORM) $(FLAGS) +endif +libXEngine_InfoReport.so: +ifeq ($(FLAGS), InstallAll) + cp $(THIRDPART_MODULE_REPORT)/libXEngine_InfoReport.so ../XEngine_Release/ +else + make -C $(THIRDPART_MODULE_REPORT) PLATFORM=$(PLATFORM) $(FLAGS) +endif + +libXEngine_APIModulePhone.so: +ifeq ($(FLAGS), InstallAll) + cp $(APIMODULE_PHONE_PATH)/libXEngine_APIModulePhone.so ../XEngine_Release/ +else + make -C $(APIMODULE_PHONE_PATH) PLATFORM=$(PLATFORM) $(FLAGS) +endif +libXEngine_APIModuleIPMac.so: +ifeq ($(FLAGS), InstallAll) + cp $(APIMODULE_IPMAC_PATH)/libXEngine_APIModuleIPMac.so ../XEngine_Release/ +else + make -C $(APIMODULE_IPMAC_PATH) PLATFORM=$(PLATFORM) $(FLAGS) +endif + XEngine_HttpApp.exe: make -C $(APP_HTTP_PATH) PLATFORM=$(PLATFORM) $(FLAGS) diff --git a/XEngine_Source/VSCopy-Debug.bat b/XEngine_Source/VSCopy-Debug.bat index 63161120b8457dfb0e8c2be06b2a92443ebd91cc..98b7e53be9b1afd2bde1e7c726dc1e3850c17f4d 100644 --- a/XEngine_Source/VSCopy-Debug.bat +++ b/XEngine_Source/VSCopy-Debug.bat @@ -1,4 +1,5 @@ copy /y "D:\XEngine\XEngine_SourceCode\Debug\XEngine_BaseLib.dll" "./" +copy /y "D:\XEngine\XEngine_SourceCode\Debug\XEngine_BaseSafe.dll" "./" copy /y "D:\XEngine\XEngine_SourceCode\Debug\XEngine_Algorithm.dll" "./" copy /y "D:\XEngine\XEngine_SourceCode\Debug\XEngine_Core.dll" "./" copy /y "D:\XEngine\XEngine_SourceCode\Debug\XEngine_ManagePool.dll" "./" diff --git a/XEngine_Source/VSCopy-x64.bat b/XEngine_Source/VSCopy-x64.bat index 3403082482dd7d62100db3646834ba16c12595b5..c9fab9319c679409953d2f765c96fc9a5d6d682b 100644 --- a/XEngine_Source/VSCopy-x64.bat +++ b/XEngine_Source/VSCopy-x64.bat @@ -1,4 +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_BaseLib\XEngine_Algorithm.dll" "./" copy /y "%XEngine_Lib64%\XEngine_Core\XEngine_Core.dll" "./" copy /y "%XEngine_Lib64%\XEngine_Core\XEngine_ManagePool.dll" "./" diff --git a/XEngine_Source/VSCopy-x86.bat b/XEngine_Source/VSCopy-x86.bat index 92a1953b2622efd8e82cb1c2fd39776e1bfa86c2..c44cb9cdc00d6ce36e4c711ddab77780831c1b0f 100644 --- a/XEngine_Source/VSCopy-x86.bat +++ b/XEngine_Source/VSCopy-x86.bat @@ -1,4 +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_BaseLib\XEngine_Algorithm.dll" "./" copy /y "%XEngine_Lib32%\XEngine_Core\XEngine_Core.dll" "./" copy /y "%XEngine_Lib32%\XEngine_Core\XEngine_ManagePool.dll" "./" diff --git a/XEngine_Source/XEngine.sln b/XEngine_Source/XEngine.sln index 1702a839317b55f96066765b8e4f85e6aea2eb5d..1e5ddbd30fab4b56a22a8f08b65d6fb5c8021d68 100644 --- a/XEngine_Source/XEngine.sln +++ b/XEngine_Source/XEngine.sln @@ -5,7 +5,7 @@ VisualStudioVersion = 17.1.32210.238 MinimumVisualStudioVersion = 10.0.40219.1 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "XEngine_ModuleConfigure", "XEngine_ModuleConfigure\XEngine_ModuleConfigure.vcxproj", "{F54F152C-594F-4465-A44E-2DB915B39760}" ProjectSection(ProjectDependencies) = postProject - {81DD7437-D986-4C9E-848C-589856FACEBD} = {81DD7437-D986-4C9E-848C-589856FACEBD} + {F1736B3F-03A2-4FC7-B045-A12BA8D724FB} = {F1736B3F-03A2-4FC7-B045-A12BA8D724FB} EndProjectSection EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "XEngine_UserHdr", "XEngine_UserHdr", "{9E4F2158-9AC1-4C19-A3F7-375A9DBCF856}" @@ -25,12 +25,10 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "XEngine_HttpApp", "XEngine_ {6C935BE1-77E3-4719-A7A6-C76ABAFEE010} = {6C935BE1-77E3-4719-A7A6-C76ABAFEE010} {6D0FCB40-D544-4AB2-A239-2FEBC4B98F6D} = {6D0FCB40-D544-4AB2-A239-2FEBC4B98F6D} {6F111577-DAF8-4294-B516-0077C22D7613} = {6F111577-DAF8-4294-B516-0077C22D7613} - {81DD7437-D986-4C9E-848C-589856FACEBD} = {81DD7437-D986-4C9E-848C-589856FACEBD} - {8FBC495D-C05E-49A4-B938-A81C9DFC1E5A} = {8FBC495D-C05E-49A4-B938-A81C9DFC1E5A} + {F1736B3F-03A2-4FC7-B045-A12BA8D724FB} = {F1736B3F-03A2-4FC7-B045-A12BA8D724FB} {92F971AB-CAC9-4D9B-A9CA-AFD9CA17E505} = {92F971AB-CAC9-4D9B-A9CA-AFD9CA17E505} {BBC4B2B4-1143-45DF-8890-47CE26A61D0E} = {BBC4B2B4-1143-45DF-8890-47CE26A61D0E} {CB443280-E283-44CD-B956-52C404A51DB6} = {CB443280-E283-44CD-B956-52C404A51DB6} - {D549160C-CC16-47F8-8345-1F4CF7A25CA2} = {D549160C-CC16-47F8-8345-1F4CF7A25CA2} {F54F152C-594F-4465-A44E-2DB915B39760} = {F54F152C-594F-4465-A44E-2DB915B39760} {F6520D2C-BB8E-45BB-964B-F5D6A4318A89} = {F6520D2C-BB8E-45BB-964B-F5D6A4318A89} EndProjectSection @@ -39,7 +37,7 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "XEngine_ModuleDatabase", "X EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "XEngine_ModuleProtocol", "XEngine_ModuleProtocol\XEngine_ModuleProtocol.vcxproj", "{6C935BE1-77E3-4719-A7A6-C76ABAFEE010}" ProjectSection(ProjectDependencies) = postProject - {81DD7437-D986-4C9E-848C-589856FACEBD} = {81DD7437-D986-4C9E-848C-589856FACEBD} + {F1736B3F-03A2-4FC7-B045-A12BA8D724FB} = {F1736B3F-03A2-4FC7-B045-A12BA8D724FB} EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "XEngine_ModuleHelp", "XEngine_ModuleHelp\XEngine_ModuleHelp.vcxproj", "{6D0FCB40-D544-4AB2-A239-2FEBC4B98F6D}" @@ -50,50 +48,46 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "XEngine_PluginModule", "XEn EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libModulePlugin_Zodiac", "XEngine_PluginModule\ModulePlugin_Zodiac\ModulePlugin_Zodiac.vcxproj", "{32BB166A-3D3D-45EF-8BED-2E0471274159}" ProjectSection(ProjectDependencies) = postProject - {81DD7437-D986-4C9E-848C-589856FACEBD} = {81DD7437-D986-4C9E-848C-589856FACEBD} + {F1736B3F-03A2-4FC7-B045-A12BA8D724FB} = {F1736B3F-03A2-4FC7-B045-A12BA8D724FB} EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libModulePlugin_Password", "XEngine_PluginModule\ModulePlugin_Password\ModulePlugin_Password.vcxproj", "{201B6D13-82A7-49E9-9736-D6B3BFE05B30}" ProjectSection(ProjectDependencies) = postProject - {81DD7437-D986-4C9E-848C-589856FACEBD} = {81DD7437-D986-4C9E-848C-589856FACEBD} + {F1736B3F-03A2-4FC7-B045-A12BA8D724FB} = {F1736B3F-03A2-4FC7-B045-A12BA8D724FB} EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libModulePlugin_Timezone", "XEngine_PluginModule\ModulePlugin_Timezone\ModulePlugin_Timezone.vcxproj", "{37B8E91F-EC52-41F0-B21D-441D4270C05F}" ProjectSection(ProjectDependencies) = postProject - {81DD7437-D986-4C9E-848C-589856FACEBD} = {81DD7437-D986-4C9E-848C-589856FACEBD} + {F1736B3F-03A2-4FC7-B045-A12BA8D724FB} = {F1736B3F-03A2-4FC7-B045-A12BA8D724FB} EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libModulePlugin_BMIndex", "XEngine_PluginModule\ModulePlugin_BMIndex\ModulePlugin_BMIndex.vcxproj", "{BBC4B2B4-1143-45DF-8890-47CE26A61D0E}" ProjectSection(ProjectDependencies) = postProject - {81DD7437-D986-4C9E-848C-589856FACEBD} = {81DD7437-D986-4C9E-848C-589856FACEBD} + {F1736B3F-03A2-4FC7-B045-A12BA8D724FB} = {F1736B3F-03A2-4FC7-B045-A12BA8D724FB} EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libModulePlugin_Meter", "XEngine_PluginModule\ModulePlugin_Meter\ModulePlugin_Meter.vcxproj", "{6F111577-DAF8-4294-B516-0077C22D7613}" ProjectSection(ProjectDependencies) = postProject - {81DD7437-D986-4C9E-848C-589856FACEBD} = {81DD7437-D986-4C9E-848C-589856FACEBD} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libModulePlugin_Phone", "XEngine_PluginModule\ModulePlugin_Phone\ModulePlugin_Phone.vcxproj", "{8FBC495D-C05E-49A4-B938-A81C9DFC1E5A}" - ProjectSection(ProjectDependencies) = postProject - {81DD7437-D986-4C9E-848C-589856FACEBD} = {81DD7437-D986-4C9E-848C-589856FACEBD} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libModulePlugin_IPAddr", "XEngine_PluginModule\ModulePlugin_IPAddr\ModulePlugin_IPAddr.vcxproj", "{D549160C-CC16-47F8-8345-1F4CF7A25CA2}" - ProjectSection(ProjectDependencies) = postProject - {81DD7437-D986-4C9E-848C-589856FACEBD} = {81DD7437-D986-4C9E-848C-589856FACEBD} + {F1736B3F-03A2-4FC7-B045-A12BA8D724FB} = {F1736B3F-03A2-4FC7-B045-A12BA8D724FB} EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "XEngine_ModuleSystem", "XEngine_ModuleSystem\XEngine_ModuleSystem.vcxproj", "{92F971AB-CAC9-4D9B-A9CA-AFD9CA17E505}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "XEngine_Depend", "XEngine_Depend", "{2B89A3C7-0CC8-4881-B195-61BAA9ACB78B}" EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "jsoncpp", "XEngine_Depend\XEngine_Module\jsoncpp\jsoncpp.vcxproj", "{81DD7437-D986-4C9E-848C-589856FACEBD}" +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "jsoncpp", "XEngine_Depend\XEngine_Module\jsoncpp\jsoncpp.vcxproj", "{F1736B3F-03A2-4FC7-B045-A12BA8D724FB}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "XEngine_InfoReport", "XEngine_Depend\XEngine_Module\XEngine_InfoReport\XEngine_InfoReport.vcxproj", "{F6520D2C-BB8E-45BB-964B-F5D6A4318A89}" ProjectSection(ProjectDependencies) = postProject - {81DD7437-D986-4C9E-848C-589856FACEBD} = {81DD7437-D986-4C9E-848C-589856FACEBD} + {F1736B3F-03A2-4FC7-B045-A12BA8D724FB} = {F1736B3F-03A2-4FC7-B045-A12BA8D724FB} EndProjectSection EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "XEngine_DBDepend", "XEngine_DBDepend", "{91E64672-DF39-4F32-87FA-0F7AADA92D73}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "XEngine_APIModuleIPMac", "XEngine_DBDepend\XEngine_IPMacData\XEngine_Source\XEngine_APIModuleIPMac\XEngine_APIModuleIPMac.vcxproj", "{FFAC032D-4F8C-4C70-AF36-D79685A6961F}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "XEngine_APIModulePhone", "XEngine_DBDepend\XEngine_PhoneData\Source\C\XEngine_APIModulePhone\XEngine_APIModulePhone.vcxproj", "{A13B72E7-FC40-4A27-81C3-26DF3C8F4C0A}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|x64 = Debug|x64 @@ -190,22 +184,6 @@ Global {6F111577-DAF8-4294-B516-0077C22D7613}.Release|x64.Build.0 = Release|x64 {6F111577-DAF8-4294-B516-0077C22D7613}.Release|x86.ActiveCfg = Release|Win32 {6F111577-DAF8-4294-B516-0077C22D7613}.Release|x86.Build.0 = Release|Win32 - {8FBC495D-C05E-49A4-B938-A81C9DFC1E5A}.Debug|x64.ActiveCfg = Debug|x64 - {8FBC495D-C05E-49A4-B938-A81C9DFC1E5A}.Debug|x64.Build.0 = Debug|x64 - {8FBC495D-C05E-49A4-B938-A81C9DFC1E5A}.Debug|x86.ActiveCfg = Debug|Win32 - {8FBC495D-C05E-49A4-B938-A81C9DFC1E5A}.Debug|x86.Build.0 = Debug|Win32 - {8FBC495D-C05E-49A4-B938-A81C9DFC1E5A}.Release|x64.ActiveCfg = Release|x64 - {8FBC495D-C05E-49A4-B938-A81C9DFC1E5A}.Release|x64.Build.0 = Release|x64 - {8FBC495D-C05E-49A4-B938-A81C9DFC1E5A}.Release|x86.ActiveCfg = Release|Win32 - {8FBC495D-C05E-49A4-B938-A81C9DFC1E5A}.Release|x86.Build.0 = Release|Win32 - {D549160C-CC16-47F8-8345-1F4CF7A25CA2}.Debug|x64.ActiveCfg = Debug|x64 - {D549160C-CC16-47F8-8345-1F4CF7A25CA2}.Debug|x64.Build.0 = Debug|x64 - {D549160C-CC16-47F8-8345-1F4CF7A25CA2}.Debug|x86.ActiveCfg = Debug|Win32 - {D549160C-CC16-47F8-8345-1F4CF7A25CA2}.Debug|x86.Build.0 = Debug|Win32 - {D549160C-CC16-47F8-8345-1F4CF7A25CA2}.Release|x64.ActiveCfg = Release|x64 - {D549160C-CC16-47F8-8345-1F4CF7A25CA2}.Release|x64.Build.0 = Release|x64 - {D549160C-CC16-47F8-8345-1F4CF7A25CA2}.Release|x86.ActiveCfg = Release|Win32 - {D549160C-CC16-47F8-8345-1F4CF7A25CA2}.Release|x86.Build.0 = Release|Win32 {92F971AB-CAC9-4D9B-A9CA-AFD9CA17E505}.Debug|x64.ActiveCfg = Debug|x64 {92F971AB-CAC9-4D9B-A9CA-AFD9CA17E505}.Debug|x64.Build.0 = Debug|x64 {92F971AB-CAC9-4D9B-A9CA-AFD9CA17E505}.Debug|x86.ActiveCfg = Debug|Win32 @@ -214,14 +192,14 @@ Global {92F971AB-CAC9-4D9B-A9CA-AFD9CA17E505}.Release|x64.Build.0 = Release|x64 {92F971AB-CAC9-4D9B-A9CA-AFD9CA17E505}.Release|x86.ActiveCfg = Release|Win32 {92F971AB-CAC9-4D9B-A9CA-AFD9CA17E505}.Release|x86.Build.0 = Release|Win32 - {81DD7437-D986-4C9E-848C-589856FACEBD}.Debug|x64.ActiveCfg = Debug|x64 - {81DD7437-D986-4C9E-848C-589856FACEBD}.Debug|x64.Build.0 = Debug|x64 - {81DD7437-D986-4C9E-848C-589856FACEBD}.Debug|x86.ActiveCfg = Debug|Win32 - {81DD7437-D986-4C9E-848C-589856FACEBD}.Debug|x86.Build.0 = Debug|Win32 - {81DD7437-D986-4C9E-848C-589856FACEBD}.Release|x64.ActiveCfg = Release|x64 - {81DD7437-D986-4C9E-848C-589856FACEBD}.Release|x64.Build.0 = Release|x64 - {81DD7437-D986-4C9E-848C-589856FACEBD}.Release|x86.ActiveCfg = Release|Win32 - {81DD7437-D986-4C9E-848C-589856FACEBD}.Release|x86.Build.0 = Release|Win32 + {F1736B3F-03A2-4FC7-B045-A12BA8D724FB}.Debug|x64.ActiveCfg = Debug|x64 + {F1736B3F-03A2-4FC7-B045-A12BA8D724FB}.Debug|x64.Build.0 = Debug|x64 + {F1736B3F-03A2-4FC7-B045-A12BA8D724FB}.Debug|x86.ActiveCfg = Debug|Win32 + {F1736B3F-03A2-4FC7-B045-A12BA8D724FB}.Debug|x86.Build.0 = Debug|Win32 + {F1736B3F-03A2-4FC7-B045-A12BA8D724FB}.Release|x64.ActiveCfg = Release|x64 + {F1736B3F-03A2-4FC7-B045-A12BA8D724FB}.Release|x64.Build.0 = Release|x64 + {F1736B3F-03A2-4FC7-B045-A12BA8D724FB}.Release|x86.ActiveCfg = Release|Win32 + {F1736B3F-03A2-4FC7-B045-A12BA8D724FB}.Release|x86.Build.0 = Release|Win32 {F6520D2C-BB8E-45BB-964B-F5D6A4318A89}.Debug|x64.ActiveCfg = Debug|x64 {F6520D2C-BB8E-45BB-964B-F5D6A4318A89}.Debug|x64.Build.0 = Debug|x64 {F6520D2C-BB8E-45BB-964B-F5D6A4318A89}.Debug|x86.ActiveCfg = Debug|Win32 @@ -230,6 +208,22 @@ Global {F6520D2C-BB8E-45BB-964B-F5D6A4318A89}.Release|x64.Build.0 = Release|x64 {F6520D2C-BB8E-45BB-964B-F5D6A4318A89}.Release|x86.ActiveCfg = Release|Win32 {F6520D2C-BB8E-45BB-964B-F5D6A4318A89}.Release|x86.Build.0 = Release|Win32 + {FFAC032D-4F8C-4C70-AF36-D79685A6961F}.Debug|x64.ActiveCfg = Debug|x64 + {FFAC032D-4F8C-4C70-AF36-D79685A6961F}.Debug|x64.Build.0 = Debug|x64 + {FFAC032D-4F8C-4C70-AF36-D79685A6961F}.Debug|x86.ActiveCfg = Debug|Win32 + {FFAC032D-4F8C-4C70-AF36-D79685A6961F}.Debug|x86.Build.0 = Debug|Win32 + {FFAC032D-4F8C-4C70-AF36-D79685A6961F}.Release|x64.ActiveCfg = Release|x64 + {FFAC032D-4F8C-4C70-AF36-D79685A6961F}.Release|x64.Build.0 = Release|x64 + {FFAC032D-4F8C-4C70-AF36-D79685A6961F}.Release|x86.ActiveCfg = Release|Win32 + {FFAC032D-4F8C-4C70-AF36-D79685A6961F}.Release|x86.Build.0 = Release|Win32 + {A13B72E7-FC40-4A27-81C3-26DF3C8F4C0A}.Debug|x64.ActiveCfg = Debug|x64 + {A13B72E7-FC40-4A27-81C3-26DF3C8F4C0A}.Debug|x64.Build.0 = Debug|x64 + {A13B72E7-FC40-4A27-81C3-26DF3C8F4C0A}.Debug|x86.ActiveCfg = Debug|Win32 + {A13B72E7-FC40-4A27-81C3-26DF3C8F4C0A}.Debug|x86.Build.0 = Debug|Win32 + {A13B72E7-FC40-4A27-81C3-26DF3C8F4C0A}.Release|x64.ActiveCfg = Release|x64 + {A13B72E7-FC40-4A27-81C3-26DF3C8F4C0A}.Release|x64.Build.0 = Release|x64 + {A13B72E7-FC40-4A27-81C3-26DF3C8F4C0A}.Release|x86.ActiveCfg = Release|Win32 + {A13B72E7-FC40-4A27-81C3-26DF3C8F4C0A}.Release|x86.Build.0 = Release|Win32 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -241,10 +235,10 @@ Global {37B8E91F-EC52-41F0-B21D-441D4270C05F} = {D0473C03-9464-4C44-818A-AE212680CD05} {BBC4B2B4-1143-45DF-8890-47CE26A61D0E} = {D0473C03-9464-4C44-818A-AE212680CD05} {6F111577-DAF8-4294-B516-0077C22D7613} = {D0473C03-9464-4C44-818A-AE212680CD05} - {8FBC495D-C05E-49A4-B938-A81C9DFC1E5A} = {D0473C03-9464-4C44-818A-AE212680CD05} - {D549160C-CC16-47F8-8345-1F4CF7A25CA2} = {D0473C03-9464-4C44-818A-AE212680CD05} - {81DD7437-D986-4C9E-848C-589856FACEBD} = {2B89A3C7-0CC8-4881-B195-61BAA9ACB78B} + {F1736B3F-03A2-4FC7-B045-A12BA8D724FB} = {2B89A3C7-0CC8-4881-B195-61BAA9ACB78B} {F6520D2C-BB8E-45BB-964B-F5D6A4318A89} = {2B89A3C7-0CC8-4881-B195-61BAA9ACB78B} + {FFAC032D-4F8C-4C70-AF36-D79685A6961F} = {91E64672-DF39-4F32-87FA-0F7AADA92D73} + {A13B72E7-FC40-4A27-81C3-26DF3C8F4C0A} = {91E64672-DF39-4F32-87FA-0F7AADA92D73} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {9B202F91-A601-429E-BB0F-880DDEE096FE} diff --git a/XEngine_Source/XEngine_DBDepend/XEngine_IPMacData b/XEngine_Source/XEngine_DBDepend/XEngine_IPMacData new file mode 160000 index 0000000000000000000000000000000000000000..7b501e530987c5b9517e7885cb396b9dcb962d17 --- /dev/null +++ b/XEngine_Source/XEngine_DBDepend/XEngine_IPMacData @@ -0,0 +1 @@ +Subproject commit 7b501e530987c5b9517e7885cb396b9dcb962d17 diff --git a/XEngine_Source/XEngine_DBDepend/XEngine_PhoneData b/XEngine_Source/XEngine_DBDepend/XEngine_PhoneData new file mode 160000 index 0000000000000000000000000000000000000000..f17167b09d446c5fdc45d23b27194011de558967 --- /dev/null +++ b/XEngine_Source/XEngine_DBDepend/XEngine_PhoneData @@ -0,0 +1 @@ +Subproject commit f17167b09d446c5fdc45d23b27194011de558967 diff --git a/XEngine_Source/XEngine_Depend b/XEngine_Source/XEngine_Depend index adf061695f1c6a79fda9feda118c2fdd9efce8f1..1af95ee3737450c0b2739f0b4cc37a3f2c9eef10 160000 --- a/XEngine_Source/XEngine_Depend +++ b/XEngine_Source/XEngine_Depend @@ -1 +1 @@ -Subproject commit adf061695f1c6a79fda9feda118c2fdd9efce8f1 +Subproject commit 1af95ee3737450c0b2739f0b4cc37a3f2c9eef10 diff --git a/XEngine_Source/XEngine_ModuleConfigure/ModuleConfig_Define.h b/XEngine_Source/XEngine_ModuleConfigure/ModuleConfig_Define.h index fcb04443a2c7de5b9993c3f6a868017b3f1026e3..e70b6cb461074605ac831778dc75741151270abd 100644 --- a/XEngine_Source/XEngine_ModuleConfigure/ModuleConfig_Define.h +++ b/XEngine_Source/XEngine_ModuleConfigure/ModuleConfig_Define.h @@ -96,6 +96,13 @@ typedef struct }st_VerSwitch; }st_XVerifcation; struct + { + bool bEnable; + XCHAR tszDBPhone[MAX_PATH]; + XCHAR tszDBMac[MAX_PATH]; + XCHAR tszDBIPAddr[MAX_PATH]; + }st_XAPIModule; + struct { bool bEnable; XCHAR tszAPIUrl[MAX_PATH]; diff --git a/XEngine_Source/XEngine_ModuleConfigure/ModuleConfigure_Json/ModuleConfigure_Json.cpp b/XEngine_Source/XEngine_ModuleConfigure/ModuleConfigure_Json/ModuleConfigure_Json.cpp index 3a7a9bcefe76b849cf4517e37351ec68a0869a98..9435d627c8ccc6a607a94078a6b77561627634a7 100644 --- a/XEngine_Source/XEngine_ModuleConfigure/ModuleConfigure_Json/ModuleConfigure_Json.cpp +++ b/XEngine_Source/XEngine_ModuleConfigure/ModuleConfigure_Json/ModuleConfigure_Json.cpp @@ -200,6 +200,18 @@ bool CModuleConfigure_Json::ModuleConfigure_Json_File(LPCXSTR lpszConfigFile, XE pSt_ServerConfig->st_XVerifcation.st_VerSwitch.bBackService = st_JsonVerSwitch["bBackService"].asBool(); pSt_ServerConfig->st_XVerifcation.st_VerSwitch.bDeamon = st_JsonVerSwitch["bDeamon"].asBool(); + if (st_JsonRoot["XAPIModule"].empty() || (4 != st_JsonRoot["XAPIModule"].size())) + { + Config_IsErrorOccur = true; + Config_dwErrorCode = ERROR_MODULE_CONFIGURE_JSON_XREPORT; + return false; + } + Json::Value st_JsonXAPIModule = st_JsonRoot["XAPIModule"]; + pSt_ServerConfig->st_XAPIModule.bEnable = st_JsonXAPIModule["bEnable"].asBool(); + _tcsxcpy(pSt_ServerConfig->st_XAPIModule.tszDBIPAddr, st_JsonXAPIModule["tszDBIPAddr"].asCString()); + _tcsxcpy(pSt_ServerConfig->st_XAPIModule.tszDBMac, st_JsonXAPIModule["tszDBMac"].asCString()); + _tcsxcpy(pSt_ServerConfig->st_XAPIModule.tszDBPhone, st_JsonXAPIModule["tszDBPhone"].asCString()); + if (st_JsonRoot["XReport"].empty() || (3 != st_JsonRoot["XReport"].size())) { Config_IsErrorOccur = true; diff --git a/XEngine_Source/XEngine_ModuleDatabase/ModuleDatabase_Machine/ModuleDatabase_Machine.cpp b/XEngine_Source/XEngine_ModuleDatabase/ModuleDatabase_Machine/ModuleDatabase_Machine.cpp index 00e693a08a2419e115d9dd517b8feff6b3958be9..f3e9b413982382dbfd909babf4040e1fe05c2c54 100644 --- a/XEngine_Source/XEngine_ModuleDatabase/ModuleDatabase_Machine/ModuleDatabase_Machine.cpp +++ b/XEngine_Source/XEngine_ModuleDatabase/ModuleDatabase_Machine/ModuleDatabase_Machine.cpp @@ -95,7 +95,7 @@ bool CModuleDatabase_Machine::ModuleDatabase_Machine_Insert(XENGINE_MACHINEINFO* XCHAR tszSQLStatement[4096]; memset(tszSQLStatement, '\0', sizeof(tszSQLStatement)); - _xstprintf(tszSQLStatement, _X("INSERT INTO `XEngine_MachineList` (tszServiceName,tszMachineName,tszMachineCode,tszMachineSystem,tszMachineText,nTimeNumber,tszCreateTime) VALUES('%s','%s','%s','%s','%s',%lld,now())"), pSt_MachineInfo->tszServiceName, pSt_MachineInfo->tszMachineName, pSt_MachineInfo->tszMachineCode, pSt_MachineInfo->tszMachineSystem, pSt_MachineInfo->tszMachineText, pSt_MachineInfo->nTimeNumber); + _xstprintf(tszSQLStatement, _X("INSERT INTO `XEngine_MachineList` (tszServiceName,tszMachineName,tszMachineUser,tszMachineSystem,tszMachineText,nTimeNumber,tszCreateTime) VALUES('%s','%s','%s','%s','%s',%lld,now())"), pSt_MachineInfo->tszServiceName, pSt_MachineInfo->tszMachineName, pSt_MachineInfo->tszMachineUser, pSt_MachineInfo->tszMachineSystem, pSt_MachineInfo->tszMachineText, pSt_MachineInfo->nTimeNumber); #ifdef _MSC_BUILD XCHAR tszUTFStr[4096] = {}; int nSLen = _tcsxlen(tszSQLStatement); @@ -142,14 +142,7 @@ bool CModuleDatabase_Machine::ModuleDatabase_Machine_Query(XENGINE_MACHINEINFO* XCHAR tszSQLStatement[1024]; memset(tszSQLStatement, '\0', sizeof(tszSQLStatement)); - if (_tcsxlen(pSt_MachineInfo->tszServiceName) > 0) - { - _xstprintf(tszSQLStatement, _X("SELECT * FROM `XEngine_MachineList` WHERE tszMachineCode = '%s' AND tszServiceName = '%s'"), pSt_MachineInfo->tszMachineCode, pSt_MachineInfo->tszServiceName); - } - else - { - _xstprintf(tszSQLStatement, _X("SELECT * FROM `XEngine_MachineList` WHERE tszMachineCode = '%s'"), pSt_MachineInfo->tszMachineCode); - } + _xstprintf(tszSQLStatement, _X("SELECT * FROM `XEngine_MachineList` WHERE tszMachineSystem = '%s' AND tszServiceName = '%s'"), pSt_MachineInfo->tszMachineSystem, pSt_MachineInfo->tszServiceName); if (!DataBase_MySQL_ExecuteQuery(xhDBSQL, &xhTable, tszSQLStatement, &nllLine, &nllRow)) { DBModule_IsErrorOccur = true; @@ -180,7 +173,7 @@ bool CModuleDatabase_Machine::ModuleDatabase_Machine_Query(XENGINE_MACHINEINFO* } if (NULL != pptszResult[3]) { - _tcsxcpy(pSt_MachineInfo->tszMachineCode, pptszResult[3]); + _tcsxcpy(pSt_MachineInfo->tszMachineUser, pptszResult[3]); } if (NULL != pptszResult[4]) { @@ -196,7 +189,11 @@ bool CModuleDatabase_Machine::ModuleDatabase_Machine_Query(XENGINE_MACHINEINFO* } if (NULL != pptszResult[7]) { - _tcsxcpy(pSt_MachineInfo->tszCreateTime, pptszResult[7]); + _tcsxcpy(pSt_MachineInfo->tszLastTime, pptszResult[7]); + } + if (NULL != pptszResult[8]) + { + _tcsxcpy(pSt_MachineInfo->tszCreateTime, pptszResult[8]); } } DataBase_MySQL_FreeResult(xhDBSQL, xhTable); @@ -228,28 +225,7 @@ bool CModuleDatabase_Machine::ModuleDatabase_Machine_Delete(XENGINE_MACHINEINFO* XCHAR tszSQLStatement[1024]; memset(tszSQLStatement, '\0', sizeof(tszSQLStatement)); - if (_tcsxlen(pSt_MachineInfo->tszMachineCode) > 0) - { - if (_tcsxlen(pSt_MachineInfo->tszServiceName) > 0) - { - _xstprintf(tszSQLStatement, _X("DELETE FROM `XEngine_MachineList` WHERE tszMachineCode = '%s' AND tszServiceName = '%s'"), pSt_MachineInfo->tszMachineCode, pSt_MachineInfo->tszServiceName); - } - else - { - _xstprintf(tszSQLStatement, _X("DELETE FROM `XEngine_MachineList` WHERE tszMachineCode = '%s'"), pSt_MachineInfo->tszMachineCode); - } - } - else - { - if (_tcsxlen(pSt_MachineInfo->tszServiceName) > 0) - { - _xstprintf(tszSQLStatement, _X("DELETE FROM `XEngine_MachineList` WHERE tszMachineName = '%s' AND tszServiceName = '%s'"), pSt_MachineInfo->tszMachineName, pSt_MachineInfo->tszServiceName); - } - else - { - _xstprintf(tszSQLStatement, _X("DELETE FROM `XEngine_MachineList` WHERE tszMachineName = '%s'"), pSt_MachineInfo->tszMachineName); - } - } + _xstprintf(tszSQLStatement, _X("DELETE FROM `XEngine_MachineList` WHERE tszMachineSystem = '%s' AND tszServiceName = '%s'"), pSt_MachineInfo->tszMachineSystem, pSt_MachineInfo->tszServiceName); if (!DataBase_MySQL_Execute(xhDBSQL, tszSQLStatement)) { @@ -285,14 +261,7 @@ bool CModuleDatabase_Machine::ModuleDatabase_Machine_UPDate(XENGINE_MACHINEINFO* XCHAR tszSQLStatement[1024]; memset(tszSQLStatement, '\0', sizeof(tszSQLStatement)); - if (_tcsxlen(pSt_MachineInfo->tszServiceName) > 0) - { - _xstprintf(tszSQLStatement, _X("UPDATE `XEngine_MachineList` SET nTimeNumber = %lld WHERE tszMachineCode = '%s' AND tszServiceName = '%s'"), pSt_MachineInfo->nTimeNumber, pSt_MachineInfo->tszMachineCode, pSt_MachineInfo->tszServiceName); - } - else - { - _xstprintf(tszSQLStatement, _X("UPDATE `XEngine_MachineList` SET nTimeNumber = %lld WHERE tszMachineCode = '%s'"), pSt_MachineInfo->nTimeNumber, pSt_MachineInfo->tszMachineCode); - } + _xstprintf(tszSQLStatement, _X("UPDATE `XEngine_MachineList` SET nTimeNumber = %lld WHERE tszMachineSystem = '%s' AND tszServiceName = '%s'"), pSt_MachineInfo->nTimeNumber, pSt_MachineInfo->tszMachineSystem, pSt_MachineInfo->tszServiceName); if (!DataBase_MySQL_Execute(xhDBSQL, tszSQLStatement)) { @@ -365,7 +334,7 @@ bool CModuleDatabase_Machine::ModuleDatabase_Machine_List(XENGINE_MACHINEINFO*** } if (NULL != pptszResult[3]) { - _tcsxcpy((*pppSt_MachineInfo)[i]->tszMachineCode, pptszResult[3]); + _tcsxcpy((*pppSt_MachineInfo)[i]->tszMachineUser, pptszResult[3]); } if (NULL != pptszResult[4]) { @@ -381,7 +350,11 @@ bool CModuleDatabase_Machine::ModuleDatabase_Machine_List(XENGINE_MACHINEINFO*** } if (NULL != pptszResult[7]) { - _tcsxcpy((*pppSt_MachineInfo)[i]->tszCreateTime, pptszResult[7]); + _tcsxcpy((*pppSt_MachineInfo)[i]->tszLastTime, pptszResult[7]); + } + if (NULL != pptszResult[8]) + { + _tcsxcpy((*pppSt_MachineInfo)[i]->tszCreateTime, pptszResult[8]); } } DataBase_MySQL_FreeResult(xhDBSQL, xhTable); diff --git a/XEngine_Source/XEngine_ModuleDatabase/ModuleDatabase_OilInfo/ModuleDatabase_OilInfo.cpp b/XEngine_Source/XEngine_ModuleDatabase/ModuleDatabase_OilInfo/ModuleDatabase_OilInfo.cpp index 293eacd6908d3ddb0bbdc86e8662d6635b9a2247..8d7333208d943ed7818c34451ce104c012c50ced 100644 --- a/XEngine_Source/XEngine_ModuleDatabase/ModuleDatabase_OilInfo/ModuleDatabase_OilInfo.cpp +++ b/XEngine_Source/XEngine_ModuleDatabase/ModuleDatabase_OilInfo/ModuleDatabase_OilInfo.cpp @@ -124,6 +124,10 @@ bool CModuleDatabase_OilInfo::ModuleDatabase_OilInfo_Query(XENGINE_OILINFO* pSt_ { XCHAR** pptszResult = DataBase_MySQL_GetResult(xhDBSQL, xhTable); + if (NULL != pptszResult[0]) + { + _tcsxcpy(pSt_OilInfo->tszCityStr, pptszResult[0]); + } if (NULL != pptszResult[1]) { pSt_OilInfo->dlValue98 = _ttxof(pptszResult[1]); diff --git a/XEngine_Source/XEngine_ModuleProtocol/ModuleProtocol_Define.h b/XEngine_Source/XEngine_ModuleProtocol/ModuleProtocol_Define.h index fc377ace52bea1392e94d58e602f06eff50129b3..1594466b1603532eed968e40c351bdc14d63d362 100644 --- a/XEngine_Source/XEngine_ModuleProtocol/ModuleProtocol_Define.h +++ b/XEngine_Source/XEngine_ModuleProtocol/ModuleProtocol_Define.h @@ -785,6 +785,78 @@ extern "C" bool ModuleProtocol_Packet_Machine(XCHAR* ptszMSGBuffer, int* pInt_MS 备注: *********************************************************************/ extern "C" bool ModuleProtocol_Packet_OilInfo(XCHAR* ptszMSGBuffer, int* pInt_MSGLen, XENGINE_OILINFO* pSt_OilInfo); +/******************************************************************** +函数名称:ModuleProtocol_Packet_PhoneInfo +函数功能:电话号码信息打包函数 + 参数.一:ptszMsgBuffer + In/Out:Out + 类型:字符指针 + 可空:N + 意思:输出打包的数据信息 + 参数.二:pInt_MsgLen + In/Out:Out + 类型:整数型指针 + 可空:N + 意思:输出打包大小 + 参数.三:pSt_PhoneInfo + In/Out:In/Out + 类型:数据结构指针 + 可空:N + 意思:输入要打包的数据 +返回值 + 类型:逻辑型 + 意思:是否成功 +备注: +*********************************************************************/ +extern "C" bool ModuleProtocol_Packet_PhoneInfo(XCHAR* ptszMSGBuffer, int* pInt_MSGLen, XENGINE_PHONEINFO* pSt_PhoneInfo); +/******************************************************************** +函数名称:ModuleProtocol_Packet_IPAddr +函数功能:IP地址信息打包函数 + 参数.一:ptszMsgBuffer + In/Out:Out + 类型:字符指针 + 可空:N + 意思:输出打包的数据信息 + 参数.二:pInt_MsgLen + In/Out:Out + 类型:整数型指针 + 可空:N + 意思:输出打包大小 + 参数.三:pSt_PhoneInfo + In/Out:In/Out + 类型:数据结构指针 + 可空:N + 意思:输入要打包的数据 +返回值 + 类型:逻辑型 + 意思:是否成功 +备注: +*********************************************************************/ +extern "C" bool ModuleProtocol_Packet_IPAddr(XCHAR* ptszMSGBuffer, int* pInt_MSGLen, XENGINE_IPADDRINFO* pSt_IPAddrInfo); +/******************************************************************** +函数名称:ModuleProtocol_Packet_MacInfo +函数功能:MAC地址信息打包函数 + 参数.一:ptszMsgBuffer + In/Out:Out + 类型:字符指针 + 可空:N + 意思:输出打包的数据信息 + 参数.二:pInt_MsgLen + In/Out:Out + 类型:整数型指针 + 可空:N + 意思:输出打包大小 + 参数.三:pSt_PhoneInfo + In/Out:In/Out + 类型:数据结构指针 + 可空:N + 意思:输入要打包的数据 +返回值 + 类型:逻辑型 + 意思:是否成功 +备注: +*********************************************************************/ +extern "C" bool ModuleProtocol_Packet_MacInfo(XCHAR* ptszMSGBuffer, int* pInt_MSGLen, XENGINE_MACADDRINFO* pSt_MacInfo); /************************************************************************/ /* 导出的协议解析函数 */ /************************************************************************/ diff --git a/XEngine_Source/XEngine_ModuleProtocol/ModuleProtocol_Packet/ModuleProtocol_Packet.cpp b/XEngine_Source/XEngine_ModuleProtocol/ModuleProtocol_Packet/ModuleProtocol_Packet.cpp index 2e1262b94b012eac4baccffb23f1c9b74a89363f..e6541f31c91d196fa37c31fb5bd12a68b99c66dd 100644 --- a/XEngine_Source/XEngine_ModuleProtocol/ModuleProtocol_Packet/ModuleProtocol_Packet.cpp +++ b/XEngine_Source/XEngine_ModuleProtocol/ModuleProtocol_Packet/ModuleProtocol_Packet.cpp @@ -346,7 +346,7 @@ bool CModuleProtocol_Packet::ModuleProtocol_Packet_LanguageQuery(XCHAR* ptszMsgB st_JsonRoot["data"] = st_JsonObject; st_JsonBuilder["emitUTF8"] = true; - *pInt_MsgLen = Json::writeString(st_JsonBuilder, st_JsonRoot).length(); + * pInt_MsgLen = Json::writeString(st_JsonBuilder, st_JsonRoot).length(); memcpy(ptszMsgBuffer, Json::writeString(st_JsonBuilder, st_JsonRoot).c_str(), *pInt_MsgLen); return true; } @@ -1530,6 +1530,7 @@ bool CModuleProtocol_Packet::ModuleProtocol_Packet_Machine(XCHAR* ptszMSGBuffer, st_JsonObject["tszMachineText"] = (*pppSt_MachineList)[i]->tszMachineText; st_JsonObject["tszMachineName"] = (*pppSt_MachineList)[i]->tszMachineName; + st_JsonObject["tszMachineUser"] = (*pppSt_MachineList)[i]->tszMachineUser; st_JsonObject["tszMachineCode"] = (*pppSt_MachineList)[i]->tszMachineCode; st_JsonObject["tszMachineSystem"] = (*pppSt_MachineList)[i]->tszMachineSystem; st_JsonObject["tszCreateTime"] = (*pppSt_MachineList)[i]->tszCreateTime; @@ -1603,6 +1604,163 @@ bool CModuleProtocol_Packet::ModuleProtocol_Packet_OilInfo(XCHAR* ptszMSGBuffer, return true; } /******************************************************************** +函数名称:ModuleProtocol_Packet_PhoneInfo +函数功能:电话号码信息打包函数 + 参数.一:ptszMsgBuffer + In/Out:Out + 类型:字符指针 + 可空:N + 意思:输出打包的数据信息 + 参数.二:pInt_MsgLen + In/Out:Out + 类型:整数型指针 + 可空:N + 意思:输出打包大小 + 参数.三:pSt_PhoneInfo + In/Out:In/Out + 类型:数据结构指针 + 可空:N + 意思:输入要打包的数据 +返回值 + 类型:逻辑型 + 意思:是否成功 +备注: +*********************************************************************/ +bool CModuleProtocol_Packet::ModuleProtocol_Packet_PhoneInfo(XCHAR* ptszMSGBuffer, int* pInt_MSGLen, XENGINE_PHONEINFO* pSt_PhoneInfo) +{ + ModuleProtocol_IsErrorOccur = false; + + if ((NULL == ptszMSGBuffer) || (NULL == pInt_MSGLen)) + { + ModuleProtocol_IsErrorOccur = true; + ModuleProtocol_dwErrorCode = ERROR_XENGINE_APISERVICE_MODULE_PROTOCOL_PACKET_PARAMENT; + return false; + } + Json::Value st_JsonRoot; + Json::Value st_JsonObject; + Json::StreamWriterBuilder st_JsonBuilder; + + st_JsonObject["tszAreaCode"] = pSt_PhoneInfo->tszAreaCode; + st_JsonObject["tszCity"] = pSt_PhoneInfo->tszCity; + st_JsonObject["tszISPName"] = pSt_PhoneInfo->tszISPName; + st_JsonObject["tszPhoneNumber"] = pSt_PhoneInfo->tszPhoneNumber; + st_JsonObject["tszProvincer"] = pSt_PhoneInfo->tszProvincer; + + st_JsonRoot["code"] = 0; + st_JsonRoot["msg"] = "success"; + st_JsonRoot["data"] = st_JsonObject; + st_JsonBuilder["emitUTF8"] = true; + + *pInt_MSGLen = Json::writeString(st_JsonBuilder, st_JsonRoot).length(); + memcpy(ptszMSGBuffer, Json::writeString(st_JsonBuilder, st_JsonRoot).c_str(), *pInt_MSGLen); + return true; +} +/******************************************************************** +函数名称:ModuleProtocol_Packet_IPAddr +函数功能:IP地址信息打包函数 + 参数.一:ptszMsgBuffer + In/Out:Out + 类型:字符指针 + 可空:N + 意思:输出打包的数据信息 + 参数.二:pInt_MsgLen + In/Out:Out + 类型:整数型指针 + 可空:N + 意思:输出打包大小 + 参数.三:pSt_PhoneInfo + In/Out:In/Out + 类型:数据结构指针 + 可空:N + 意思:输入要打包的数据 +返回值 + 类型:逻辑型 + 意思:是否成功 +备注: +*********************************************************************/ +bool CModuleProtocol_Packet::ModuleProtocol_Packet_IPAddr(XCHAR* ptszMSGBuffer, int* pInt_MSGLen, XENGINE_IPADDRINFO* pSt_IPAddrInfo) +{ + ModuleProtocol_IsErrorOccur = false; + + if ((NULL == ptszMSGBuffer) || (NULL == pInt_MSGLen)) + { + ModuleProtocol_IsErrorOccur = true; + ModuleProtocol_dwErrorCode = ERROR_XENGINE_APISERVICE_MODULE_PROTOCOL_PACKET_PARAMENT; + return false; + } + Json::Value st_JsonRoot; + Json::Value st_JsonObject; + Json::StreamWriterBuilder st_JsonBuilder; + + st_JsonObject["tszIPAddr"] = pSt_IPAddrInfo->tszIPAddr; + st_JsonObject["tszIPCity"] = pSt_IPAddrInfo->tszIPCity; + st_JsonObject["tszIPCountry"] = pSt_IPAddrInfo->tszIPCountry; + st_JsonObject["tszIPCounty"] = pSt_IPAddrInfo->tszIPCounty; + st_JsonObject["tszIPISP"] = pSt_IPAddrInfo->tszIPISP; + st_JsonObject["tszIPProvince"] = pSt_IPAddrInfo->tszIPProvince; + + st_JsonRoot["code"] = 0; + st_JsonRoot["msg"] = "success"; + st_JsonRoot["data"] = st_JsonObject; + st_JsonBuilder["emitUTF8"] = true; + + *pInt_MSGLen = Json::writeString(st_JsonBuilder, st_JsonRoot).length(); + BaseLib_OperatorCharset_AnsiToUTF(Json::writeString(st_JsonBuilder, st_JsonRoot).c_str(), ptszMSGBuffer, pInt_MSGLen); + return true; +} +/******************************************************************** +函数名称:ModuleProtocol_Packet_MacInfo +函数功能:MAC地址信息打包函数 + 参数.一:ptszMsgBuffer + In/Out:Out + 类型:字符指针 + 可空:N + 意思:输出打包的数据信息 + 参数.二:pInt_MsgLen + In/Out:Out + 类型:整数型指针 + 可空:N + 意思:输出打包大小 + 参数.三:pSt_PhoneInfo + In/Out:In/Out + 类型:数据结构指针 + 可空:N + 意思:输入要打包的数据 +返回值 + 类型:逻辑型 + 意思:是否成功 +备注: +*********************************************************************/ +bool CModuleProtocol_Packet::ModuleProtocol_Packet_MacInfo(XCHAR* ptszMSGBuffer, int* pInt_MSGLen, XENGINE_MACADDRINFO* pSt_MacInfo) +{ + ModuleProtocol_IsErrorOccur = false; + + if ((NULL == ptszMSGBuffer) || (NULL == pInt_MSGLen)) + { + ModuleProtocol_IsErrorOccur = true; + ModuleProtocol_dwErrorCode = ERROR_XENGINE_APISERVICE_MODULE_PROTOCOL_PACKET_PARAMENT; + return false; + } + Json::Value st_JsonRoot; + Json::Value st_JsonObject; + Json::StreamWriterBuilder st_JsonBuilder; + + st_JsonObject["bPrivate"] = pSt_MacInfo->bPrivate; + st_JsonObject["tszBlockType"] = pSt_MacInfo->tszBlockType; + st_JsonObject["tszMACPrefix"] = pSt_MacInfo->tszMACPrefix; + st_JsonObject["tszUPTime"] = pSt_MacInfo->tszUPTime; + st_JsonObject["tszVendorName"] = pSt_MacInfo->tszVendorName; + + st_JsonRoot["code"] = 0; + st_JsonRoot["msg"] = "success"; + st_JsonRoot["data"] = st_JsonObject; + st_JsonBuilder["emitUTF8"] = true; + + *pInt_MSGLen = Json::writeString(st_JsonBuilder, st_JsonRoot).length(); + memcpy(ptszMSGBuffer, Json::writeString(st_JsonBuilder, st_JsonRoot).c_str(), *pInt_MSGLen); + return true; +} +/******************************************************************** 函数名称:ModuleProtocol_Packet_P2PLan 函数功能:响应同步局域网地址列表 参数.一:ptszMsgBuffer diff --git a/XEngine_Source/XEngine_ModuleProtocol/ModuleProtocol_Packet/ModuleProtocol_Packet.h b/XEngine_Source/XEngine_ModuleProtocol/ModuleProtocol_Packet/ModuleProtocol_Packet.h index f1bab71f51a300ee2e44a18e582cb3b3c11b1cdb..4648633e70728b90df224b4378a8b757464c118b 100644 --- a/XEngine_Source/XEngine_ModuleProtocol/ModuleProtocol_Packet/ModuleProtocol_Packet.h +++ b/XEngine_Source/XEngine_ModuleProtocol/ModuleProtocol_Packet/ModuleProtocol_Packet.h @@ -45,6 +45,9 @@ public: bool ModuleProtocol_Packet_SoftWare(XCHAR* ptszSWInfo, int* pInt_Len); bool ModuleProtocol_Packet_Machine(XCHAR* ptszMSGBuffer, int* pInt_MSGLen, XENGINE_MACHINEINFO*** pppSt_MachineList, int nListCount); bool ModuleProtocol_Packet_OilInfo(XCHAR* ptszMSGBuffer, int* pInt_MSGLen, XENGINE_OILINFO* pSt_OilInfo); + bool ModuleProtocol_Packet_PhoneInfo(XCHAR* ptszMSGBuffer, int* pInt_MSGLen, XENGINE_PHONEINFO* pSt_PhoneInfo); + bool ModuleProtocol_Packet_IPAddr(XCHAR* ptszMSGBuffer, int* pInt_MSGLen, XENGINE_IPADDRINFO* pSt_IPAddrInfo); + bool ModuleProtocol_Packet_MacInfo(XCHAR* ptszMSGBuffer, int* pInt_MSGLen, XENGINE_MACADDRINFO* pSt_MacInfo); public: bool ModuleProtocol_Packet_P2PLan(XCHAR* ptszMsgBuffer, int* pInt_MsgLen, XENGINE_P2XPPEER_PROTOCOL*** pppSt_ListClients, int nListCount); bool ModuleProtocol_Packet_P2PWLan(XCHAR* ptszMsgBuffer, int* pInt_MsgLen, list* pStl_ListClients); diff --git a/XEngine_Source/XEngine_ModuleProtocol/ModuleProtocol_Parse/ModuleProtocol_Parse.cpp b/XEngine_Source/XEngine_ModuleProtocol/ModuleProtocol_Parse/ModuleProtocol_Parse.cpp index 451c3a6366b9a978149c0459487cbf8ee53240e3..876bcf63990e72b1acda451f74fba45b7aca4d87 100644 --- a/XEngine_Source/XEngine_ModuleProtocol/ModuleProtocol_Parse/ModuleProtocol_Parse.cpp +++ b/XEngine_Source/XEngine_ModuleProtocol/ModuleProtocol_Parse/ModuleProtocol_Parse.cpp @@ -1124,6 +1124,10 @@ bool CModuleProtocol_Parse::ModuleProtocol_Parse_Machine(LPCXSTR lpszMsgBuffer, { _tcsxcpy(pSt_MachineInfo->tszMachineName, st_JsonRoot["tszMachineName"].asCString()); } + if (!st_JsonRoot["tszMachineUser"].isNull()) + { + _tcsxcpy(pSt_MachineInfo->tszMachineUser, st_JsonRoot["tszMachineUser"].asCString()); + } if (!st_JsonRoot["tszMachineCode"].isNull()) { _tcsxcpy(pSt_MachineInfo->tszMachineCode, st_JsonRoot["tszMachineCode"].asCString()); diff --git a/XEngine_Source/XEngine_ModuleProtocol/XEngine_ModuleProtocol.def b/XEngine_Source/XEngine_ModuleProtocol/XEngine_ModuleProtocol.def index ba06b87e7a80b7776f4af1c9e6ac2bb2cc0cdd7d..67bb233d2bb317d3d33009319ad3d355d3a3bb22 100644 --- a/XEngine_Source/XEngine_ModuleProtocol/XEngine_ModuleProtocol.def +++ b/XEngine_Source/XEngine_ModuleProtocol/XEngine_ModuleProtocol.def @@ -26,6 +26,9 @@ EXPORTS ModuleProtocol_Packet_SoftWare ModuleProtocol_Packet_Machine ModuleProtocol_Packet_OilInfo + ModuleProtocol_Packet_PhoneInfo + ModuleProtocol_Packet_IPAddr + ModuleProtocol_Packet_MacInfo ModuleProtocol_Packet_P2PLan ModuleProtocol_Packet_P2PWLan ModuleProtocol_Packet_P2PWList diff --git a/XEngine_Source/XEngine_ModuleProtocol/pch.cpp b/XEngine_Source/XEngine_ModuleProtocol/pch.cpp index d0635e1a255d5ac29faf2e831ce16df5fb8de955..51e480b1118f9ede6a5fc82c7e29f4e5a566eeae 100644 --- a/XEngine_Source/XEngine_ModuleProtocol/pch.cpp +++ b/XEngine_Source/XEngine_ModuleProtocol/pch.cpp @@ -123,6 +123,18 @@ extern "C" bool ModuleProtocol_Packet_OilInfo(XCHAR * ptszMSGBuffer, int* pInt_M { return m_ProtocolPacket.ModuleProtocol_Packet_OilInfo(ptszMSGBuffer, pInt_MSGLen, pSt_OilInfo); } +extern "C" bool ModuleProtocol_Packet_PhoneInfo(XCHAR* ptszMSGBuffer, int* pInt_MSGLen, XENGINE_PHONEINFO* pSt_PhoneInfo) +{ + return m_ProtocolPacket.ModuleProtocol_Packet_PhoneInfo(ptszMSGBuffer, pInt_MSGLen, pSt_PhoneInfo); +} +extern "C" bool ModuleProtocol_Packet_IPAddr(XCHAR* ptszMSGBuffer, int* pInt_MSGLen, XENGINE_IPADDRINFO* pSt_IPAddrInfo) +{ + return m_ProtocolPacket.ModuleProtocol_Packet_IPAddr(ptszMSGBuffer, pInt_MSGLen, pSt_IPAddrInfo); +} +extern "C" bool ModuleProtocol_Packet_MacInfo(XCHAR* ptszMSGBuffer, int* pInt_MSGLen, XENGINE_MACADDRINFO* pSt_MacInfo) +{ + return m_ProtocolPacket.ModuleProtocol_Packet_MacInfo(ptszMSGBuffer, pInt_MSGLen, pSt_MacInfo); +} extern "C" bool ModuleProtocol_Packet_P2PLan(XCHAR * ptszMsgBuffer, int* pInt_MsgLen, XENGINE_P2XPPEER_PROTOCOL * **pppSt_ListClients, int nListCount) { return m_ProtocolPacket.ModuleProtocol_Packet_P2PLan(ptszMsgBuffer, pInt_MsgLen, pppSt_ListClients, nListCount); diff --git a/XEngine_Source/XEngine_ModuleProtocol/pch.h b/XEngine_Source/XEngine_ModuleProtocol/pch.h index 487cd59685546b5b55a35c9d151a5c7289709b8a..9db03cf01802fc13a5ad0ceb262f36078caa8996 100644 --- a/XEngine_Source/XEngine_ModuleProtocol/pch.h +++ b/XEngine_Source/XEngine_ModuleProtocol/pch.h @@ -35,6 +35,8 @@ #include #include #include +#include "../../../XEngine_DBDepend/XEngine_IPMacData/XEngine_Source/XIPMac_CommHdr.h" +#include "../../../XEngine_DBDepend/XEngine_PhoneData/Source/XPhone_CommHdr.h" using namespace std; #include "../XEngine_UserProtocol.h" #include "ModuleProtocol_Define.h" diff --git a/XEngine_Source/XEngine_PluginModule/ModulePlugin_IPAddr/Makefile b/XEngine_Source/XEngine_PluginModule/ModulePlugin_IPAddr/Makefile deleted file mode 100644 index 98e7136da203ef1c95a5b52000cf1f23faf2701e..0000000000000000000000000000000000000000 --- a/XEngine_Source/XEngine_PluginModule/ModulePlugin_IPAddr/Makefile +++ /dev/null @@ -1,72 +0,0 @@ -CC = g++ -Wall -std=c++17 -fPIC -PLATFORM = linux -PLATVER = -PLATDIR = -FILEEXT = -LIBFLAG = -RELEASE = 0 -UNICODE = 0 -LOADHDR = -I ./ -I ../../XEngine_Depend/XEngine_Module/jsoncpp -LOADSO = -L ../../XEngine_Depend/XEngine_Module/jsoncpp -LIB = -lXEngine_BaseLib -ljsoncpp -LIBEX = -OBJECTS = ModulePlugin_IPAddr.o ModulePlugin_Interface.o pch.o - -ifeq ($(RELEASE),1) -FLAGS = -c -DEBUG = -else -FLAGS = -c -lc_p -DEBUG = -g -pg -endif - -ifeq ($(UNICODE),1) -UNICODE = -D _UNICODE -else -UNICODE = -endif - -ifeq ($(PLATFORM),linux) - ifeq (/etc/redhat-release,$(wildcard /etc/redhat-release)) - PLATVER = -D __CENTOS__ - PLATDIR = XEngine_Linux/Centos - else - PLATVER = -D __UBUNTU__ - PLATDIR = XEngine_Linux/Ubuntu - endif - FILEEXT = so - LIBFLAG = -shared - LIBEX = -lpthread -lrt -ldl - LOADBIN = -Wl,-rpath=./,--disable-new-dtags -else ifeq ($(PLATFORM),mac) - CC += -Wno-deprecated-declarations - PLATVER = -D __MACOS__ - PLATDIR = XEngine_Mac - FILEEXT = dylib - LIBFLAG = -dynamiclib - LIBEX = -lpthread -ldl - LOADBIN = -Wl,-rpath,@loader_path/./ -endif - - -all:$(OBJECTS) - $(CC) $(DEBUG) $(OBJECTS) -o libModulePlugin_IPAddr.$(FILEEXT) $(LIBFLAG) $(LIB) $(LIBEX) $(LOADSO) $(LOADBIN) - -ModulePlugin_IPAddr.o:./ModulePlugin_IPAddr/ModulePlugin_IPAddr.cpp - $(CC) $(DEBUG) $(FLAGS) $(UNICODE) $(PLATVER) $(LOADHDR) ./ModulePlugin_IPAddr/ModulePlugin_IPAddr.cpp -ModulePlugin_Interface.o:./ModulePlugin_Interface/ModulePlugin_Interface.cpp - $(CC) $(DEBUG) $(FLAGS) $(UNICODE) $(PLATVER) $(LOADHDR) ./ModulePlugin_Interface/ModulePlugin_Interface.cpp - -pch.o:./pch.cpp - $(CC) $(DEBUG) $(FLAGS) $(UNICODE) $(PLATVER) $(LOADHDR) ./pch.cpp - - -InstallAll:InstallSo -InstallSo:./libModulePlugin_IPAddr.$(FILEEXT) - cp ./libModulePlugin_IPAddr.$(FILEEXT) ../../../XEngine_Release/XEngine_LibPlugin/libModulePlugin_IPAddr.$(FILEEXT) - -CleanAll:CleanObj CleanMk -CleanObj: - rm *.o -CleanMk: - rm *.$(FILEEXT) \ No newline at end of file diff --git a/XEngine_Source/XEngine_PluginModule/ModulePlugin_IPAddr/ModulePlugin_IPAddr.def b/XEngine_Source/XEngine_PluginModule/ModulePlugin_IPAddr/ModulePlugin_IPAddr.def deleted file mode 100644 index 78dedee2f85146d24ce86f934777197f8ada61dd..0000000000000000000000000000000000000000 --- a/XEngine_Source/XEngine_PluginModule/ModulePlugin_IPAddr/ModulePlugin_IPAddr.def +++ /dev/null @@ -1,8 +0,0 @@ -LIBRARY - -EXPORTS - PluginCore_GetLastError - - PluginCore_Init - PluginCore_UnInit - PluginCore_Call \ No newline at end of file diff --git a/XEngine_Source/XEngine_PluginModule/ModulePlugin_IPAddr/ModulePlugin_IPAddr.vcxproj b/XEngine_Source/XEngine_PluginModule/ModulePlugin_IPAddr/ModulePlugin_IPAddr.vcxproj deleted file mode 100644 index 0b796b2ec6f8b99890d8dd1157fd232c96a00271..0000000000000000000000000000000000000000 --- a/XEngine_Source/XEngine_PluginModule/ModulePlugin_IPAddr/ModulePlugin_IPAddr.vcxproj +++ /dev/null @@ -1,195 +0,0 @@ - - - - - Debug - Win32 - - - Release - Win32 - - - Debug - x64 - - - Release - x64 - - - - 16.0 - Win32Proj - {d549160c-cc16-47f8-8345-1f4cf7a25ca2} - ModulePluginIPAddr - 10.0 - libModulePlugin_IPAddr - - - - DynamicLibrary - true - v143 - Unicode - - - DynamicLibrary - false - v143 - true - Unicode - - - DynamicLibrary - true - v143 - Unicode - - - DynamicLibrary - false - v143 - true - Unicode - - - - - - - - - - - - - - - - - - - - - $(XEngine_Include);../../XEngine_Depend/XEngine_Module/jsoncpp;$(IncludePath) - $(XEngine_Lib32);$(LibraryPath) - $(SolutionDir)$(Configuration)\XEngine_LibPlugin\ - $(Configuration)\XEngine_LibPlugin\ - - - $(XEngine_Include);../../XEngine_Depend/XEngine_Module/jsoncpp;$(IncludePath) - $(XEngine_Lib32);$(LibraryPath) - $(SolutionDir)$(Configuration)\XEngine_LibPlugin\ - $(Configuration)\XEngine_LibPlugin\ - - - $(XEngine_Include);../../XEngine_Depend/XEngine_Module/jsoncpp;$(IncludePath) - $(XEngine_Lib64);$(LibraryPath) - $(SolutionDir)$(Platform)\$(Configuration)\XEngine_LibPlugin\ - $(Platform)\$(Configuration)\XEngine_LibPlugin\ - - - $(XEngine_Include);../../XEngine_Depend/XEngine_Module/jsoncpp;$(IncludePath) - $(XEngine_Lib64);$(LibraryPath) - $(SolutionDir)$(Platform)\$(Configuration)\XEngine_LibPlugin\ - $(Platform)\$(Configuration)\XEngine_LibPlugin\ - - - - Level3 - true - WIN32;_DEBUG;MODULEPLUGINIPADDR_EXPORTS;_WINDOWS;_USRDLL;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) - true - Use - pch.h - - - Windows - true - false - ModulePlugin_IPAddr.def - - - - - Level3 - true - true - true - WIN32;NDEBUG;MODULEPLUGINIPADDR_EXPORTS;_WINDOWS;_USRDLL;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) - true - Use - pch.h - - - Windows - true - true - true - false - ModulePlugin_IPAddr.def - - - - - Level3 - true - _DEBUG;MODULEPLUGINIPADDR_EXPORTS;_WINDOWS;_USRDLL;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) - true - Use - pch.h - - - Windows - true - false - ModulePlugin_IPAddr.def - - - - - Level3 - true - true - true - NDEBUG;MODULEPLUGINIPADDR_EXPORTS;_WINDOWS;_USRDLL;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) - true - Use - pch.h - - - Windows - true - true - true - false - ModulePlugin_IPAddr.def - - - - - - - - - - - - - - - - Create - Create - Create - Create - - - - - - - - - \ No newline at end of file diff --git a/XEngine_Source/XEngine_PluginModule/ModulePlugin_IPAddr/ModulePlugin_IPAddr.vcxproj.filters b/XEngine_Source/XEngine_PluginModule/ModulePlugin_IPAddr/ModulePlugin_IPAddr.vcxproj.filters deleted file mode 100644 index a2b6fe4bb6dd82b10481d7d90e1bfe3455725db2..0000000000000000000000000000000000000000 --- a/XEngine_Source/XEngine_PluginModule/ModulePlugin_IPAddr/ModulePlugin_IPAddr.vcxproj.filters +++ /dev/null @@ -1,68 +0,0 @@ - - - - - {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 - - - {88d379f4-f5d3-4b63-8dc3-1939efcbeffc} - - - {b715f2bb-0cd1-4dc8-8aad-70c6c0d50632} - - - {f1830098-0b28-44f5-98f0-d51e3abe348f} - - - {95a0829c-b222-4fd8-94be-bc775c75d157} - - - - - 头文件 - - - 头文件 - - - 头文件\ModulePlugin_IPAddr - - - 头文件\ModulePlugin_Interface - - - 头文件 - - - 头文件 - - - - - 源文件 - - - 源文件 - - - 源文件\ModulePlugin_IPAddr - - - 源文件\ModulePlugin_Interface - - - - - 源文件 - - - \ No newline at end of file diff --git a/XEngine_Source/XEngine_PluginModule/ModulePlugin_IPAddr/ModulePlugin_IPAddr.vcxproj.user b/XEngine_Source/XEngine_PluginModule/ModulePlugin_IPAddr/ModulePlugin_IPAddr.vcxproj.user deleted file mode 100644 index 88a550947edbc3c5003a41726f0749201fdb6822..0000000000000000000000000000000000000000 --- a/XEngine_Source/XEngine_PluginModule/ModulePlugin_IPAddr/ModulePlugin_IPAddr.vcxproj.user +++ /dev/null @@ -1,4 +0,0 @@ - - - - \ No newline at end of file diff --git a/XEngine_Source/XEngine_PluginModule/ModulePlugin_IPAddr/ModulePlugin_IPAddr/ModulePlugin_IPAddr.cpp b/XEngine_Source/XEngine_PluginModule/ModulePlugin_IPAddr/ModulePlugin_IPAddr/ModulePlugin_IPAddr.cpp deleted file mode 100644 index 9754c68bb2ae81833f389f093bb3dcfec0b831c3..0000000000000000000000000000000000000000 --- a/XEngine_Source/XEngine_PluginModule/ModulePlugin_IPAddr/ModulePlugin_IPAddr/ModulePlugin_IPAddr.cpp +++ /dev/null @@ -1,402 +0,0 @@ -// Copyright 2022 The Ip2Region Authors. All rights reserved. -// Use of this source code is governed by a Apache2.0-style -// license that can be found in the LICENSE file. - -// --- -// @Author Lion -// @Date 2022/06/27 -#include "pch.h" -#include "ModulePlugin_IPAddr.h" - -// internal function prototype define -XDB_PRIVATE(int) read(xdb_searcher_t*, long offset, char*, size_t length); - -XDB_PRIVATE(int) xdb_new_base(xdb_searcher_t* xdb, const char* db_path, const xdb_vector_index_t* v_index, const xdb_content_t* c_buffer) { - memset(xdb, 0x00, sizeof(xdb_searcher_t)); - - // check the content buffer first - if (c_buffer != NULL) { - xdb->v_index = NULL; - xdb->content = c_buffer; - return 0; - } - - // open the xdb binary file - FILE* handle = fopen(db_path, "rb"); - if (handle == NULL) { - return 1; - } - - xdb->handle = handle; - xdb->v_index = v_index; - - return 0; -} - -// xdb searcher new api define -XDB_PUBLIC(int) xdb_new_with_file_only(xdb_searcher_t* xdb, const char* db_path) { - return xdb_new_base(xdb, db_path, NULL, NULL); -} - -XDB_PUBLIC(int) xdb_new_with_vector_index(xdb_searcher_t* xdb, const char* db_path, const xdb_vector_index_t* v_index) { - return xdb_new_base(xdb, db_path, v_index, NULL); -} - -XDB_PUBLIC(int) xdb_new_with_buffer(xdb_searcher_t* xdb, const xdb_content_t* c_buffer) { - return xdb_new_base(xdb, NULL, NULL, c_buffer); -} - -XDB_PUBLIC(void) xdb_close(void* ptr) { - xdb_searcher_t* xdb = (xdb_searcher_t*)ptr; - if (xdb->handle != NULL) { - fclose(xdb->handle); - xdb->handle = NULL; - } -} - -// --- xdb searcher search api define - -XDB_PUBLIC(int) xdb_search_by_string(xdb_searcher_t* xdb, const char* str_ip, char* region_buffer, size_t length) { - unsigned int ip = 0; - int errcode = xdb_check_ip(str_ip, &ip); - if (errcode != 0) { - return 10 + errcode; - } - else { - return xdb_search(xdb, ip, region_buffer, length); - } -} - -XDB_PUBLIC(int) xdb_search(xdb_searcher_t* xdb, unsigned int ip, char* region_buffer, size_t length) { - int il0, il1, idx, err, l, h, m, data_len; - unsigned int s_ptr, e_ptr, p, sip, eip, data_ptr; - char vector_buffer[xdb_vector_index_size], segment_buffer[xdb_segment_index_size]; - - // reset the io counter - xdb->io_count = 0; - - // locate the segment index block based on the vector index - il0 = ((int)(ip >> 24)) & 0xFF; - il1 = ((int)(ip >> 16)) & 0xFF; - idx = il0 * xdb_vector_index_cols * xdb_vector_index_size + il1 * xdb_vector_index_size; - if (xdb->v_index != NULL) { - s_ptr = xdb_get_uint(xdb->v_index->buffer, idx); - e_ptr = xdb_get_uint(xdb->v_index->buffer, idx + 4); - } - else if (xdb->content != NULL) { - s_ptr = xdb_get_uint(xdb->content->buffer, xdb_header_info_length + idx); - e_ptr = xdb_get_uint(xdb->content->buffer, xdb_header_info_length + idx + 4); - } - else { - err = read(xdb, xdb_header_info_length + idx, vector_buffer, sizeof(vector_buffer)); - if (err != 0) { - return 10 + err; - } - - s_ptr = xdb_get_uint(vector_buffer, 0); - e_ptr = xdb_get_uint(vector_buffer, 4); - } - - // printf("s_ptr=%u, e_ptr=%u\n", s_ptr, e_ptr); - // binary search to get the final region info - data_len = 0, data_ptr = 0; - l = 0, h = ((int)(e_ptr - s_ptr)) / xdb_segment_index_size; - while (l <= h) { - m = (l + h) >> 1; - p = s_ptr + m * xdb_segment_index_size; - - // read the segment index item - err = read(xdb, p, segment_buffer, sizeof(segment_buffer)); - if (err != 0) { - return 20 + err; - } - - // decode the data fields as needed - sip = xdb_get_uint(segment_buffer, 0); - if (ip < sip) { - h = m - 1; - } - else { - eip = xdb_get_uint(segment_buffer, 4); - if (ip > eip) { - l = m + 1; - } - else { - data_len = xdb_get_ushort(segment_buffer, 8); - data_ptr = xdb_get_uint(segment_buffer, 10); - break; - } - } - } - - // printf("data_len=%u, data_ptr=%u\n", data_len, data_ptr); - if (data_len == 0) { - region_buffer[0] = '\0'; - return 0; - } - - // buffer length checking - if (data_len >= (int)length) { - return 1; - } - - err = read(xdb, data_ptr, region_buffer, data_len); - if (err != 0) { - return 30 + err; - } - - // auto append a NULL-end - region_buffer[data_len] = '\0'; - return 0; -} - -XDB_PRIVATE(int) read(xdb_searcher_t* xdb, long offset, char* buffer, size_t length) { - // check the xdb content cache first - if (xdb->content != NULL) { - memcpy(buffer, xdb->content->buffer + offset, length); - return 0; - } - - // seek to the offset - if (fseek(xdb->handle, offset, SEEK_SET) == -1) { - return 1; - } - - xdb->io_count++; - if (fread(buffer, 1, length, xdb->handle) != length) { - return 2; - } - - return 0; -} - -XDB_PUBLIC(int) xdb_get_io_count(xdb_searcher_t* xdb) { - return xdb->io_count; -} - - -// --- buffer load util functions - -XDB_PUBLIC(xdb_header_t*) xdb_load_header(FILE* handle) { - xdb_header_t* header; - unsigned int size = xdb_header_info_length; - - // entry alloc - header = (xdb_header_t*)xdb_malloc(sizeof(xdb_header_t)); - if (header == NULL) { - return NULL; - } - - if (fseek(handle, 0, SEEK_SET) == -1) { - xdb_free(header); - return NULL; - } - - if (fread(header->buffer, 1, size, handle) != size) { - xdb_free(header); - return NULL; - } - - // fill the fields - header->length = size; - header->version = (unsigned short)xdb_get_ushort(header->buffer, 0); - header->index_policy = (unsigned short)xdb_get_ushort(header->buffer, 2); - header->created_at = xdb_get_uint(header->buffer, 4); - header->start_index_ptr = xdb_get_uint(header->buffer, 8); - header->end_index_ptr = xdb_get_uint(header->buffer, 12); - - return header; -} - -XDB_PUBLIC(xdb_header_t*) xdb_load_header_from_file(const char* db_path) { - xdb_header_t* header; - FILE* handle = fopen(db_path, "rb"); - if (handle == NULL) { - return NULL; - } - - header = xdb_load_header(handle); - fclose(handle); - return header; -} - -XDB_PUBLIC(void) xdb_close_header(void* ptr) { - xdb_header_t* header = (xdb_header_t*)ptr; - if (header->length > 0) { - header->length = 0; - xdb_free(header); - } -} - -// --- vector index - -XDB_PUBLIC(xdb_vector_index_t*) xdb_load_vector_index(FILE* handle) { - xdb_vector_index_t* v_index; - unsigned int size = xdb_vector_index_length; - - // seek to the vector index offset - if (fseek(handle, xdb_header_info_length, SEEK_SET) == -1) { - return NULL; - } - - // do the buffer read - v_index = (xdb_vector_index_t*)xdb_malloc(sizeof(xdb_vector_index_t)); - if (v_index == NULL) { - return NULL; - } - - v_index->length = size; - if (fread(v_index->buffer, 1, size, handle) != size) { - xdb_free(v_index); - return NULL; - } - - return v_index; -} - -XDB_PUBLIC(xdb_vector_index_t*) xdb_load_vector_index_from_file(const char* db_path) { - xdb_vector_index_t* v_index; - FILE* handle = fopen(db_path, "rb"); - if (handle == NULL) { - return NULL; - } - - v_index = xdb_load_vector_index(handle); - fclose(handle); - return v_index; -} - -XDB_PUBLIC(void) xdb_close_vector_index(void* ptr) { - xdb_vector_index_t* v_index = (xdb_vector_index_t*)ptr; - if (v_index->length > 0) { - v_index->length = 0; - xdb_free(v_index); - } -} - -// --- content buffer - -XDB_PUBLIC(xdb_content_t*) xdb_load_content(FILE* handle) { - unsigned int size; - xdb_content_t* content; - - // determine the file size - if (fseek(handle, 0, SEEK_END) == -1) { - return NULL; - } - - size = (unsigned int)ftell(handle); - if (fseek(handle, 0, SEEK_SET) == -1) { - return NULL; - } - - // do the file read - content = (xdb_content_t*)xdb_malloc(sizeof(xdb_content_t)); - if (content == NULL) { - return NULL; - } - - // do the buffer alloc - content->buffer = (char*)xdb_malloc(size); - if (content->buffer == NULL) { - xdb_free(content); - return NULL; - } - - // read the content into the buffer - content->length = size; - if (fread(content->buffer, 1, size, handle) != size) { - xdb_free(content); - return NULL; - } - - return content; -} - -XDB_PUBLIC(xdb_content_t*) xdb_load_content_from_file(const char* db_path) { - xdb_content_t* content; - FILE* handle = fopen(db_path, "rb"); - if (handle == NULL) { - return NULL; - } - - content = xdb_load_content(handle); - fclose(handle); - return content; -} - -XDB_PUBLIC(void) xdb_close_content(void* ptr) { - xdb_content_t* content = (xdb_content_t*)ptr; - if (content->length > 0) { - content->length = 0; - xdb_free(content->buffer); - content->buffer = NULL; - xdb_free(content); - } -} - -// --- End - -// get unsigned long (4bytes) from a specified buffer start from the specified offset -XDB_PUBLIC(unsigned int) xdb_get_uint(const char* buffer, int offset) { - return ( - ((buffer[offset]) & 0x000000FF) | - ((buffer[offset + 1] << 8) & 0x0000FF00) | - ((buffer[offset + 2] << 16) & 0x00FF0000) | - ((buffer[offset + 3] << 24) & 0xFF000000) - ); -} - -// get unsigned short (2bytes) from a specified buffer start from the specified offset -XDB_PUBLIC(int) xdb_get_ushort(const char* buffer, int offset) { - return ( - ((buffer[offset]) & 0x000000FF) | - ((buffer[offset + 1] << 8) & 0x0000FF00) - ); -} - -// string ip to unsigned int -static int shiftIndex[4] = { 24, 16, 8, 0 }; -XDB_PUBLIC(int) xdb_check_ip(const char* src_ip, unsigned int* dst_ip) { - char c; - int i, n, ip = 0; - const char* ptr = src_ip; - for (i = 0; i < 4; i++) { - n = 0; - while (1) { - c = *ptr; - ptr++; - if (c >= '0' && c <= '9') { - n *= 10; - n += c - '0'; - } - else if ((i < 3 && c == '.') || i == 3) { - // stopping at the '.' but ignore the tailing chars - // after the 3rd one (auto clean the tailing none-integer ?). - break; - } - else { - return 1; - } - } - - if (n > 0xFF) { - return 2; - } - - ip |= (n << shiftIndex[i]); - } - - *dst_ip = ip; - return 0; -} - -// unsigned int ip to string ip -XDB_PUBLIC(void) xdb_long2ip(unsigned int ip, char* buffer) { - sprintf(buffer, "%d.%d.%d.%d", (ip >> 24) & 0xFF, (ip >> 16) & 0xFF, (ip >> 8) & 0xFF, ip & 0xFF); -} - -// get the middle ip of a and b -XDB_PUBLIC(unsigned int) xdb_mip(unsigned long a, unsigned long b) { - return (unsigned int)((a + b) >> 1); -} \ No newline at end of file diff --git a/XEngine_Source/XEngine_PluginModule/ModulePlugin_IPAddr/ModulePlugin_IPAddr/ModulePlugin_IPAddr.h b/XEngine_Source/XEngine_PluginModule/ModulePlugin_IPAddr/ModulePlugin_IPAddr/ModulePlugin_IPAddr.h deleted file mode 100644 index 21e135f5b8590bcca38c1e2c87e9967e461c2386..0000000000000000000000000000000000000000 --- a/XEngine_Source/XEngine_PluginModule/ModulePlugin_IPAddr/ModulePlugin_IPAddr/ModulePlugin_IPAddr.h +++ /dev/null @@ -1,146 +0,0 @@ -// Copyright 2022 The Ip2Region Authors. All rights reserved. -// Use of this source code is governed by a Apache2.0-style -// license that can be found in the LICENSE file. - -// --- -// @Author Lion -// @Date 2022/06/27 - -#ifndef C_XDB_SEARCHER_H -#define C_XDB_SEARCHER_H - -#include -#include -#include - -#if ( defined(WIN32) || defined(_WIN32) || defined(__WINDOWS_) || defined(WINNT) ) -# define XDB_PUBLIC(type) extern __declspec(dllexport) type -# define XDB_PRIVATE(type) static type -# define XDB_WINDOWS -#else -# define XDB_PUBLIC(type) extern type -# define XDB_PRIVATE(type) static inline type -# define XDB_LINUX -#endif - -#define xdb_calloc( _blocks, _bytes ) calloc( _blocks, _bytes ) -#define xdb_malloc( _bytes ) malloc( _bytes ) -#define xdb_free( _ptr ) free( _ptr ) - -// public constants define -#define xdb_header_info_length 256 -#define xdb_vector_index_rows 256 -#define xdb_vector_index_cols 256 -#define xdb_vector_index_size 8 -#define xdb_segment_index_size 14 - -// cache of vector_index_row × vector_index_rows × vector_index_size -#define xdb_vector_index_length 524288 - - -// --- buffer load util functions - -// use the following buffer struct to wrap the binary buffer data -// since the buffer data could not be operated with the string API. -struct xdb_header { - unsigned short version; - unsigned short index_policy; - unsigned int created_at; - unsigned int start_index_ptr; - unsigned int end_index_ptr; - - // the original buffer - unsigned int length; - char buffer[xdb_header_info_length]; -}; -typedef struct xdb_header xdb_header_t; - -XDB_PUBLIC(xdb_header_t*) xdb_load_header(FILE*); - -XDB_PUBLIC(xdb_header_t*) xdb_load_header_from_file(const char*); - -XDB_PUBLIC(void) xdb_close_header(void*); - - -// --- vector index buffer -struct xdb_vector_index { - unsigned int length; - char buffer[xdb_vector_index_length]; -}; -typedef struct xdb_vector_index xdb_vector_index_t; - -XDB_PUBLIC(xdb_vector_index_t*) xdb_load_vector_index(FILE*); - -XDB_PUBLIC(xdb_vector_index_t*) xdb_load_vector_index_from_file(const char*); - -XDB_PUBLIC(void) xdb_close_vector_index(void*); - - -// --- content buffer -struct xdb_content { - unsigned int length; - char* buffer; -}; -typedef struct xdb_content xdb_content_t; - -XDB_PUBLIC(xdb_content_t*) xdb_load_content(FILE*); - -XDB_PUBLIC(xdb_content_t*) xdb_load_content_from_file(const char*); - -XDB_PUBLIC(void) xdb_close_content(void*); - -// --- End buffer load - -// xdb searcher structure -struct xdb_searcher_entry { - FILE* handle; - - // header info - const char* header; - int io_count; - - // vector index buffer cache. - // preload the vector index will reduce the number of IO operations - // thus speedup the search process. - const xdb_vector_index_t* v_index; - - // content buffer. - // cache the whole xdb content. - const xdb_content_t* content; -}; -typedef struct xdb_searcher_entry xdb_searcher_t; - -// xdb searcher new api define -XDB_PUBLIC(int) xdb_new_with_file_only(xdb_searcher_t*, const char*); - -XDB_PUBLIC(int) xdb_new_with_vector_index(xdb_searcher_t*, const char*, const xdb_vector_index_t*); - -XDB_PUBLIC(int) xdb_new_with_buffer(xdb_searcher_t*, const xdb_content_t*); - -XDB_PUBLIC(void) xdb_close(void*); - -// xdb searcher search api define -XDB_PUBLIC(int) xdb_search_by_string(xdb_searcher_t*, const char*, char*, size_t); - -XDB_PUBLIC(int) xdb_search(xdb_searcher_t*, unsigned int, char*, size_t); - -XDB_PUBLIC(int) xdb_get_io_count(xdb_searcher_t*); - - -// get unsigned long (4bytes) from a specified buffer start from the specified offset with little-endian -XDB_PUBLIC(unsigned int) xdb_get_uint(const char*, int); - -// get unsigned short (2bytes) from a specified buffer start from the specified offset with little-endian -XDB_PUBLIC(int) xdb_get_ushort(const char*, int); - -// check the specified string ip and convert it to an unsigned int -XDB_PUBLIC(int) xdb_check_ip(const char*, unsigned int*); - -// unsigned int ip to string ip -XDB_PUBLIC(void) xdb_long2ip(unsigned int, char*); - -// get the middle ip of a and b -XDB_PUBLIC(unsigned int) xdb_mip(unsigned long, unsigned long); - - -#endif //C_XDB_SEARCHER_H \ No newline at end of file diff --git a/XEngine_Source/XEngine_PluginModule/ModulePlugin_IPAddr/ModulePlugin_Interface/ModulePlugin_Interface.cpp b/XEngine_Source/XEngine_PluginModule/ModulePlugin_IPAddr/ModulePlugin_Interface/ModulePlugin_Interface.cpp deleted file mode 100644 index 57495ea66f93396865eca9d759b99278de7b370f..0000000000000000000000000000000000000000 --- a/XEngine_Source/XEngine_PluginModule/ModulePlugin_IPAddr/ModulePlugin_Interface/ModulePlugin_Interface.cpp +++ /dev/null @@ -1,118 +0,0 @@ -#include "pch.h" -#include "ModulePlugin_Interface.h" -/******************************************************************** -// Created: 2023/01/10 11:09:33 -// File Name: D:\XEngine_APIService\XEngine_Source\XEngine_PluginModule\ModulePlugin_IPAddr\ModulePlugin_Interface\ModulePlugin_Interface.cpp -// File Path: D:\XEngine_APIService\XEngine_Source\XEngine_PluginModule\ModulePlugin_IPAddr\ModulePlugin_Interface -// File Base: ModulePlugin_Interface -// File Ext: cpp -// Project: XEngine -// Author: qyt -// Purpose: IP地址类 -// History: -*********************************************************************/ -CModulePlugin_Interface::CModulePlugin_Interface() -{ -} -CModulePlugin_Interface::~CModulePlugin_Interface() -{ -} -////////////////////////////////////////////////////////////////////////// -// 公有函数 -////////////////////////////////////////////////////////////////////////// -/******************************************************************** -函数名称:PluginCore_Init -函数功能:初始化插件模块 - 参数.一:lParam - In/Out:In/Out - 类型:无类型指针 - 可空:N - 意思:自定义参数 -返回值 - 类型:逻辑型 - 意思:是否成功 -备注: -*********************************************************************/ -bool CModulePlugin_Interface::PluginCore_Init(XPVOID lParam) -{ - IPAddr_IsErrorOccur = false; - - const char* db_path = "./XEngine_DBFile/ip2region.xdb"; - // 1、从 db_path 初始化 xdb 查询对象 - int err = xdb_new_with_file_only(&st_DBSearch, db_path); - if (err != 0) - { - printf("failed to create xdb searcher from `%s` with errno=%d\n", db_path, err); - return false; - } - return true; -} -/******************************************************************** -函数名称:PluginCore_UnInit -函数功能:卸载插件 -返回值 - 类型:无 - 意思: -备注: -*********************************************************************/ -void CModulePlugin_Interface::PluginCore_UnInit() -{ - IPAddr_IsErrorOccur = false; - xdb_close(&st_DBSearch); -} -/******************************************************************** -函数名称:PluginCore_Call -函数功能:调用插件 -返回值 - 类型:逻辑型 - 意思:是否成功 -备注: -*********************************************************************/ -bool CModulePlugin_Interface::PluginCore_Call(XCHAR*** pppHDRList, int nListCount, int* pInt_HTTPCode, XCHAR* ptszMsgBuffer, int* pInt_MsgLen, LPCXSTR lpszMsgBuffer, int nMsgLen) -{ - IPAddr_IsErrorOccur = false; - - if ((NULL == pInt_HTTPCode) || (NULL == ptszMsgBuffer) || (NULL == pInt_MsgLen)) - { - IPAddr_IsErrorOccur = true; - IPAddr_dwErrorCode = ERROR_XENGINE_APISERVICE_PLUGIN_MODULE_IPADDR_PARAMENT; - return false; - } - XCHAR tszKeyName[128]; - XCHAR tszMsgBuffer[128]; - XENGINE_IPADDRINFO st_IPAddr; - Json::Value st_JsonRoot; - Json::Value st_JsonObject; - Json::StreamWriterBuilder st_JsonBuilder; - - memset(tszKeyName, '\0', sizeof(tszKeyName)); - memset(tszMsgBuffer, '\0', sizeof(tszMsgBuffer)); - memset(&st_IPAddr, '\0', sizeof(XENGINE_IPADDRINFO)); - - BaseLib_OperatorString_GetKeyValue((*pppHDRList)[1], "=", tszKeyName, st_IPAddr.tszIPAddr); - if (0 != xdb_search_by_string(&st_DBSearch, st_IPAddr.tszIPAddr, tszMsgBuffer, sizeof(tszMsgBuffer))) - { - IPAddr_IsErrorOccur = true; - IPAddr_dwErrorCode = ERROR_XENGINE_APISERVICE_PLUGIN_MODULE_IPADDR_NOTFOUND; - return false; - } - //中国|0|内蒙古|通辽市|联通 - _stxscanf(tszMsgBuffer, _X("%[^|]|%[^|]|%[^|]|%[^|]|%[^|]"), st_IPAddr.tszIPCountry, st_IPAddr.tszIPCounty, st_IPAddr.tszIPProvince, st_IPAddr.tszIPCity, st_IPAddr.tszIPISP); - st_JsonObject["tszIPAddr"] = st_IPAddr.tszIPAddr; - st_JsonObject["tszIPCountry"] = st_IPAddr.tszIPCountry; - st_JsonObject["tszIPProvince"] = st_IPAddr.tszIPProvince; - st_JsonObject["tszIPCity"] = st_IPAddr.tszIPCity; - st_JsonObject["tszIPCounty"] = st_IPAddr.tszIPCounty; - st_JsonObject["tszIPAddress"] = st_IPAddr.tszIPAddress; - st_JsonObject["tszIPISP"] = st_IPAddr.tszIPISP; - - st_JsonRoot["data"] = st_JsonObject; - st_JsonRoot["code"] = 0; - st_JsonRoot["msg"] = "success"; - st_JsonBuilder["emitUTF8"] = true; - - *pInt_HTTPCode = 200; - *pInt_MsgLen = Json::writeString(st_JsonBuilder, st_JsonRoot).length(); - memcpy(ptszMsgBuffer, Json::writeString(st_JsonBuilder, st_JsonRoot).c_str(), *pInt_MsgLen); - return true; -} \ No newline at end of file diff --git a/XEngine_Source/XEngine_PluginModule/ModulePlugin_IPAddr/ModulePlugin_Interface/ModulePlugin_Interface.h b/XEngine_Source/XEngine_PluginModule/ModulePlugin_IPAddr/ModulePlugin_Interface/ModulePlugin_Interface.h deleted file mode 100644 index c3045d4db6082d82138b3290f35e644c10038d84..0000000000000000000000000000000000000000 --- a/XEngine_Source/XEngine_PluginModule/ModulePlugin_IPAddr/ModulePlugin_Interface/ModulePlugin_Interface.h +++ /dev/null @@ -1,26 +0,0 @@ -#pragma once -/******************************************************************** -// Created: 2023/01/10 11:09:11 -// File Name: D:\XEngine_APIService\XEngine_Source\XEngine_PluginModule\ModulePlugin_IPAddr\ModulePlugin_Interface\ModulePlugin_Interface.h -// File Path: D:\XEngine_APIService\XEngine_Source\XEngine_PluginModule\ModulePlugin_IPAddr\ModulePlugin_Interface -// File Base: ModulePlugin_Interface -// File Ext: h -// Project: XEngine -// Author: qyt -// Purpose: IP地址类 -// History: -*********************************************************************/ - -class CModulePlugin_Interface -{ -public: - CModulePlugin_Interface(); - ~CModulePlugin_Interface(); -public: - bool PluginCore_Init(XPVOID lParam); - void PluginCore_UnInit(); - bool PluginCore_Call(XCHAR*** pppHDRList, int nListCount, int* pInt_HTTPCode, XCHAR* ptszMsgBuffer, int* pInt_MsgLen, LPCXSTR lpszMsgBuffer, int nMsgLen); -protected: -private: - xdb_searcher_t st_DBSearch; -}; diff --git a/XEngine_Source/XEngine_PluginModule/ModulePlugin_IPAddr/PluginIPAddr_Define.h b/XEngine_Source/XEngine_PluginModule/ModulePlugin_IPAddr/PluginIPAddr_Define.h deleted file mode 100644 index 5136adebe6161f7f3b2546086374493be5df1436..0000000000000000000000000000000000000000 --- a/XEngine_Source/XEngine_PluginModule/ModulePlugin_IPAddr/PluginIPAddr_Define.h +++ /dev/null @@ -1,62 +0,0 @@ -#pragma once -/******************************************************************** -// Created: 2023/01/10 11:24:55 -// File Name: D:\XEngine_APIService\XEngine_Source\XEngine_PluginModule\ModulePlugin_IPAddr\PluginIPAddr_Define.h -// File Path: D:\XEngine_APIService\XEngine_Source\XEngine_PluginModule\ModulePlugin_IPAddr -// File Base: PluginIPAddr_Define -// File Ext: h -// Project: XEngine -// Author: qyt -// Purpose: IP地址操作导出定义 -// History: -*********************************************************************/ -//IP地址信息 -typedef struct -{ - XCHAR tszIPAddr[128]; //IP地址 - XCHAR tszIPCountry[128]; //国家/地区 - XCHAR tszIPProvince[128]; //省/自治区 - XCHAR tszIPCity[128]; //市 - XCHAR tszIPCounty[128]; //县 - XCHAR tszIPAddress[128]; //详细地址 - XCHAR tszIPISP[128]; //运营商 -}XENGINE_IPADDRINFO; -////////////////////////////////////////////////////////////////////////// -// 导出函数定义 -////////////////////////////////////////////////////////////////////////// -extern "C" XLONG PluginCore_GetLastError(); -/********************************************************************************* -* 导出函数定义 * -*********************************************************************************/ -/******************************************************************** -函数名称:PluginCore_Init -函数功能:初始化插件模块 - 参数.一:lParam - In/Out:In/Out - 类型:无类型指针 - 可空:N - 意思:自定义参数 -返回值 - 类型:逻辑型 - 意思:是否成功 -备注: -*********************************************************************/ -extern "C" bool PluginCore_Init(XPVOID lParam = NULL); -/******************************************************************** -函数名称:PluginCore_UnInit -函数功能:卸载插件 -返回值 - 类型:无 - 意思: -备注: -*********************************************************************/ -extern "C" void PluginCore_UnInit(); -/******************************************************************** -函数名称:PluginCore_Call -函数功能:调用插件 -返回值 - 类型:逻辑型 - 意思:是否成功 -备注: -*********************************************************************/ -extern "C" bool PluginCore_Call(XCHAR * **pppHDRList, int nListCount, int* pInt_HTTPCode, XCHAR * ptszMsgBuffer, int* pInt_MsgLen, LPCXSTR lpszMsgBuffer = NULL, int nMsgLen = 0); \ No newline at end of file diff --git a/XEngine_Source/XEngine_PluginModule/ModulePlugin_IPAddr/PluginIPAddr_Error.h b/XEngine_Source/XEngine_PluginModule/ModulePlugin_IPAddr/PluginIPAddr_Error.h deleted file mode 100644 index 59e9a2050fa0d74b70d3c1b2750bbf679d9723a6..0000000000000000000000000000000000000000 --- a/XEngine_Source/XEngine_PluginModule/ModulePlugin_IPAddr/PluginIPAddr_Error.h +++ /dev/null @@ -1,17 +0,0 @@ -#pragma once -/******************************************************************** -// Created: 2023/01/10 11:23:04 -// File Name: D:\XEngine_APIService\XEngine_Source\XEngine_PluginModule\ModulePlugin_IPAddr\PluginIPAddr_Error.h -// File Path: D:\XEngine_APIService\XEngine_Source\XEngine_PluginModule\ModulePlugin_IPAddr -// File Base: PluginIPAddr_Error -// File Ext: h -// Project: XEngine -// Author: qyt -// Purpose: IP地址错误导出 -// History: -*********************************************************************/ -////////////////////////////////////////////////////////////////////////// -// 错误定义 -////////////////////////////////////////////////////////////////////////// -#define ERROR_XENGINE_APISERVICE_PLUGIN_MODULE_IPADDR_PARAMENT 0xB2001 //初始化失败.参数错误 -#define ERROR_XENGINE_APISERVICE_PLUGIN_MODULE_IPADDR_NOTFOUND 0xB1002 //没有找到 \ No newline at end of file diff --git a/XEngine_Source/XEngine_PluginModule/ModulePlugin_IPAddr/dllmain.cpp b/XEngine_Source/XEngine_PluginModule/ModulePlugin_IPAddr/dllmain.cpp deleted file mode 100644 index 897dff745af0abaab58dfe72e37126fb2b23bf83..0000000000000000000000000000000000000000 --- a/XEngine_Source/XEngine_PluginModule/ModulePlugin_IPAddr/dllmain.cpp +++ /dev/null @@ -1,18 +0,0 @@ -// dllmain.cpp : 定义 DLL 应用程序的入口点。 -#include "pch.h" - -bool APIENTRY DllMain( HMODULE hModule, - XLONG ul_reason_for_call, - XPVOID lpReserved - ) -{ - switch (ul_reason_for_call) - { - case DLL_PROCESS_ATTACH: - case DLL_THREAD_ATTACH: - case DLL_THREAD_DETACH: - case DLL_PROCESS_DETACH: - break; - } - return true; -} \ No newline at end of file diff --git a/XEngine_Source/XEngine_PluginModule/ModulePlugin_IPAddr/framework.h b/XEngine_Source/XEngine_PluginModule/ModulePlugin_IPAddr/framework.h deleted file mode 100644 index 80cbbc9b06a9b0141f92ee19eceaed71328caff4..0000000000000000000000000000000000000000 --- a/XEngine_Source/XEngine_PluginModule/ModulePlugin_IPAddr/framework.h +++ /dev/null @@ -1,5 +0,0 @@ -#pragma once - -#define WIN32_LEAN_AND_MEAN // 从 Windows 头文件中排除极少使用的内容 -// Windows 头文件 -#include diff --git a/XEngine_Source/XEngine_PluginModule/ModulePlugin_IPAddr/pch.cpp b/XEngine_Source/XEngine_PluginModule/ModulePlugin_IPAddr/pch.cpp deleted file mode 100644 index 859960137dfa908f7cce3fb9176bee9c8a9bce70..0000000000000000000000000000000000000000 --- a/XEngine_Source/XEngine_PluginModule/ModulePlugin_IPAddr/pch.cpp +++ /dev/null @@ -1,39 +0,0 @@ -#include "pch.h" -#include "ModulePlugin_Interface/ModulePlugin_Interface.h" -/******************************************************************** -// Created: 2023/01/10 11:24:04 -// File Name: D:\XEngine_APIService\XEngine_Source\XEngine_PluginModule\ModulePlugin_IPAddr\pch.cpp -// File Path: D:\XEngine_APIService\XEngine_Source\XEngine_PluginModule\ModulePlugin_IPAddr -// File Base: pch -// File Ext: cpp -// Project: XEngine -// Author: qyt -// Purpose: 导出实现 -// History: -*********************************************************************/ -bool IPAddr_IsErrorOccur = false; -XLONG IPAddr_dwErrorCode = 0; -////////////////////////////////////////////////////////////////////////// -CModulePlugin_Interface m_PluginIPAddr; -////////////////////////////////////////////////////////////////////////// -// 导出函数定义 -////////////////////////////////////////////////////////////////////////// -extern "C" XLONG PluginCore_GetLastError() -{ - return IPAddr_dwErrorCode; -} -/********************************************************************************* -* 导出函数定义 * -*********************************************************************************/ -extern "C" bool PluginCore_Init(XPVOID lParam) -{ - return m_PluginIPAddr.PluginCore_Init(lParam); -} -extern "C" void PluginCore_UnInit() -{ - m_PluginIPAddr.PluginCore_UnInit(); -} -extern "C" bool PluginCore_Call(XCHAR * **pppHDRList, int nListCount, int* pInt_HTTPCode, XCHAR * ptszMsgBuffer, int* pInt_MsgLen, LPCXSTR lpszMsgBuffer, int nMsgLen) -{ - return m_PluginIPAddr.PluginCore_Call(pppHDRList, nListCount, pInt_HTTPCode, ptszMsgBuffer, pInt_MsgLen, lpszMsgBuffer, nMsgLen); -} \ No newline at end of file diff --git a/XEngine_Source/XEngine_PluginModule/ModulePlugin_IPAddr/pch.h b/XEngine_Source/XEngine_PluginModule/ModulePlugin_IPAddr/pch.h deleted file mode 100644 index e5b8c1ca8faff2f687d479a93ad5b80c716aeaa2..0000000000000000000000000000000000000000 --- a/XEngine_Source/XEngine_PluginModule/ModulePlugin_IPAddr/pch.h +++ /dev/null @@ -1,56 +0,0 @@ -// pch.h: 这是预编译标头文件。 -// 下方列出的文件仅编译一次,提高了将来生成的生成性能。 -// 这还将影响 IntelliSense 性能,包括代码完成和许多代码浏览功能。 -// 但是,如果此处列出的文件中的任何一个在生成之间有更新,它们全部都将被重新编译。 -// 请勿在此处添加要频繁更新的文件,这将使得性能优势无效。 - -#ifndef PCH_H -#define PCH_H - -#ifdef _MSC_BUILD -// 添加要在此处预编译的标头 -#include "framework.h" -#include -#endif -#endif //PCH_H -#include -#include -#include -#include -#include -#include -#include "PluginIPAddr_Define.h" -#include "PluginIPAddr_Error.h" -using namespace std; -/******************************************************************** -// Created: 2023/01/09 17:08:50 -// File Name: D:\XEngine_APIService\XEngine_Source\XEngine_PluginModule\ModulePlugin_Phone\pch.h -// File Path: D:\XEngine_APIService\XEngine_Source\XEngine_PluginModule\ModulePlugin_Phone -// File Base: pch -// File Ext: h -// Project: XEngine -// Author: qyt -// Purpose: 公用头文件 -// History: -*********************************************************************/ -extern bool IPAddr_IsErrorOccur; -extern XLONG IPAddr_dwErrorCode; - -#include "ModulePlugin_IPAddr/ModulePlugin_IPAddr.h" - -#ifdef _MSC_BUILD -#pragma comment(lib,"XEngine_BaseLib/XEngine_BaseLib") -#ifdef _DEBUG -#ifdef _WIN64 -#pragma comment(lib,"../../x64/Debug/jsoncpp") -#else -#pragma comment(lib,"../../Debug/jsoncpp") -#endif -#else -#ifdef _WIN64 -#pragma comment(lib,"../../x64/Release/jsoncpp") -#else -#pragma comment(lib,"../../Release/jsoncpp") -#endif -#endif -#endif \ No newline at end of file diff --git a/XEngine_Source/XEngine_PluginModule/ModulePlugin_Phone/Makefile b/XEngine_Source/XEngine_PluginModule/ModulePlugin_Phone/Makefile deleted file mode 100644 index e7c2e6ed0cbb5c11d2f946af0349467acd195ede..0000000000000000000000000000000000000000 --- a/XEngine_Source/XEngine_PluginModule/ModulePlugin_Phone/Makefile +++ /dev/null @@ -1,72 +0,0 @@ -CC = g++ -Wall -std=c++17 -fPIC -PLATFORM = linux -PLATVER = -PLATDIR = -FILEEXT = -LIBFLAG = -RELEASE = 0 -UNICODE = 0 -LOADHDR = -I ./ -I ../../XEngine_Depend/XEngine_Module/jsoncpp -LOADSO = -L ../../XEngine_Depend/XEngine_Module/jsoncpp -LIB = -lXEngine_BaseLib -ljsoncpp -LIBEX = -OBJECTS = ModulePlugin_DBPhone.o ModulePlugin_APIPhone.o pch.o - -ifeq ($(RELEASE),1) -FLAGS = -c -DEBUG = -else -FLAGS = -c -lc_p -DEBUG = -g -pg -endif - -ifeq ($(UNICODE),1) -UNICODE = -D _UNICODE -else -UNICODE = -endif - -ifeq ($(PLATFORM),linux) - ifeq (/etc/redhat-release,$(wildcard /etc/redhat-release)) - PLATVER = -D __CENTOS__ - PLATDIR = XEngine_Linux/Centos - else - PLATVER = -D __UBUNTU__ - PLATDIR = XEngine_Linux/Ubuntu - endif - FILEEXT = so - LIBFLAG = -shared - LIBEX = -lpthread -lrt -ldl - LOADBIN = -Wl,-rpath=./,--disable-new-dtags -else ifeq ($(PLATFORM),mac) - CC += -Wno-deprecated-declarations - PLATVER = -D __MACOS__ - PLATDIR = XEngine_Mac - FILEEXT = dylib - LIBFLAG = -dynamiclib - LIBEX = -lpthread -ldl - LOADBIN = -Wl,-rpath,@loader_path/./ -endif - - -all:$(OBJECTS) - $(CC) $(DEBUG) $(OBJECTS) -o libModulePlugin_Phone.$(FILEEXT) $(LIBFLAG) $(LIB) $(LIBEX) $(LOADSO) $(LOADBIN) - -ModulePlugin_DBPhone.o:./ModulePlugin_DBPhone/ModulePlugin_DBPhone.cpp - $(CC) $(DEBUG) $(FLAGS) $(UNICODE) $(PLATVER) $(LOADHDR) ./ModulePlugin_DBPhone/ModulePlugin_DBPhone.cpp -ModulePlugin_APIPhone.o:./ModulePlugin_APIPhone/ModulePlugin_APIPhone.cpp - $(CC) $(DEBUG) $(FLAGS) $(UNICODE) $(PLATVER) $(LOADHDR) ./ModulePlugin_APIPhone/ModulePlugin_APIPhone.cpp - -pch.o:./pch.cpp - $(CC) $(DEBUG) $(FLAGS) $(UNICODE) $(PLATVER) $(LOADHDR) ./pch.cpp - - -InstallAll:InstallSo -InstallSo:./libModulePlugin_Phone.$(FILEEXT) - cp ./libModulePlugin_Phone.$(FILEEXT) ../../../XEngine_Release/XEngine_LibPlugin/libModulePlugin_Phone.$(FILEEXT) - -CleanAll:CleanObj CleanMk -CleanObj: - rm *.o -CleanMk: - rm *.$(FILEEXT) \ No newline at end of file diff --git a/XEngine_Source/XEngine_PluginModule/ModulePlugin_Phone/ModulePlugin_APIPhone/ModulePlugin_APIPhone.cpp b/XEngine_Source/XEngine_PluginModule/ModulePlugin_Phone/ModulePlugin_APIPhone/ModulePlugin_APIPhone.cpp deleted file mode 100644 index a749d7fe36ba11cd1bffc71144d9e3d0bbd05c63..0000000000000000000000000000000000000000 --- a/XEngine_Source/XEngine_PluginModule/ModulePlugin_Phone/ModulePlugin_APIPhone/ModulePlugin_APIPhone.cpp +++ /dev/null @@ -1,111 +0,0 @@ -#include "pch.h" -#include "ModulePlugin_APIPhone.h" -/******************************************************************** -// Created: 2023/01/09 17:13:39 -// File Name: D:\XEngine_APIService\XEngine_Source\XEngine_PluginModule\ModulePlugin_Phone\ModulePlugin_APIPhone\ModulePlugin_APIPhone.cpp -// File Path: D:\XEngine_APIService\XEngine_Source\XEngine_PluginModule\ModulePlugin_Phone\ModulePlugin_APIPhone -// File Base: ModulePlugin_APIPhone -// File Ext: cpp -// Project: XEngine -// Author: qyt -// Purpose: 电话接口类 -// History: -*********************************************************************/ -CModulePlugin_APIPhone::CModulePlugin_APIPhone() -{ -} -CModulePlugin_APIPhone::~CModulePlugin_APIPhone() -{ -} -////////////////////////////////////////////////////////////////////////// -// 公有函数 -////////////////////////////////////////////////////////////////////////// -/******************************************************************** -函数名称:PluginCore_Init -函数功能:初始化插件模块 - 参数.一:lParam - In/Out:In/Out - 类型:无类型指针 - 可空:N - 意思:自定义参数 -返回值 - 类型:逻辑型 - 意思:是否成功 -备注: -*********************************************************************/ -bool CModulePlugin_APIPhone::PluginCore_Init(XPVOID lParam) -{ - Phone_IsErrorOccur = false; - - if (!m_DBPhone.ModuleDatabase_Phone_Init(_X("./XEngine_DBFile/phone.dat"))) - { - return false; - } - return true; -} -/******************************************************************** -函数名称:PluginCore_UnInit -函数功能:卸载插件 -返回值 - 类型:无 - 意思: -备注: -*********************************************************************/ -void CModulePlugin_APIPhone::PluginCore_UnInit() -{ - Phone_IsErrorOccur = false; - - m_DBPhone.ModuleDatabase_Phone_Destory(); -} -/******************************************************************** -函数名称:PluginCore_Call -函数功能:调用插件 -返回值 - 类型:逻辑型 - 意思:是否成功 -备注: -*********************************************************************/ -bool CModulePlugin_APIPhone::PluginCore_Call(XCHAR*** pppHDRList, int nListCount, int* pInt_HTTPCode, XCHAR* ptszMsgBuffer, int* pInt_MsgLen, LPCXSTR lpszMsgBuffer, int nMsgLen) -{ - Phone_IsErrorOccur = false; - - if ((NULL == pInt_HTTPCode) || (NULL == ptszMsgBuffer) || (NULL == pInt_MsgLen)) - { - Phone_IsErrorOccur = true; - Phone_dwErrorCode = ERROR_XENGINE_APISERVICE_PLUGIN_MODULE_PHONE_PARAMENT; - return false; - } - XCHAR tszKeyName[128]; - XCHAR tszKeyValue[128]; - Json::Value st_JsonRoot; - Json::Value st_JsonObject; - Json::StreamWriterBuilder st_JsonBuilder; - XENGINE_PHONEINFO st_PhoneInfo; - - memset(tszKeyName, '\0', sizeof(tszKeyName)); - memset(tszKeyValue, '\0', sizeof(tszKeyValue)); - memset(&st_PhoneInfo, '\0', sizeof(XENGINE_PHONEINFO)); - - BaseLib_OperatorString_GetKeyValue((*pppHDRList)[1], "=", tszKeyName, tszKeyValue); - - st_PhoneInfo.nPhoneNumber = _ttxoll(tszKeyValue); - if (!m_DBPhone.ModuleDatabase_Phone_Query(tszKeyValue, &st_PhoneInfo)) - { - return false; - } - st_JsonObject["nPhoneNumber"] = (Json::Value::Int64)st_PhoneInfo.nPhoneNumber; - st_JsonObject["tszProvincer"] = st_PhoneInfo.tszProvincer; - st_JsonObject["tszCity"] = st_PhoneInfo.tszCity; - st_JsonObject["nZipCode"] = st_PhoneInfo.nZipCode; - st_JsonObject["nAreaCode"] = st_PhoneInfo.nAreaCode; - - st_JsonRoot["data"] = st_JsonObject; - st_JsonRoot["code"] = 0; - st_JsonRoot["msg"] = "success"; - st_JsonBuilder["emitUTF8"] = true; - - *pInt_HTTPCode = 200; - *pInt_MsgLen = Json::writeString(st_JsonBuilder, st_JsonRoot).length(); - memcpy(ptszMsgBuffer, Json::writeString(st_JsonBuilder, st_JsonRoot).c_str(), *pInt_MsgLen); - return true; -} \ No newline at end of file diff --git a/XEngine_Source/XEngine_PluginModule/ModulePlugin_Phone/ModulePlugin_APIPhone/ModulePlugin_APIPhone.h b/XEngine_Source/XEngine_PluginModule/ModulePlugin_Phone/ModulePlugin_APIPhone/ModulePlugin_APIPhone.h deleted file mode 100644 index 904a564f23ff27a3c43dad89e456de63a2e38745..0000000000000000000000000000000000000000 --- a/XEngine_Source/XEngine_PluginModule/ModulePlugin_Phone/ModulePlugin_APIPhone/ModulePlugin_APIPhone.h +++ /dev/null @@ -1,26 +0,0 @@ -#pragma once -/******************************************************************** -// Created: 2023/01/09 17:13:28 -// File Name: D:\XEngine_APIService\XEngine_Source\XEngine_PluginModule\ModulePlugin_Phone\ModulePlugin_APIPhone\ModulePlugin_APIPhone.h -// File Path: D:\XEngine_APIService\XEngine_Source\XEngine_PluginModule\ModulePlugin_Phone\ModulePlugin_APIPhone -// File Base: ModulePlugin_APIPhone -// File Ext: h -// Project: XEngine -// Author: qyt -// Purpose: 电话接口类 -// History: -*********************************************************************/ - -class CModulePlugin_APIPhone -{ -public: - CModulePlugin_APIPhone(); - ~CModulePlugin_APIPhone(); -public: - bool PluginCore_Init(XPVOID lParam); - void PluginCore_UnInit(); - bool PluginCore_Call(XCHAR*** pppHDRList, int nListCount, int* pInt_HTTPCode, XCHAR* ptszMsgBuffer, int* pInt_MsgLen, LPCXSTR lpszMsgBuffer, int nMsgLen); -protected: -private: - CModulePlugin_DBPhone m_DBPhone; -}; diff --git a/XEngine_Source/XEngine_PluginModule/ModulePlugin_Phone/ModulePlugin_DBPhone/ModulePlugin_DBPhone.cpp b/XEngine_Source/XEngine_PluginModule/ModulePlugin_Phone/ModulePlugin_DBPhone/ModulePlugin_DBPhone.cpp deleted file mode 100644 index cd0f1dec5a24af87b607344409d4f6322990b3ff..0000000000000000000000000000000000000000 --- a/XEngine_Source/XEngine_PluginModule/ModulePlugin_Phone/ModulePlugin_DBPhone/ModulePlugin_DBPhone.cpp +++ /dev/null @@ -1,255 +0,0 @@ -#include "pch.h" -#include "ModulePlugin_DBPhone.h" -/******************************************************************** -// Created: 2023/01/09 17:06:56 -// File Name: D:\XEngine_APIService\XEngine_Source\XEngine_PluginModule\ModulePlugin_Phone\ModulePlugin_DBPhone\ModulePlugin_DBPhone.cpp -// File Path: D:\XEngine_APIService\XEngine_Source\XEngine_PluginModule\ModulePlugin_Phone\ModulePlugin_DBPhone -// File Base: ModulePlugin_DBPhone -// File Ext: cpp -// Project: XEngine -// Author: qyt -// Purpose: 电话信息查询 -// History: -*********************************************************************/ -CModulePlugin_DBPhone::CModulePlugin_DBPhone() -{ -} -CModulePlugin_DBPhone::~CModulePlugin_DBPhone() -{ - -} -////////////////////////////////////////////////////////////////////////// -// 公有函数 -////////////////////////////////////////////////////////////////////////// -/******************************************************************** -函数名称:ModuleDatabase_Phone_Init -函数功能:初始化电话信息查询数据库 - 参数.一:lpszSQLFile - In/Out:In - 类型:常量字符指针 - 可空:N - 意思:输入要操作的SQL文件 -返回值 - 类型:逻辑型 - 意思:是否成功 -备注: -*********************************************************************/ -bool CModulePlugin_DBPhone::ModuleDatabase_Phone_Init(LPCXSTR lpszSQLFile) -{ - Phone_IsErrorOccur = false; - - if (NULL == lpszSQLFile) - { - Phone_IsErrorOccur = true; - Phone_dwErrorCode = ERROR_XENGINE_APISERVICE_PLUGIN_MODULE_PHONE_PARAMENT; - return false; - } - //打开数据库 - FILE* pSt_File = _xtfopen(lpszSQLFile, _X("rb")); - if (NULL == pSt_File) - { - Phone_IsErrorOccur = true; - Phone_dwErrorCode = ERROR_XENGINE_APISERVICE_PLUGIN_MODULE_PHONE_NOTFOUND; - return false; - } - //申请内存 - ptszMsgBuffer = (XCHAR*)malloc(XENGINE_APISERVICE_DATABASE_PHONE_BUFFER_SIZE); - if (NULL == ptszMsgBuffer) - { - Phone_IsErrorOccur = true; - Phone_dwErrorCode = ERROR_XENGINE_APISERVICE_PLUGIN_MODULE_PHONE_MALLOC; - return false; - } - memset(ptszMsgBuffer, '\0', XENGINE_APISERVICE_DATABASE_PHONE_BUFFER_SIZE); - //读取内容 - while (true) - { - int nRet = fread(ptszMsgBuffer + nFLen, 1, 2048, pSt_File); - if (nRet <= 0) - { - break; - } - nFLen += nRet; - } - fclose(pSt_File); - memcpy(&st_PhoneHdr, ptszMsgBuffer, sizeof(XENGINE_DBPHONEHDR)); - nCount = (nFLen - st_PhoneHdr.nOffset) / XENGINE_APISERVICE_DATABASE_PHONE_INDEX_LEN; - return true; -} -/******************************************************************** -函数名称:ModuleDatabase_Phone_Destory -函数功能:销毁 -返回值 - 类型:逻辑型 - 意思:是否成功 -备注: -*********************************************************************/ -bool CModulePlugin_DBPhone::ModuleDatabase_Phone_Destory() -{ - Phone_IsErrorOccur = false; - - free(ptszMsgBuffer); - ptszMsgBuffer = NULL; - return true; -} -/******************************************************************** -函数名称:ModuleDatabase_Phone_Query -函数功能:查询电话号码信息 - 参数.一:lpszPhoneNumber - In/Out:In - 类型:常量字符指针 - 可空:N - 意思:输入要查询的电话号码 - 参数.二:pSt_PhoneInfo - In/Out:Out - 类型:数据结构指针 - 可空:N - 意思:输出电话信息 -返回值 - 类型:逻辑型 - 意思:是否成功 -备注: -*********************************************************************/ -bool CModulePlugin_DBPhone::ModuleDatabase_Phone_Query(LPCXSTR lpszPhoneNumber, XENGINE_PHONEINFO* pSt_PhoneInfo) -{ - Phone_IsErrorOccur = false; - - if ((NULL == lpszPhoneNumber) || (NULL == pSt_PhoneInfo)) - { - Phone_IsErrorOccur = true; - Phone_dwErrorCode = ERROR_XENGINE_APISERVICE_PLUGIN_MODULE_PHONE_PARAMENT; - return false; - } - size_t nPLen = _tcsxlen(lpszPhoneNumber); - size_t nPhone = 0; - //不能超过7 - if (nPLen > 7) - { - XCHAR tszPhone[64]; - memset(tszPhone, '\0', sizeof(tszPhone)); - - memcpy(tszPhone, lpszPhoneNumber, 7); - nPhone = _ttxoi(tszPhone); - } - else - { - nPhone = _ttxoi(lpszPhoneNumber); - } - - size_t nLeft = 0; - size_t nRight = nCount; - while (nLeft <= nRight) - { - //二分查找 - size_t nMiddle = (nLeft + nRight) / 2; - size_t nCurrentPos = st_PhoneHdr.nOffset + nMiddle * XENGINE_APISERVICE_DATABASE_PHONE_INDEX_LEN; - if (nCurrentPos >= nFLen) - { - break; - } - XENGINE_DBPHONERECORD st_DBRecord; - memset(&st_DBRecord, '\0', sizeof(XENGINE_DBPHONERECORD)); - - memcpy(&st_DBRecord, ptszMsgBuffer + nCurrentPos, XENGINE_APISERVICE_DATABASE_PHONE_INDEX_LEN); - if (st_DBRecord.nPhone > nPhone) - { - nRight = nMiddle - 1; - } - else if (st_DBRecord.nPhone < nPhone) - { - nLeft = nMiddle + 1; - } - else - { - int i = 0; - while (true) - { - if (ptszMsgBuffer[i + st_DBRecord.nOffset] == '\0') - { - break; - } - i++; - } - pSt_PhoneInfo->enPhoneType = (ENUM_XENGINE_APISERVICE_PHONE_TYPE)st_DBRecord.byType; - //转换数据 - if (!ModuleDatabase_Phone_Convert(ptszMsgBuffer + st_DBRecord.nOffset, i, pSt_PhoneInfo)) - { - return false; - } - break; - } - } - return true; -} -////////////////////////////////////////////////////////////////////////// -// 保护函数 -////////////////////////////////////////////////////////////////////////// -/******************************************************************** -函数名称:ModuleDatabase_Phone_Convert -函数功能:转换数据格式到指定数据结构 - 参数.一:lpszPhoneInfo - In/Out:In - 类型:常量字符指针 - 可空:N - 意思:输入要转换的信息 - 参数.二:nMsgLen - In/Out:In - 类型:整数型 - 可空:N - 意思:输入查找大小 - 参数.三:pSt_PhoneInfo - In/Out:In - 类型:数据结构指针 - 可空:N - 意思:输出转换后的信息 -返回值 - 类型:逻辑型 - 意思:是否成功 -备注: -*********************************************************************/ -bool CModulePlugin_DBPhone::ModuleDatabase_Phone_Convert(LPCXSTR lpszPhoneInfo, int nMsgLen, XENGINE_PHONEINFO* pSt_PhoneInfo) -{ - Phone_IsErrorOccur = false; - - XCHAR tszMsgBuffer[128]; - memset(tszMsgBuffer, '\0', sizeof(tszMsgBuffer)); - memcpy(tszMsgBuffer, lpszPhoneInfo, nMsgLen); - //省 - XCHAR* ptszTokStr = _tcsxtok(tszMsgBuffer, _X("|")); - if (NULL == ptszTokStr) - { - Phone_IsErrorOccur = true; - Phone_dwErrorCode = ERROR_XENGINE_APISERVICE_PLUGIN_MODULE_PHONE_NOTFOUND; - return false; - } - _tcsxcpy(pSt_PhoneInfo->tszProvincer, ptszTokStr); - //市区 - ptszTokStr = _tcsxtok(NULL, _X("|")); - if (NULL == ptszTokStr) - { - Phone_IsErrorOccur = true; - Phone_dwErrorCode = ERROR_XENGINE_APISERVICE_PLUGIN_MODULE_PHONE_NOTFOUND; - return false; - } - _tcsxcpy(pSt_PhoneInfo->tszCity, ptszTokStr); - //邮编 - ptszTokStr = _tcsxtok(NULL, _X("|")); - if (NULL == ptszTokStr) - { - Phone_IsErrorOccur = true; - Phone_dwErrorCode = ERROR_XENGINE_APISERVICE_PLUGIN_MODULE_PHONE_NOTFOUND; - return false; - } - pSt_PhoneInfo->nZipCode = _ttxoi(ptszTokStr); - //区号 - ptszTokStr = _tcsxtok(NULL, _X("|")); - if (NULL == ptszTokStr) - { - Phone_IsErrorOccur = true; - Phone_dwErrorCode = ERROR_XENGINE_APISERVICE_PLUGIN_MODULE_PHONE_NOTFOUND; - return false; - } - pSt_PhoneInfo->nAreaCode = _ttxoi(ptszTokStr); - - return true; -} \ No newline at end of file diff --git a/XEngine_Source/XEngine_PluginModule/ModulePlugin_Phone/ModulePlugin_DBPhone/ModulePlugin_DBPhone.h b/XEngine_Source/XEngine_PluginModule/ModulePlugin_Phone/ModulePlugin_DBPhone/ModulePlugin_DBPhone.h deleted file mode 100644 index 27bd947b20a961691ae2cf00180343e1255f34d5..0000000000000000000000000000000000000000 --- a/XEngine_Source/XEngine_PluginModule/ModulePlugin_Phone/ModulePlugin_DBPhone/ModulePlugin_DBPhone.h +++ /dev/null @@ -1,46 +0,0 @@ -#pragma once -/******************************************************************** -// Created: 2023/01/09 17:06:35 -// File Name: D:\XEngine_APIService\XEngine_Source\XEngine_PluginModule\ModulePlugin_Phone\ModulePlugin_DBPhone\ModulePlugin_DBPhone.h -// File Path: D:\XEngine_APIService\XEngine_Source\XEngine_PluginModule\ModulePlugin_Phone\ModulePlugin_DBPhone -// File Base: ModulePlugin_DBPhone -// File Ext: h -// Project: XEngine -// Author: qyt -// Purpose: 电话信息查询 -// History: -*********************************************************************/ -#define XENGINE_APISERVICE_DATABASE_PHONE_BUFFER_SIZE 1024 * 1024 * 10 -#define XENGINE_APISERVICE_DATABASE_PHONE_INDEX_LEN 9 - -typedef struct -{ - XBYTE byVersion[4]; - unsigned int nOffset; -}XENGINE_DBPHONEHDR; - -typedef struct -{ - unsigned int nPhone; - unsigned int nOffset; - XBYTE byType; -}XENGINE_DBPHONERECORD; - -class CModulePlugin_DBPhone -{ -public: - CModulePlugin_DBPhone(); - ~CModulePlugin_DBPhone(); -public: - bool ModuleDatabase_Phone_Init(LPCXSTR lpszSQLFile); - bool ModuleDatabase_Phone_Destory(); - bool ModuleDatabase_Phone_Query(LPCXSTR lpszPhoneNumber, XENGINE_PHONEINFO* pSt_PhoneInfo); -protected: - bool ModuleDatabase_Phone_Convert(LPCXSTR lpszPhoneInfo, int nMsgLen, XENGINE_PHONEINFO* pSt_PhoneInfo); -private: - XENGINE_DBPHONEHDR st_PhoneHdr; -private: - size_t nFLen = 0; - size_t nCount = 0; - XCHAR* ptszMsgBuffer; -}; \ No newline at end of file diff --git a/XEngine_Source/XEngine_PluginModule/ModulePlugin_Phone/ModulePlugin_Phone.def b/XEngine_Source/XEngine_PluginModule/ModulePlugin_Phone/ModulePlugin_Phone.def deleted file mode 100644 index 78dedee2f85146d24ce86f934777197f8ada61dd..0000000000000000000000000000000000000000 --- a/XEngine_Source/XEngine_PluginModule/ModulePlugin_Phone/ModulePlugin_Phone.def +++ /dev/null @@ -1,8 +0,0 @@ -LIBRARY - -EXPORTS - PluginCore_GetLastError - - PluginCore_Init - PluginCore_UnInit - PluginCore_Call \ No newline at end of file diff --git a/XEngine_Source/XEngine_PluginModule/ModulePlugin_Phone/ModulePlugin_Phone.vcxproj b/XEngine_Source/XEngine_PluginModule/ModulePlugin_Phone/ModulePlugin_Phone.vcxproj deleted file mode 100644 index 82a6b5d418452e2ffc0896b3db0ef9959d0b8e0c..0000000000000000000000000000000000000000 --- a/XEngine_Source/XEngine_PluginModule/ModulePlugin_Phone/ModulePlugin_Phone.vcxproj +++ /dev/null @@ -1,196 +0,0 @@ - - - - - Debug - Win32 - - - Release - Win32 - - - Debug - x64 - - - Release - x64 - - - - 16.0 - Win32Proj - {8fbc495d-c05e-49a4-b938-a81c9dfc1e5a} - ModulePluginPhone - 10.0 - libModulePlugin_Phone - - - - DynamicLibrary - true - v143 - Unicode - - - DynamicLibrary - false - v143 - true - Unicode - - - DynamicLibrary - true - v143 - Unicode - - - DynamicLibrary - false - v143 - true - Unicode - - - - - - - - - - - - - - - - - - - - - $(XEngine_Include);../../XEngine_Depend/XEngine_Module/jsoncpp;$(IncludePath) - $(XEngine_Lib32);$(LibraryPath) - $(SolutionDir)$(Configuration)\XEngine_LibPlugin\ - $(Configuration)\XEngine_LibPlugin\ - - - $(SolutionDir)$(Platform)\$(Configuration)\XEngine_LibPlugin\ - $(Platform)\$(Configuration)\XEngine_LibPlugin\ - $(XEngine_Include);../../XEngine_Depend/XEngine_Module/jsoncpp;$(IncludePath) - $(ReferencePath) - $(XEngine_Lib64);$(LibraryPath) - - - $(XEngine_Include);../../XEngine_Depend/XEngine_Module/jsoncpp;$(IncludePath) - $(XEngine_Lib32);$(LibraryPath) - $(SolutionDir)$(Configuration)\XEngine_LibPlugin\ - $(Configuration)\XEngine_LibPlugin\ - - - $(XEngine_Include);../../XEngine_Depend/XEngine_Module/jsoncpp;$(IncludePath) - $(XEngine_Lib64);$(LibraryPath) - $(SolutionDir)$(Platform)\$(Configuration)\XEngine_LibPlugin\ - $(Platform)\$(Configuration)\XEngine_LibPlugin\ - - - - Level3 - true - WIN32;_DEBUG;MODULEPLUGINPHONE_EXPORTS;_WINDOWS;_USRDLL;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) - true - Use - pch.h - - - Windows - true - false - ModulePlugin_Phone.def - - - - - Level3 - true - true - true - WIN32;NDEBUG;MODULEPLUGINPHONE_EXPORTS;_WINDOWS;_USRDLL;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) - true - Use - pch.h - - - Windows - true - true - true - false - ModulePlugin_Phone.def - - - - - Level3 - true - _DEBUG;MODULEPLUGINPHONE_EXPORTS;_WINDOWS;_USRDLL;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) - true - Use - pch.h - - - Windows - true - false - ModulePlugin_Phone.def - - - - - Level3 - true - true - true - NDEBUG;MODULEPLUGINPHONE_EXPORTS;_WINDOWS;_USRDLL;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) - true - Use - pch.h - - - Windows - true - true - true - false - ModulePlugin_Phone.def - - - - - - - - - - - - - - - - Create - Create - Create - Create - - - - - - - - - \ No newline at end of file diff --git a/XEngine_Source/XEngine_PluginModule/ModulePlugin_Phone/ModulePlugin_Phone.vcxproj.filters b/XEngine_Source/XEngine_PluginModule/ModulePlugin_Phone/ModulePlugin_Phone.vcxproj.filters deleted file mode 100644 index a855fd3aa4a5037e154f33214a1a5712d0465604..0000000000000000000000000000000000000000 --- a/XEngine_Source/XEngine_PluginModule/ModulePlugin_Phone/ModulePlugin_Phone.vcxproj.filters +++ /dev/null @@ -1,68 +0,0 @@ - - - - - {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 - - - {e100b797-4228-40ce-b9ae-66fba2991aa3} - - - {ebaf7bf0-c07c-4330-b2f4-487461d2d37b} - - - {b156edba-6b44-4339-a1a5-e79bc39726c0} - - - {82f1b7e8-4212-4b85-9b66-389d3fabcb66} - - - - - 头文件 - - - 头文件 - - - 头文件\ModulePlugin_DBPhone - - - 头文件\ModulePlugin_APIPhone - - - 头文件 - - - 头文件 - - - - - 源文件 - - - 源文件 - - - 源文件\ModulePlugin_DBPhone - - - 源文件\ModulePlugin_APIPhone - - - - - 源文件 - - - \ No newline at end of file diff --git a/XEngine_Source/XEngine_PluginModule/ModulePlugin_Phone/ModulePlugin_Phone.vcxproj.user b/XEngine_Source/XEngine_PluginModule/ModulePlugin_Phone/ModulePlugin_Phone.vcxproj.user deleted file mode 100644 index 88a550947edbc3c5003a41726f0749201fdb6822..0000000000000000000000000000000000000000 --- a/XEngine_Source/XEngine_PluginModule/ModulePlugin_Phone/ModulePlugin_Phone.vcxproj.user +++ /dev/null @@ -1,4 +0,0 @@ - - - - \ No newline at end of file diff --git a/XEngine_Source/XEngine_PluginModule/ModulePlugin_Phone/PluginPhone_Define.h b/XEngine_Source/XEngine_PluginModule/ModulePlugin_Phone/PluginPhone_Define.h deleted file mode 100644 index d3744ec275cea954726c77c060a4a52dc82faab0..0000000000000000000000000000000000000000 --- a/XEngine_Source/XEngine_PluginModule/ModulePlugin_Phone/PluginPhone_Define.h +++ /dev/null @@ -1,74 +0,0 @@ -#pragma once -/******************************************************************** -// Created: 2023/01/10 11:39:12 -// File Name: D:\XEngine_APIService\XEngine_Source\XEngine_PluginModule\ModulePlugin_Phone\PluginPhone_Define.h -// File Path: D:\XEngine_APIService\XEngine_Source\XEngine_PluginModule\ModulePlugin_Phone -// File Base: PluginPhone_Define -// File Ext: h -// Project: XEngine -// Author: qyt -// Purpose: 电话号码查询导出 -// History: -*********************************************************************/ -//电话号码类型 -typedef enum -{ - ENUM_XENGINE_APISERVICE_PHONE_TYPE_UNKNOWN = 0, // 未知,查找失败 - ENUM_XENGINE_APISERVICE_PHONE_TYPE_CMCC, // 中国移动 - ENUM_XENGINE_APISERVICE_PHONE_TYPE_CUCC, // 中国联通 - ENUM_XENGINE_APISERVICE_PHONE_TYPE_CTCC, // 中国电信 - ENUM_XENGINE_APISERVICE_PHONE_TYPE_CTCC_V, // 电信虚拟运营商 - ENUM_XENGINE_APISERVICE_PHONE_TYPE_CUCC_V, // 联通虚拟运营商 - ENUM_XENGINE_APISERVICE_PHONE_TYPE_CMCC_V // 移动虚拟运营商 -}ENUM_XENGINE_APISERVICE_PHONE_TYPE; -////////////////////////////////////////////////////////////////////////// -// 导出函数定义 -////////////////////////////////////////////////////////////////////////// -typedef struct -{ - XCHAR tszProvincer[64]; //省/自治区/直辖市 - XCHAR tszCity[64]; //市/区 - __int64x nPhoneNumber; //电话号码 - int nZipCode; //邮编 - int nAreaCode; //区号 - ENUM_XENGINE_APISERVICE_PHONE_TYPE enPhoneType; //电话号码类型 -}XENGINE_PHONEINFO; -////////////////////////////////////////////////////////////////////////// -// 导出函数定义 -////////////////////////////////////////////////////////////////////////// -extern "C" XLONG PluginCore_GetLastError(); -/********************************************************************************* -* 导出函数定义 * -*********************************************************************************/ -/******************************************************************** -函数名称:PluginCore_Init -函数功能:初始化插件模块 - 参数.一:lParam - In/Out:In/Out - 类型:无类型指针 - 可空:N - 意思:自定义参数 -返回值 - 类型:逻辑型 - 意思:是否成功 -备注: -*********************************************************************/ -extern "C" bool PluginCore_Init(XPVOID lParam = NULL); -/******************************************************************** -函数名称:PluginCore_UnInit -函数功能:卸载插件 -返回值 - 类型:无 - 意思: -备注: -*********************************************************************/ -extern "C" void PluginCore_UnInit(); -/******************************************************************** -函数名称:PluginCore_Call -函数功能:调用插件 -返回值 - 类型:逻辑型 - 意思:是否成功 -备注: -*********************************************************************/ -extern "C" bool PluginCore_Call(XCHAR * **pppHDRList, int nListCount, int* pInt_HTTPCode, XCHAR * ptszMsgBuffer, int* pInt_MsgLen, LPCXSTR lpszMsgBuffer = NULL, int nMsgLen = 0); \ No newline at end of file diff --git a/XEngine_Source/XEngine_PluginModule/ModulePlugin_Phone/PluginPhone_Error.h b/XEngine_Source/XEngine_PluginModule/ModulePlugin_Phone/PluginPhone_Error.h deleted file mode 100644 index 622597d2971ef547e07e6768948dbd8c2e90ab00..0000000000000000000000000000000000000000 --- a/XEngine_Source/XEngine_PluginModule/ModulePlugin_Phone/PluginPhone_Error.h +++ /dev/null @@ -1,18 +0,0 @@ -#pragma once -/******************************************************************** -// Created: 2023/01/10 11:39:26 -// File Name: D:\XEngine_APIService\XEngine_Source\XEngine_PluginModule\ModulePlugin_Phone\PluginPhone_Error.h -// File Path: D:\XEngine_APIService\XEngine_Source\XEngine_PluginModule\ModulePlugin_Phone -// File Base: PluginPhone_Error -// File Ext: h -// Project: XEngine -// Author: qyt -// Purpose: 电话号码错误导出 -// History: -*********************************************************************/ -////////////////////////////////////////////////////////////////////////// -// 错误定义 -////////////////////////////////////////////////////////////////////////// -#define ERROR_XENGINE_APISERVICE_PLUGIN_MODULE_PHONE_PARAMENT 0xB2001 //初始化失败.参数错误 -#define ERROR_XENGINE_APISERVICE_PLUGIN_MODULE_PHONE_MALLOC 0xB2002 //申请内存失败 -#define ERROR_XENGINE_APISERVICE_PLUGIN_MODULE_PHONE_NOTFOUND 0xB1002 //没有找到 \ No newline at end of file diff --git a/XEngine_Source/XEngine_PluginModule/ModulePlugin_Phone/dllmain.cpp b/XEngine_Source/XEngine_PluginModule/ModulePlugin_Phone/dllmain.cpp deleted file mode 100644 index 594ff2123d474b129bb2014fb572f03c9741bf0b..0000000000000000000000000000000000000000 --- a/XEngine_Source/XEngine_PluginModule/ModulePlugin_Phone/dllmain.cpp +++ /dev/null @@ -1,19 +0,0 @@ -// dllmain.cpp : 定义 DLL 应用程序的入口点。 -#include "pch.h" - -bool APIENTRY DllMain( HMODULE hModule, - XLONG ul_reason_for_call, - XPVOID lpReserved - ) -{ - switch (ul_reason_for_call) - { - case DLL_PROCESS_ATTACH: - case DLL_THREAD_ATTACH: - case DLL_THREAD_DETACH: - case DLL_PROCESS_DETACH: - break; - } - return true; -} - diff --git a/XEngine_Source/XEngine_PluginModule/ModulePlugin_Phone/framework.h b/XEngine_Source/XEngine_PluginModule/ModulePlugin_Phone/framework.h deleted file mode 100644 index 80cbbc9b06a9b0141f92ee19eceaed71328caff4..0000000000000000000000000000000000000000 --- a/XEngine_Source/XEngine_PluginModule/ModulePlugin_Phone/framework.h +++ /dev/null @@ -1,5 +0,0 @@ -#pragma once - -#define WIN32_LEAN_AND_MEAN // 从 Windows 头文件中排除极少使用的内容 -// Windows 头文件 -#include diff --git a/XEngine_Source/XEngine_PluginModule/ModulePlugin_Phone/pch.cpp b/XEngine_Source/XEngine_PluginModule/ModulePlugin_Phone/pch.cpp deleted file mode 100644 index 821e5b33f1854bdd39fb890d3d766b278010b837..0000000000000000000000000000000000000000 --- a/XEngine_Source/XEngine_PluginModule/ModulePlugin_Phone/pch.cpp +++ /dev/null @@ -1,39 +0,0 @@ -#include "pch.h" -#include "ModulePlugin_APIPhone/ModulePlugin_APIPhone.h" -/******************************************************************** -// Created: 2022/04/21 15:52:56 -// File Name: D:\XEngine_APIService\XEngine_Source\XEngine_PluginModule\ModulePlugin_Password\pch.cpp -// File Path: D:\XEngine_APIService\XEngine_Source\XEngine_PluginModule\ModulePlugin_Password -// File Base: pch -// File Ext: cpp -// Project: XEngine(网络通信引擎) -// Author: qyt -// Purpose: 导出实现 -// History: -*********************************************************************/ -bool Phone_IsErrorOccur = false; -XLONG Phone_dwErrorCode = 0; -////////////////////////////////////////////////////////////////////////// -CModulePlugin_APIPhone m_PluginPhone; -////////////////////////////////////////////////////////////////////////// -// 导出函数定义 -////////////////////////////////////////////////////////////////////////// -extern "C" XLONG PluginCore_GetLastError() -{ - return Phone_dwErrorCode; -} -/********************************************************************************* -* 导出函数定义 * -*********************************************************************************/ -extern "C" bool PluginCore_Init(XPVOID lParam) -{ - return m_PluginPhone.PluginCore_Init(lParam); -} -extern "C" void PluginCore_UnInit() -{ - m_PluginPhone.PluginCore_UnInit(); -} -extern "C" bool PluginCore_Call(XCHAR * **pppHDRList, int nListCount, int* pInt_HTTPCode, XCHAR * ptszMsgBuffer, int* pInt_MsgLen, LPCXSTR lpszMsgBuffer, int nMsgLen) -{ - return m_PluginPhone.PluginCore_Call(pppHDRList, nListCount, pInt_HTTPCode, ptszMsgBuffer, pInt_MsgLen, lpszMsgBuffer, nMsgLen); -} \ No newline at end of file diff --git a/XEngine_Source/XEngine_PluginModule/ModulePlugin_Phone/pch.h b/XEngine_Source/XEngine_PluginModule/ModulePlugin_Phone/pch.h deleted file mode 100644 index 51926533e182a24bc49ba64473d8305f81cee99e..0000000000000000000000000000000000000000 --- a/XEngine_Source/XEngine_PluginModule/ModulePlugin_Phone/pch.h +++ /dev/null @@ -1,56 +0,0 @@ -// pch.h: 这是预编译标头文件。 -// 下方列出的文件仅编译一次,提高了将来生成的生成性能。 -// 这还将影响 IntelliSense 性能,包括代码完成和许多代码浏览功能。 -// 但是,如果此处列出的文件中的任何一个在生成之间有更新,它们全部都将被重新编译。 -// 请勿在此处添加要频繁更新的文件,这将使得性能优势无效。 - -#ifndef PCH_H -#define PCH_H - -#ifdef _MSC_BUILD -// 添加要在此处预编译的标头 -#include "framework.h" -#include -#endif -#endif //PCH_H -#include -#include -#include -#include -#include -#include -#include "PluginPhone_Define.h" -#include "PluginPhone_Error.h" -using namespace std; -/******************************************************************** -// Created: 2023/01/09 17:08:50 -// File Name: D:\XEngine_APIService\XEngine_Source\XEngine_PluginModule\ModulePlugin_Phone\pch.h -// File Path: D:\XEngine_APIService\XEngine_Source\XEngine_PluginModule\ModulePlugin_Phone -// File Base: pch -// File Ext: h -// Project: XEngine -// Author: qyt -// Purpose: 公用头文件 -// History: -*********************************************************************/ -extern bool Phone_IsErrorOccur; -extern XLONG Phone_dwErrorCode; - -#include "ModulePlugin_DBPhone/ModulePlugin_DBPhone.h" - -#ifdef _MSC_BUILD -#pragma comment(lib,"XEngine_BaseLib/XEngine_BaseLib") -#ifdef _DEBUG -#ifdef _WIN64 -#pragma comment(lib,"../../x64/Debug/jsoncpp") -#else -#pragma comment(lib,"../../Debug/jsoncpp") -#endif -#else -#ifdef _WIN64 -#pragma comment(lib,"../../x64/Release/jsoncpp") -#else -#pragma comment(lib,"../../Release/jsoncpp") -#endif -#endif -#endif \ No newline at end of file diff --git a/XEngine_Source/XEngine_ServiceApp/XEngine_HttpApp/Makefile b/XEngine_Source/XEngine_ServiceApp/XEngine_HttpApp/Makefile index 1b5d075af7f358db55d9201ebb3305d841c1469f..452a81ce3a6638290c849767f266d7eeff4774fa 100644 --- a/XEngine_Source/XEngine_ServiceApp/XEngine_HttpApp/Makefile +++ b/XEngine_Source/XEngine_ServiceApp/XEngine_HttpApp/Makefile @@ -8,14 +8,16 @@ RELEASE = 0 UNICODE = 0 LOADHDR = -I ./ LOADSO = -L ../../XEngine_ModuleConfigure -L ../../XEngine_ModuleDatabase -L ../../XEngine_ModuleProtocol -L ../../XEngine_ModuleSystem -L ../../XEngine_ModuleHelp -L ../../XEngine_ModulePlugin \ - -L ../../XEngine_Depend/XEngine_Module/jsoncpp -L ../../XEngine_Depend/XEngine_Module/XEngine_InfoReport -LIB = -lXEngine_BaseLib -lXEngine_Algorithm -lXEngine_Core -lXEngine_ManagePool -lXEngine_OPenSsl -lXClient_Stream -lXClient_APIHelp -lHelpComponents_XLog -lRfcComponents_HttpProtocol -lRfcComponents_NatProtocol -lRfcComponents_NTPProtocol -lXEngine_ProcFile -lXEngine_SystemApi -lXEngine_AVHelp -lXEngine_VideoCodec -lXEngine_AudioCodec -lXEngine_AVCollect \ + -L ../../XEngine_Depend/XEngine_Module/jsoncpp -L ../../XEngine_Depend/XEngine_Module/XEngine_InfoReport \ + -L ../../XEngine_DBDepend/XEngine_IPMacData/XEngine_Source/XEngine_APIModuleIPMac -L ../../XEngine_DBDepend/XEngine_PhoneData/Source/C/XEngine_APIModulePhone +LIB = -lXEngine_BaseSafe -lXEngine_BaseLib -lXEngine_Algorithm -lXEngine_Core -lXEngine_ManagePool -lXEngine_OPenSsl -lXClient_Stream -lXClient_APIHelp -lHelpComponents_XLog -lRfcComponents_HttpProtocol -lRfcComponents_NatProtocol -lRfcComponents_NTPProtocol -lXEngine_ProcFile -lXEngine_SystemApi -lXEngine_AVHelp -lXEngine_VideoCodec -lXEngine_AudioCodec -lXEngine_AVCollect \ -lXEngine_ModuleConfigure -lXEngine_ModuleDatabase -lXEngine_ModuleProtocol -lXEngine_ModuleSystem -lXEngine_ModuleHelp -lXEngine_ModulePlugin \ - -ljsoncpp -lXEngine_InfoReport + -ljsoncpp -lXEngine_InfoReport \ + -lXEngine_APIModuleIPMac -lXEngine_APIModulePhone LIBEX = OBJECTS = XEngine_Configure.o XEngine_Network.o XEngine_HTTPTask.o XEngine_PluginTask.o XEngine_HttpApp.o \ RFCTask_Ntp.o RFCTask_Stun.o \ - TaskGet_Bank.o TaskGet_IDCard.o TaskGet_Locker.o TaskGet_Translation.o TaskGet_Reload.o TaskGet_Weather.o TaskGet_IDRegion.o TaskGet_Oil.o \ + TaskGet_Bank.o TaskGet_IDCard.o TaskGet_Locker.o TaskGet_Translation.o TaskGet_Reload.o TaskGet_Weather.o TaskGet_IDRegion.o TaskGet_Oil.o TaskGet_APIModule.o \ TaskPost_DTest.o TaskPost_Log.o TaskPost_P2PClient.o TaskPost_PostCode.o TaskPost_QRCode.o TaskPost_ShortLink.o TaskPost_SocketTest.o TaskPost_WordFilter.o TaskPost_Image.o TaskPost_BackService.o TaskPost_Deamon.o TaskPost_Machine.o ifeq ($(RELEASE),1) @@ -87,6 +89,8 @@ TaskGet_IDRegion.o:./XEngine_TaskGet/TaskGet_IDRegion.cpp $(CC) $(DEBUG) $(FLAGS) $(UNICODE) $(PLATVER) $(LOADHDR) ./XEngine_TaskGet/TaskGet_IDRegion.cpp TaskGet_Oil.o:./XEngine_TaskGet/TaskGet_Oil.cpp $(CC) $(DEBUG) $(FLAGS) $(UNICODE) $(PLATVER) $(LOADHDR) ./XEngine_TaskGet/TaskGet_Oil.cpp +TaskGet_APIModule.o:./XEngine_TaskGet/TaskGet_APIModule.cpp + $(CC) $(DEBUG) $(FLAGS) $(UNICODE) $(PLATVER) $(LOADHDR) ./XEngine_TaskGet/TaskGet_APIModule.cpp TaskPost_DTest.o:./XEngine_TaskPost/TaskPost_DTest.cpp $(CC) $(DEBUG) $(FLAGS) $(UNICODE) $(PLATVER) $(LOADHDR) ./XEngine_TaskPost/TaskPost_DTest.cpp diff --git a/XEngine_Source/XEngine_ServiceApp/XEngine_HttpApp/XEngine_HTTPTask.cpp b/XEngine_Source/XEngine_ServiceApp/XEngine_HttpApp/XEngine_HTTPTask.cpp index ad1a7ad11922b9b7ffe629a82e9cab667a913349..917079a269d1ea779253f97c07eff5ed284645a1 100644 --- a/XEngine_Source/XEngine_ServiceApp/XEngine_HttpApp/XEngine_HTTPTask.cpp +++ b/XEngine_Source/XEngine_ServiceApp/XEngine_HttpApp/XEngine_HTTPTask.cpp @@ -114,6 +114,9 @@ bool HTTPTask_TastPost_Handle(RFCCOMPONENTS_HTTP_REQPARAM* pSt_HTTPParam, LPCXST LPCXSTR lpszParamWeather = _X("weather"); LPCXSTR lpszParamRegion = _X("region"); LPCXSTR lpszParamOil = _X("oil"); + LPCXSTR lpszParamPhone = _X("phone"); + LPCXSTR lpszParamIPAddr = _X("ip"); + LPCXSTR lpszParamMacInfo = _X("mac"); //post LPCXSTR lpszParamP2PClient = _X("p2p"); LPCXSTR lpszParamZIPCode = _X("zipcode"); @@ -445,6 +448,16 @@ bool HTTPTask_TastPost_Handle(RFCCOMPONENTS_HTTP_REQPARAM* pSt_HTTPParam, LPCXST BaseLib_OperatorString_GetKeyValue(pptszList[1], "=", tszKey, tszValue); HTTPTask_TaskGet_Oil(lpszClientAddr, tszValue); } + else if ((0 == _tcsxnicmp(lpszParamPhone, tszValue, _tcsxlen(lpszParamPhone))) || (0 == _tcsxnicmp(lpszParamIPAddr, tszValue, _tcsxlen(lpszParamIPAddr))) || (0 == _tcsxnicmp(lpszParamMacInfo, tszValue, _tcsxlen(lpszParamMacInfo)))) + { + //phone:http://127.0.0.1:5501/api?function=phone¶m=1369943 + //ip:http://127.0.0.1:5501/api?function=ip¶m=117.172.221.14 + //mac:http://127.0.0.1:5501/api?function=mac¶m=00:00:0C + memset(tszMsgBuffer, '\0', sizeof(tszMsgBuffer)); + + BaseLib_OperatorString_GetKeyValue(pptszList[1], "=", tszKey, tszMsgBuffer); + HTTPTask_TaskGet_APIModule(lpszClientAddr, tszValue, tszMsgBuffer); + } else { st_HDRParam.nHttpCode = 404; diff --git a/XEngine_Source/XEngine_ServiceApp/XEngine_HttpApp/XEngine_Hdr.h b/XEngine_Source/XEngine_ServiceApp/XEngine_HttpApp/XEngine_Hdr.h index aeb717bdce681dd1abb9e843a30e8532eaa7ec40..2c1a22fbb68ab46c392ca94c8d939f36b0c51f78 100644 --- a/XEngine_Source/XEngine_ServiceApp/XEngine_HttpApp/XEngine_Hdr.h +++ b/XEngine_Source/XEngine_ServiceApp/XEngine_HttpApp/XEngine_Hdr.h @@ -24,6 +24,8 @@ using namespace std; #include #include #include +#include +#include #include #include #include @@ -57,6 +59,12 @@ using namespace std; #include #include "../../XEngine_Depend/XEngine_Module/XEngine_InfoReport/InfoReport_Define.h" #include "../../XEngine_Depend/XEngine_Module/XEngine_InfoReport/InfoReport_Error.h" +#include "../../XEngine_DBDepend/XEngine_IPMacData/XEngine_Source/XIPMac_CommHdr.h" +#include "../../XEngine_DBDepend/XEngine_IPMacData/XEngine_Source/XEngine_APIModuleIPMac/APIIPMac_Define.h" +#include "../../XEngine_DBDepend/XEngine_IPMacData/XEngine_Source/XEngine_APIModuleIPMac/APIIPMac_Error.h" +#include "../../XEngine_DBDepend/XEngine_PhoneData/Source/XPhone_CommHdr.h" +#include "../../XEngine_DBDepend/XEngine_PhoneData/Source/C/XEngine_APIModulePhone/APIPhone_Define.h" +#include "../../XEngine_DBDepend/XEngine_PhoneData/Source/C/XEngine_APIModulePhone/APIPhone_Error.h" //加载项目相关头文件 #include "../../XEngine_BuildSwitch.h" #include "../../XEngine_UserProtocol.h" @@ -99,6 +107,7 @@ using namespace std; #include "XEngine_TaskGet/TaskGet_Weather.h" #include "XEngine_TaskGet/TaskGet_IDRegion.h" #include "XEngine_TaskGet/TaskGet_Oil.h" +#include "XEngine_TaskGet/TaskGet_APIModule.h" //rfc #include "XEngine_TaskRfc/RFCTask_Stun.h" #include "XEngine_TaskRfc/RFCTask_Ntp.h" @@ -136,6 +145,8 @@ extern XENGINE_DEAMONAPPLIST st_DeamonAppConfig; #ifdef _WIN64 #ifdef _DEBUG #pragma comment(lib,"../../x64/Debug/XEngine_InfoReport.lib") +#pragma comment(lib,"../../x64/Debug/XEngine_APIModuleIPMac.lib") +#pragma comment(lib,"../../x64/Debug/XEngine_APIModulePhone.lib") #pragma comment(lib,"../../x64/Debug/XEngine_ModuleConfigure.lib") #pragma comment(lib,"../../x64/Debug/XEngine_ModuleDatabase.lib") #pragma comment(lib,"../../x64/Debug/XEngine_ModuleProtocol.lib") @@ -144,6 +155,8 @@ extern XENGINE_DEAMONAPPLIST st_DeamonAppConfig; #pragma comment(lib,"../../x64/Debug/XEngine_ModulePlugin.lib") #else #pragma comment(lib,"../../x64/Release/XEngine_InfoReport.lib") +#pragma comment(lib,"../../x64/Release/XEngine_APIModuleIPMac.lib") +#pragma comment(lib,"../../x64/Release/XEngine_APIModulePhone.lib") #pragma comment(lib,"../../x64/Release/XEngine_ModuleConfigure.lib") #pragma comment(lib,"../../x64/Release/XEngine_ModuleDatabase.lib") #pragma comment(lib,"../../x64/Release/XEngine_ModuleProtocol.lib") @@ -154,6 +167,8 @@ extern XENGINE_DEAMONAPPLIST st_DeamonAppConfig; #else #ifdef _DEBUG #pragma comment(lib,"../../Debug/XEngine_InfoReport.lib") +#pragma comment(lib,"../../Debug/XEngine_APIModuleIPMac.lib") +#pragma comment(lib,"../../Debug/XEngine_APIModulePhone.lib") #pragma comment(lib,"../../Debug/XEngine_ModuleConfigure.lib") #pragma comment(lib,"../../Debug/XEngine_ModuleDatabase.lib") #pragma comment(lib,"../../Debug/XEngine_ModuleProtocol.lib") @@ -162,6 +177,8 @@ extern XENGINE_DEAMONAPPLIST st_DeamonAppConfig; #pragma comment(lib,"../../Debug/XEngine_ModulePlugin.lib") #else #pragma comment(lib,"../../Release/XEngine_InfoReport.lib") +#pragma comment(lib,"../../Release/XEngine_APIModuleIPMac.lib") +#pragma comment(lib,"../../Release/XEngine_APIModulePhone.lib") #pragma comment(lib,"../../Release/XEngine_ModuleConfigure.lib") #pragma comment(lib,"../../Release/XEngine_ModuleDatabase.lib") #pragma comment(lib,"../../Release/XEngine_ModuleProtocol.lib") @@ -171,6 +188,7 @@ extern XENGINE_DEAMONAPPLIST st_DeamonAppConfig; #endif #endif #pragma comment(lib,"XEngine_BaseLib/XEngine_BaseLib.lib") +#pragma comment(lib,"XEngine_BaseLib/XEngine_BaseSafe.lib") #pragma comment(lib,"XEngine_Core/XEngine_Core.lib") #pragma comment(lib,"XEngine_Core/XEngine_ManagePool.lib") #pragma comment(lib,"XEngine_Core/XEngine_OPenSsl.lib") diff --git a/XEngine_Source/XEngine_ServiceApp/XEngine_HttpApp/XEngine_HttpApp.cpp b/XEngine_Source/XEngine_ServiceApp/XEngine_HttpApp/XEngine_HttpApp.cpp index 6265676b5034f86989108f579f94921189a70c0e..e68373b107d8ae2fe49bb73686488cd71b1b03d1 100644 --- a/XEngine_Source/XEngine_ServiceApp/XEngine_HttpApp/XEngine_HttpApp.cpp +++ b/XEngine_Source/XEngine_ServiceApp/XEngine_HttpApp/XEngine_HttpApp.cpp @@ -49,6 +49,9 @@ void ServiceApp_Stop(int signo) ModuleDatabase_Machine_Destory(); ModuleDatabase_OilInfo_Destory(); //销毁其他 + APIModule_IPAddr_UnInit(); + APIModule_MACInfo_UnInit(); + APIModule_PhoneNumber_UnInit(); ModulePlugin_Loader_Destory(); ModuleHelp_P2PClient_Destory(); //销毁日志资源 @@ -434,6 +437,30 @@ int main(int argc, char** argv) //展示能力 XLOG_PRINT(xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_INFO, _X("启动服务中,加载的Lib插件:%d 个,Lua插件:%d 个"), st_PluginLibConfig.pStl_ListPlugin->size(), st_PluginLuaConfig.pStl_ListPlugin->size()); + if (st_ServiceConfig.st_XAPIModule.bEnable) + { + if (!APIModule_IPAddr_Init(st_ServiceConfig.st_XAPIModule.tszDBIPAddr)) + { + XLOG_PRINT(xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_ERROR, _X("启动服务中,启动IP地址数据查询服务:%s 失败,错误:%lX"), st_ServiceConfig.st_XAPIModule.tszDBIPAddr, APIIPMac_GetLastError()); + } + XLOG_PRINT(xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_INFO, _X("启动服务中,启动IP地址数据查询服务:%s 成功"), st_ServiceConfig.st_XAPIModule.tszDBIPAddr); + + if (!APIModule_MACInfo_Init(st_ServiceConfig.st_XAPIModule.tszDBMac)) + { + XLOG_PRINT(xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_ERROR, _X("启动服务中,启动MAC地址数据查询服务:%s 失败,错误:%lX"), st_ServiceConfig.st_XAPIModule.tszDBMac, APIIPMac_GetLastError()); + } + XLOG_PRINT(xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_INFO, _X("启动服务中,启动MAC地址数据查询服务:%s 成功"), st_ServiceConfig.st_XAPIModule.tszDBMac); + + if (!APIModule_PhoneNumber_Init(st_ServiceConfig.st_XAPIModule.tszDBPhone)) + { + XLOG_PRINT(xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_ERROR, _X("启动服务中,启动电话号码数据查询服务:%s 失败,错误:%lX"), st_ServiceConfig.st_XAPIModule.tszDBPhone, APIPhone_GetLastError()); + } + XLOG_PRINT(xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_INFO, _X("启动服务中,启动电话号码数据查询服务:%s 成功"), st_ServiceConfig.st_XAPIModule.tszDBPhone); + } + else + { + XLOG_PRINT(xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_WARN, _X("启动服务中,数据查询服务没有启用")); + } //发送信息报告 if (st_ServiceConfig.st_XReport.bEnable) { @@ -480,6 +507,9 @@ XENGINE_SERVICEAPP_EXIT: ModuleDatabase_Machine_Destory(); ModuleDatabase_OilInfo_Destory(); //销毁其他 + APIModule_IPAddr_UnInit(); + APIModule_MACInfo_UnInit(); + APIModule_PhoneNumber_UnInit(); ModulePlugin_Loader_Destory(); ModuleHelp_P2PClient_Destory(); //销毁日志资源 diff --git a/XEngine_Source/XEngine_ServiceApp/XEngine_HttpApp/XEngine_HttpApp.vcxproj b/XEngine_Source/XEngine_ServiceApp/XEngine_HttpApp/XEngine_HttpApp.vcxproj index ba5d8bf57700b34e258531b7828c0bd9b9f2e6af..c0fe737b57b5c571e121f52871a982993c2b2c2c 100644 --- a/XEngine_Source/XEngine_ServiceApp/XEngine_HttpApp/XEngine_HttpApp.vcxproj +++ b/XEngine_Source/XEngine_ServiceApp/XEngine_HttpApp/XEngine_HttpApp.vcxproj @@ -158,6 +158,7 @@ + @@ -187,6 +188,7 @@ + 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 d0f48281071879e4fb9f9c5df8f41baecb21f9c7..0f31a8af090ed06c2aa475d236643b98d1de19e3 100644 --- a/XEngine_Source/XEngine_ServiceApp/XEngine_HttpApp/XEngine_HttpApp.vcxproj.filters +++ b/XEngine_Source/XEngine_ServiceApp/XEngine_HttpApp/XEngine_HttpApp.vcxproj.filters @@ -114,6 +114,9 @@ 源文件\XEngine_TaskGet + + 源文件\XEngine_TaskGet + @@ -197,5 +200,8 @@ 头文件\XEngine_TaskGet + + 头文件\XEngine_TaskGet + \ No newline at end of file diff --git a/XEngine_Source/XEngine_ServiceApp/XEngine_HttpApp/XEngine_TaskGet/TaskGet_APIModule.cpp b/XEngine_Source/XEngine_ServiceApp/XEngine_HttpApp/XEngine_TaskGet/TaskGet_APIModule.cpp new file mode 100644 index 0000000000000000000000000000000000000000..f087ec00f70222bf3ddbddde15f4d860f70c22dd --- /dev/null +++ b/XEngine_Source/XEngine_ServiceApp/XEngine_HttpApp/XEngine_TaskGet/TaskGet_APIModule.cpp @@ -0,0 +1,91 @@ +#include "../XEngine_Hdr.h" + +bool HTTPTask_TaskGet_APIModule(LPCXSTR lpszClientAddr, LPCXSTR lpszQueryType, LPCXSTR lpszQueryStr) +{ + int nMsgLen = 4096; + int nPktLen = 4096; + XCHAR tszMsgBuffer[4096] = {}; + XCHAR tszPktBuffer[4096] = {}; + RFCCOMPONENTS_HTTP_HDRPARAM st_HDRParam = {}; //发送给客户端的参数 + + st_HDRParam.nHttpCode = 200; //HTTP CODE码 + st_HDRParam.bIsClose = true; //收到回复后就关闭 + + if (!st_ServiceConfig.st_XAPIModule.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,请求的数据:%s 查询服务:%s 功能已经被服务器关闭,无法继续"), lpszClientAddr, lpszQueryType, lpszQueryStr); + return false; + } + + LPCXSTR lpszQueryPhone = _X("phone"); + LPCXSTR lpszQueryIPAddr = _X("ip"); + LPCXSTR lpszQueryMacInfo = _X("mac"); + + if (0 == _tcsxnicmp(lpszQueryPhone, lpszQueryType, _tcsxlen(lpszQueryPhone))) + { + XENGINE_PHONEINFO st_PhoneInfo = {}; + + _tcsxcpy(st_PhoneInfo.tszPhoneNumber, lpszQueryStr); + + if (!APIModule_PhoneNumber_Query(&st_PhoneInfo)) + { + ModuleProtocol_Packet_Common(tszPktBuffer, &nPktLen, 404, _X("not found")); + 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 查询服务:%s 失败,错误码:%lX"), lpszClientAddr, lpszQueryType, lpszQueryStr, APIPhone_GetLastError()); + return false; + } + ModuleProtocol_Packet_PhoneInfo(tszPktBuffer, &nPktLen, &st_PhoneInfo); + 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 查询服务:%s 成功"), lpszClientAddr, lpszQueryType, lpszQueryStr); + } + else if (0 == _tcsxnicmp(lpszQueryIPAddr, lpszQueryType, _tcsxlen(lpszQueryIPAddr))) + { + XENGINE_IPADDRINFO st_IPAddr = {}; + + _tcsxcpy(st_IPAddr.tszIPAddr, lpszQueryStr); + + if (!APIModule_IPAddr_Query(&st_IPAddr)) + { + ModuleProtocol_Packet_Common(tszPktBuffer, &nPktLen, 404, _X("not found")); + 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 查询服务:%s 失败,错误码:%lX"), lpszClientAddr, lpszQueryType, lpszQueryStr, APIPhone_GetLastError()); + return false; + } + ModuleProtocol_Packet_IPAddr(tszPktBuffer, &nPktLen, &st_IPAddr); + 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 查询服务:%s 成功"), lpszClientAddr, lpszQueryType, lpszQueryStr); + } + else if (0 == _tcsxnicmp(lpszQueryMacInfo, lpszQueryType, _tcsxlen(lpszQueryMacInfo))) + { + XENGINE_MACADDRINFO st_MACInfo = {}; + _tcsxcpy(st_MACInfo.tszMACPrefix, lpszQueryStr); + + if (!APIModule_MACInfo_Query(&st_MACInfo)) + { + ModuleProtocol_Packet_Common(tszPktBuffer, &nPktLen, 404, _X("not found")); + 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 查询服务:%s 失败,错误码:%lX"), lpszClientAddr, lpszQueryType, lpszQueryStr, APIPhone_GetLastError()); + return false; + } + ModuleProtocol_Packet_MacInfo(tszPktBuffer, &nPktLen, &st_MACInfo); + 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 查询服务:%s 成功"), lpszClientAddr, lpszQueryType, lpszQueryStr); + } + else + { + ModuleProtocol_Packet_Common(tszPktBuffer, &nPktLen, 400, _X("not support")); + 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 查询服务:%s 失败,不支持的查询类型"), lpszClientAddr, lpszQueryType, lpszQueryStr); + } + return true; +} \ No newline at end of file diff --git a/XEngine_Source/XEngine_ServiceApp/XEngine_HttpApp/XEngine_TaskGet/TaskGet_APIModule.h b/XEngine_Source/XEngine_ServiceApp/XEngine_HttpApp/XEngine_TaskGet/TaskGet_APIModule.h new file mode 100644 index 0000000000000000000000000000000000000000..5dbab6d90a816d3cb86ddb1a432f57491d0da1c9 --- /dev/null +++ b/XEngine_Source/XEngine_ServiceApp/XEngine_HttpApp/XEngine_TaskGet/TaskGet_APIModule.h @@ -0,0 +1,3 @@ +#pragma once + +bool HTTPTask_TaskGet_APIModule(LPCXSTR lpszClientAddr, LPCXSTR lpszQueryType, LPCXSTR lpszQueryStr); \ No newline at end of file diff --git a/XEngine_Source/XEngine_ServiceApp/XEngine_HttpApp/XEngine_TaskGet/TaskGet_Translation.cpp b/XEngine_Source/XEngine_ServiceApp/XEngine_HttpApp/XEngine_TaskGet/TaskGet_Translation.cpp index 8d2e3dd048e498876bd6d3318e0d116378fae656..c3d8bb2bfe96503aad305c27c6119c5c72f08ad5 100644 --- a/XEngine_Source/XEngine_ServiceApp/XEngine_HttpApp/XEngine_TaskGet/TaskGet_Translation.cpp +++ b/XEngine_Source/XEngine_ServiceApp/XEngine_HttpApp/XEngine_TaskGet/TaskGet_Translation.cpp @@ -25,9 +25,17 @@ bool HTTPTask_TaskGet_Translation(LPCXSTR lpszClientAddr, LPCXSTR lpszMsgBuffer, XCHAR tszMD5Codec[MAX_PATH] = {}; XCHAR tszMD5Str[MAX_PATH] = {}; XCHAR tszURLStr[4096] = {}; + XCHAR tszUTFBuffer[2048] = {}; + +#ifdef _MSC_BUILD + int nGLen = _tcsxlen(lpszMsgBuffer); + BaseLib_OperatorCharset_AnsiToUTF(lpszMsgBuffer, tszUTFBuffer, &nGLen); +#else + _tcsxscpy(tszUTFBuffer, lpszMsgBuffer, sizeof(tszUTFBuffer)); +#endif int nRandomNumber = rand(); - int nLen = _xstprintf(tszSignStr, _X("%s%s%d%s"), st_ServiceConfig.st_XApi.st_TranslationInfo.tszAPPID, lpszMsgBuffer, nRandomNumber, st_ServiceConfig.st_XApi.st_TranslationInfo.tszAPPKey); + int nLen = _xstprintf(tszSignStr, _X("%s%s%d%s"), st_ServiceConfig.st_XApi.st_TranslationInfo.tszAPPID, tszUTFBuffer, nRandomNumber, st_ServiceConfig.st_XApi.st_TranslationInfo.tszAPPKey); OPenSsl_Api_Digest(tszSignStr, (XBYTE*)tszMD5Codec, &nLen); for (int i = 0; i < 16; i++) @@ -42,16 +50,17 @@ bool HTTPTask_TaskGet_Translation(LPCXSTR lpszClientAddr, LPCXSTR lpszMsgBuffer, ModuleHelp_Translation_Convert((ENUM_XENGINE_APISERVICE_TRANSLATION_TYPE)_ttxoi(lpszSrcStr), tszLanguageSrc); ModuleHelp_Translation_Convert((ENUM_XENGINE_APISERVICE_TRANSLATION_TYPE)_ttxoi(lpszDstStr), tszLanauageDst); - _xstprintf(tszURLStr, _X("%s?appid=%s&q=%s&from=%s&to=%s&salt=%d&sign=%s"), st_ServiceConfig.st_XApi.tszTranslationUrl, st_ServiceConfig.st_XApi.st_TranslationInfo.tszAPPID, lpszMsgBuffer, tszLanguageSrc, tszLanauageDst, nRandomNumber, tszMD5Str); + _xstprintf(tszURLStr, _X("%s?appid=%s&q=%s&from=%s&to=%s&salt=%d&sign=%s"), st_ServiceConfig.st_XApi.tszTranslationUrl, st_ServiceConfig.st_XApi.st_TranslationInfo.tszAPPID, tszUTFBuffer, tszLanguageSrc, tszLanauageDst, nRandomNumber, tszMD5Str); APIClient_Http_Request(_X("GET"), tszURLStr, NULL, NULL, &ptszBodyBuffer, &nBLen); + //解析数据 if (!ModuleProtocol_Parse_Translation(ptszBodyBuffer, nBLen, &st_LanguageInfo)) { ModuleProtocol_Packet_LanguageQuery(tszPktBuffer, &nPktLen, NULL, 1002, _X("translation failed")); - BaseLib_OperatorMemory_FreeCStyle((XPPMEM)&ptszBodyBuffer); 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, lpszMsgBuffer); + XLOG_PRINT(xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_INFO, _X("HTTP客户端:%s,请求的翻译失败,原始字符串:%s,错误数据:%s"), lpszClientAddr, lpszMsgBuffer, ptszBodyBuffer); + BaseLib_OperatorMemory_FreeCStyle((XPPMEM)&ptszBodyBuffer); return false; } //打包发送 diff --git a/XEngine_Source/XEngine_ServiceApp/XEngine_HttpApp/XEngine_TaskPost/TaskPost_BackService.cpp b/XEngine_Source/XEngine_ServiceApp/XEngine_HttpApp/XEngine_TaskPost/TaskPost_BackService.cpp index 5730465e74ab19f38180baafe5151b73b5be5878..51ad3699d1bbe3a164adbe2e64136098f7cc1c0d 100644 --- a/XEngine_Source/XEngine_ServiceApp/XEngine_HttpApp/XEngine_TaskPost/TaskPost_BackService.cpp +++ b/XEngine_Source/XEngine_ServiceApp/XEngine_HttpApp/XEngine_TaskPost/TaskPost_BackService.cpp @@ -7,14 +7,14 @@ static XNETHANDLE xhAudio = 0; static XNETHANDLE xhVideo = 0; static XHANDLE xhStream = NULL; -void CALLBACK HTTPTask_TaskPost_CBVideo(uint8_t* punStringY, int nYLen, uint8_t* punStringU, int nULen, uint8_t* punStringV, int nVLen, XPVOID lParam) +void CALLBACK HTTPTask_TaskPost_CBVideo(uint8_t* punStringY, int nYLen, uint8_t* punStringU, int nULen, uint8_t* punStringV, int nVLen, AVCOLLECT_TIMEINFO* pSt_TimeInfo, XPVOID lParam) { if (!XClient_StreamPush_LiveVideo(xhStream, punStringY, nYLen, punStringU, nULen, punStringV, nVLen)) { XLOG_PRINT(xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_ERROR, _X("屏幕采集器,推流编码失败,需要关闭推流服务,错误码:%lX"), StreamClient_GetLastError()); } } -void CALLBACK HTTPTask_TaskPost_CBAudio(uint8_t* punStringAudio, int nVLen, XPVOID lParam) +void CALLBACK HTTPTask_TaskPost_CBAudio(uint8_t* punStringAudio, int nVLen, AVCOLLECT_TIMEINFO* pSt_TimeInfo, XPVOID lParam) { if (!XClient_StreamPush_LiveAudio(xhStream, punStringAudio, nVLen)) { diff --git a/XEngine_Source/XEngine_ServiceApp/XEngine_HttpApp/XEngine_TaskPost/TaskPost_BackService.h b/XEngine_Source/XEngine_ServiceApp/XEngine_HttpApp/XEngine_TaskPost/TaskPost_BackService.h index 33d84304a0d9055670ee4b6a2c9610c346b5d8f0..4b892e121b15c10cce3ffda086b3e2a32366acc6 100644 --- a/XEngine_Source/XEngine_ServiceApp/XEngine_HttpApp/XEngine_TaskPost/TaskPost_BackService.h +++ b/XEngine_Source/XEngine_ServiceApp/XEngine_HttpApp/XEngine_TaskPost/TaskPost_BackService.h @@ -1,5 +1,5 @@ #pragma once -void CALLBACK HTTPTask_TaskPost_CBVideo(uint8_t* punStringY, int nYLen, uint8_t* punStringU, int nULen, uint8_t* punStringV, int nVLen, XPVOID lParam); -void CALLBACK HTTPTask_TaskPost_CBAudio(uint8_t* punStringAudio, int nVLen, XPVOID lParam); +void CALLBACK HTTPTask_TaskPost_CBVideo(uint8_t* punStringY, int nYLen, uint8_t* punStringU, int nULen, uint8_t* punStringV, int nVLen, AVCOLLECT_TIMEINFO* pSt_TimeInfo, XPVOID lParam); +void CALLBACK HTTPTask_TaskPost_CBAudio(uint8_t* punStringAudio, int nVLen, AVCOLLECT_TIMEINFO* pSt_TimeInfo, XPVOID lParam); bool HTTPTask_TaskPost_BackService(LPCXSTR lpszClientAddr, LPCXSTR lpszMsgBuffer, int nMsgLen, int nType); \ No newline at end of file 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 10d60514bb0a5ac249e379aa836c1f922ab8205d..357597c69ed8dba12d57ea256034303b624a6127 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 @@ -52,7 +52,7 @@ bool HTTPTask_TastPost_Machine(LPCXSTR lpszClientAddr, LPCXSTR lpszMsgBuffer, in ModuleProtocol_Packet_Common(tszRVBuffer, &nRVLen); HttpProtocol_Server_SendMsgEx(xhHTTPPacket, tszSDBuffer, &nSDLen, &st_HDRParam, tszRVBuffer, nRVLen); XEngine_Network_Send(lpszClientAddr, tszSDBuffer, nSDLen); - XLOG_PRINT(xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_INFO, _X("HTTP客户端:%s,请求插入一条信息收集数据成功,机器名:%s,机器编码:%s"), lpszClientAddr, st_MachineInfo.tszMachineName, st_MachineInfo.tszMachineCode); + 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) { @@ -60,7 +60,7 @@ bool HTTPTask_TastPost_Machine(LPCXSTR lpszClientAddr, LPCXSTR lpszMsgBuffer, in ModuleProtocol_Packet_Common(tszRVBuffer, &nRVLen); HttpProtocol_Server_SendMsgEx(xhHTTPPacket, tszSDBuffer, &nSDLen, &st_HDRParam, tszRVBuffer, nRVLen); XEngine_Network_Send(lpszClientAddr, tszSDBuffer, nSDLen); - XLOG_PRINT(xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_INFO, _X("HTTP客户端:%s,请求删除一条信息收集数据成功,机器名:%s,机器编码:%s"), lpszClientAddr, st_MachineInfo.tszMachineName, st_MachineInfo.tszMachineCode); + XLOG_PRINT(xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_INFO, _X("HTTP客户端:%s,请求删除一条信息收集数据成功,机器名:%s,服务名称:%s"), lpszClientAddr, st_MachineInfo.tszMachineSystem, st_MachineInfo.tszServiceName); } else if (2 == nType) { @@ -81,7 +81,7 @@ bool HTTPTask_TastPost_Machine(LPCXSTR lpszClientAddr, LPCXSTR lpszMsgBuffer, in HttpProtocol_Server_SendMsgEx(xhHTTPPacket, tszSDBuffer, &nSDLen, &st_HDRParam, tszRVBuffer, nRVLen); XEngine_Network_Send(lpszClientAddr, tszSDBuffer, nSDLen); BaseLib_OperatorMemory_Free((XPPPMEM)&ppSt_MachineInfo, nListCount); - XLOG_PRINT(xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_INFO, _X("HTTP客户端:%s,请求获取机器信息成功,服务名称:%s,机器编号:%s"), lpszClientAddr, st_MachineInfo.tszServiceName, st_MachineInfo.tszMachineCode); + XLOG_PRINT(xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_INFO, _X("HTTP客户端:%s,请求获取机器信息成功,机器名称:%s,服务名称:%s"), lpszClientAddr, st_MachineInfo.tszMachineSystem, st_MachineInfo.tszServiceName); } else { diff --git a/XEngine_Source/XEngine_UserProtocol.h b/XEngine_Source/XEngine_UserProtocol.h index 7af0718817e1e54bfd475ae68818e2a471d65f85..ccf71065cd8930b525b9ae1f3b33e95276188aac 100644 --- a/XEngine_Source/XEngine_UserProtocol.h +++ b/XEngine_Source/XEngine_UserProtocol.h @@ -235,8 +235,10 @@ typedef struct XCHAR tszMachineText[2048]; XCHAR tszServiceName[MAX_PATH]; XCHAR tszMachineName[MAX_PATH]; + XCHAR tszMachineUser[MAX_PATH]; XCHAR tszMachineCode[MAX_PATH]; XCHAR tszMachineSystem[MAX_PATH]; + XCHAR tszLastTime[64]; XCHAR tszCreateTime[64]; __int64x nTimeNumber; int nID;