diff --git a/CHANGELOG b/CHANGELOG index f45edd89b2b37c04865086544f807d5660e668b3..46ec2e9b45a8ca3050743dfb84fbd2ef8bd92dd8 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,27 @@ +XEngine_Authorize V3.5.0.1001 + +添加:禁用列表功能支持修改信息了 +添加:禁用功能支持启用和禁用 +添加:禁用功能支持过期时间设置了 +添加:本地CDKEY生成解析支持 +更新:HTTP请求函数 +修改:数据库句柄类型 +修改:管理程序不允许修改ROOT用户 +修改:管理程序可以双击打开用户修改界面了 +修改:IP禁用功能不在使用开始和结束字段了 +修正:管理程序登录的时候没有设置设备类型的问题 + +added:banned function to modify support +added:enable field for banned +added:banned function support left time +added:local cdkey support +update:http request function name +modify:XHDATA to XNETHANDLE +modify:root user is not allowed to modify +modify:open user modify window when double click user list +modify:does not need to start and end for ip address +fixed:management program have not device type when login +====================================================================================== XEngine_Authorize V3.4.0.1001 添加:windows窗口特效类 diff --git a/README.en.md b/README.en.md index 02b39b572890097a80f5687fd516b9e5459c43a6..9bef5b5fa30f6d0b39708367981f220087aebec5 100644 --- a/README.en.md +++ b/README.en.md @@ -108,6 +108,10 @@ The V1 version is an XEngine component. Most of the code is concentrated in XEng The V2 version comes out separately with all related modules and is developed separately The V3 version is a new version, developed to meet the requirements of many environments +## update guide +Database update Use Navicat and other database software to open the judgment table and the different fields for modification +After modification, directly copy the database to the new version to overwrite, and modify your configuration file + ## Authorization instructions Use this software must be open source and indicate the source,If you want closed source and commercial,Then need to be authorized by the author. diff --git a/README.md b/README.md index a8850845988830e58edd31f0c20005d75f47b238..a14383ebfafaabb99982da14a77ebcdddcf2fce9 100644 --- a/README.md +++ b/README.md @@ -108,6 +108,10 @@ V1版本为XEngine组件.大部分代码集中在XEngine中 V2版本单独出来了所有相关模块,单独开发 V3版本为全新版本,为了适应过多环境要求开发 +## 更新指导 +数据库更新使用Navicat等数据库软件打开判断表和字段不同的地方进行修改 +修改完毕后直接把数据库拷贝到新的版本进行覆盖,修改你的配置文件即可 + ## 授权说明 使用此软件必须开源并且注明出处,如果想闭源商用,那么需要经过作者授权. @@ -134,9 +138,7 @@ http basic和disgt支持 mysql支持 列表数据分割,用于大型服务器 支持用户和硬件绑定同时验证 -支持自定义序列号导入导出 统计用户所有在线时间 -账号封禁与处罚,时间永久 持久层,redis,memcached等支持 支持代理端(序列号分发,权限控制) 支持绑定自定义内容 diff --git a/XEngine_Apps/Authorize_APPClient.sln b/XEngine_Apps/Authorize_APPClient.sln index e8cd427aa77ccb4e9dfe8cbfdd95b3aed2a75e11..c8b5017355b6b31977a800680a37b1b1245740c7 100644 --- a/XEngine_Apps/Authorize_APPClient.sln +++ b/XEngine_Apps/Authorize_APPClient.sln @@ -5,6 +5,8 @@ VisualStudioVersion = 17.3.32804.467 MinimumVisualStudioVersion = 10.0.40219.1 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Authorize_APPClient", "Authorize_APPClient\Authorize_APPClient.vcxproj", "{4F263EAF-A748-46AF-A10E-8A25626E0571}" EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Authorize_APPLocal", "Authorize_APPLocal\Authorize_APPLocal.vcxproj", "{767151F7-230E-431B-AC6D-683F19F43C13}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|x64 = Debug|x64 @@ -21,6 +23,14 @@ Global {4F263EAF-A748-46AF-A10E-8A25626E0571}.Release|x64.Build.0 = Release|x64 {4F263EAF-A748-46AF-A10E-8A25626E0571}.Release|x86.ActiveCfg = Release|Win32 {4F263EAF-A748-46AF-A10E-8A25626E0571}.Release|x86.Build.0 = Release|Win32 + {767151F7-230E-431B-AC6D-683F19F43C13}.Debug|x64.ActiveCfg = Debug|x64 + {767151F7-230E-431B-AC6D-683F19F43C13}.Debug|x64.Build.0 = Debug|x64 + {767151F7-230E-431B-AC6D-683F19F43C13}.Debug|x86.ActiveCfg = Debug|Win32 + {767151F7-230E-431B-AC6D-683F19F43C13}.Debug|x86.Build.0 = Debug|Win32 + {767151F7-230E-431B-AC6D-683F19F43C13}.Release|x64.ActiveCfg = Release|x64 + {767151F7-230E-431B-AC6D-683F19F43C13}.Release|x64.Build.0 = Release|x64 + {767151F7-230E-431B-AC6D-683F19F43C13}.Release|x86.ActiveCfg = Release|Win32 + {767151F7-230E-431B-AC6D-683F19F43C13}.Release|x86.Build.0 = Release|Win32 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/XEngine_Apps/Authorize_APPClient/Authorize_APPClient.cpp b/XEngine_Apps/Authorize_APPClient/Authorize_APPClient.cpp index 8b769c483b22bde1f708ff4034aa8bd707339d93..c13314b74cc0da69c2689cd9e722721c543b6757 100644 --- a/XEngine_Apps/Authorize_APPClient/Authorize_APPClient.cpp +++ b/XEngine_Apps/Authorize_APPClient/Authorize_APPClient.cpp @@ -5,7 +5,7 @@ #pragma comment(lib,"XEngine_BaseLib/XEngine_BaseLib") #pragma comment(lib,"XEngine_Core/XEngine_OPenSsl") #pragma comment(lib,"XEngine_Client/XClient_Socket") -#pragma comment(lib,"XEngine_NetHelp/NetHelp_APIHelp") +#pragma comment(lib,"XEngine_NetHelp/NetHelp_APIClient") #pragma comment(lib,"../../XEngine_Source/Debug/jsoncpp") #else #include @@ -23,14 +23,14 @@ using namespace std; #include #include #include -#include -#include +#include +#include #include #include "../../XEngine_Source/XAuth_Protocol.h" //Windows::vs2022 x86 debug 编译即可 -//Linux::g++ -std=c++17 -Wall -g Auth_APPClient.cpp -o Auth_APPClient.exe -L ../../../XEngine/XEngine_Release/XEngine_Linux/Ubuntu/XEngine_BaseLib -L ../../../XEngine/XEngine_Release/XEngine_Linux/Ubuntu/XEngine_Core -L ../../../XEngine/XEngine_Release/XEngine_Linux/Ubuntu/XEngine_Client -L ../../../XEngine/XEngine_Release/XEngine_Linux/Ubuntu/XEngine_NetHelp -lXEngine_BaseLib -lXEngine_OPenSsl -lXClient_Socket -lNetHelp_APIHelp -lpthread -ljsoncpp -Wl,-rpath=../../../XEngine/XEngine_Release/XEngine_Linux/Ubuntu/XEngine_BaseLib:../../../XEngine/XEngine_Release/XEngine_Linux/Ubuntu/XEngine_Core:../../../XEngine/XEngine_Release/XEngine_Linux/Ubuntu/XEngine_Client:../../../XEngine/XEngine_Release/XEngine_Linux/Ubuntu/XEngine_NetHelp,--disable-new-dtags -//Macos::g++ -std=c++17 -Wall -g Auth_APPClient.cpp -o Auth_APPClient.exe -L ../../../XEngine/XEngine_Release/XEngine_Linux/Ubuntu/XEngine_BaseLib -L ../../../XEngine/XEngine_Release/XEngine_Linux/Ubuntu/XEngine_Core -L ../../../XEngine/XEngine_Release/XEngine_Linux/Ubuntu/XEngine_Client -L ../../../XEngine/XEngine_Release/XEngine_Linux/Ubuntu/XEngine_NetHelp -lXEngine_BaseLib -lXEngine_OPenSsl -lXClient_Socket -lNetHelp_APIHelp -lpthread -ljsoncpp +//Linux::g++ -std=c++17 -Wall -g Auth_APPClient.cpp -o Auth_APPClient.exe -L ../../../XEngine/XEngine_Release/XEngine_Linux/Ubuntu/XEngine_BaseLib -L ../../../XEngine/XEngine_Release/XEngine_Linux/Ubuntu/XEngine_Core -L ../../../XEngine/XEngine_Release/XEngine_Linux/Ubuntu/XEngine_Client -L ../../../XEngine/XEngine_Release/XEngine_Linux/Ubuntu/XEngine_NetHelp -lXEngine_BaseLib -lXEngine_OPenSsl -lXClient_Socket -lNetHelp_APIClient -lpthread -ljsoncpp -Wl,-rpath=../../../XEngine/XEngine_Release/XEngine_Linux/Ubuntu/XEngine_BaseLib:../../../XEngine/XEngine_Release/XEngine_Linux/Ubuntu/XEngine_Core:../../../XEngine/XEngine_Release/XEngine_Linux/Ubuntu/XEngine_Client:../../../XEngine/XEngine_Release/XEngine_Linux/Ubuntu/XEngine_NetHelp,--disable-new-dtags +//Macos::g++ -std=c++17 -Wall -g Auth_APPClient.cpp -o Auth_APPClient.exe -L ../../../XEngine/XEngine_Release/XEngine_Linux/Ubuntu/XEngine_BaseLib -L ../../../XEngine/XEngine_Release/XEngine_Linux/Ubuntu/XEngine_Core -L ../../../XEngine/XEngine_Release/XEngine_Linux/Ubuntu/XEngine_Client -L ../../../XEngine/XEngine_Release/XEngine_Linux/Ubuntu/XEngine_NetHelp -lXEngine_BaseLib -lXEngine_OPenSsl -lXClient_Socket -lNetHelp_APIClient -lpthread -ljsoncpp BOOL bRun = TRUE; BOOL bLogin = TRUE; @@ -118,7 +118,7 @@ int AuthClient_Register() int nMsgLen = 0; CHAR* ptszMsgBuffer = NULL; - APIHelp_HttpRequest_Custom(_T("POST"), lpszUrl, st_JsonRoot.toStyledString().c_str(), &nHTTPCode, &ptszMsgBuffer, &nMsgLen); + APIClient_Http_Request(_T("POST"), lpszUrl, st_JsonRoot.toStyledString().c_str(), &nHTTPCode, &ptszMsgBuffer, &nMsgLen); printf("AuthClient_Register:\n%s\n", ptszMsgBuffer); BaseLib_OperatorMemory_FreeCStyle((XPPMEM)&ptszMsgBuffer); @@ -138,7 +138,7 @@ int AuthClient_Pay() int nMsgLen = 0; CHAR* ptszMsgBuffer = NULL; - APIHelp_HttpRequest_Custom(_T("POST"), lpszUrl, st_JsonRoot.toStyledString().c_str(), &nHTTPCode, &ptszMsgBuffer, &nMsgLen); + APIClient_Http_Request(_T("POST"), lpszUrl, st_JsonRoot.toStyledString().c_str(), &nHTTPCode, &ptszMsgBuffer, &nMsgLen); printf("AuthClient_Pay:\n%s\n", ptszMsgBuffer); BaseLib_OperatorMemory_FreeCStyle((XPPMEM)&ptszMsgBuffer); @@ -213,7 +213,7 @@ int AuthClient_GetPass() int nMsgLen = 0; CHAR* ptszMsgBuffer = NULL; - APIHelp_HttpRequest_Custom(_T("POST"), lpszUrl, st_JsonRoot.toStyledString().c_str(), &nHTTPCode, &ptszMsgBuffer, &nMsgLen); + APIClient_Http_Request(_T("POST"), lpszUrl, st_JsonRoot.toStyledString().c_str(), &nHTTPCode, &ptszMsgBuffer, &nMsgLen); printf("AuthClient_GetPass:\n%s\n", ptszMsgBuffer); BaseLib_OperatorMemory_FreeCStyle((XPPMEM)&ptszMsgBuffer); @@ -232,7 +232,7 @@ int AuthClient_GetTime() int nMsgLen = 0; CHAR* ptszMsgBuffer = NULL; - APIHelp_HttpRequest_Custom(_T("POST"), lpszUrl, st_JsonRoot.toStyledString().c_str(), &nHTTPCode, &ptszMsgBuffer, &nMsgLen); + APIClient_Http_Request(_T("POST"), lpszUrl, st_JsonRoot.toStyledString().c_str(), &nHTTPCode, &ptszMsgBuffer, &nMsgLen); printf("AuthClient_GetTime:\n%s\n", ptszMsgBuffer); BaseLib_OperatorMemory_FreeCStyle((XPPMEM)&ptszMsgBuffer); @@ -255,7 +255,7 @@ int AuthClient_Delete() int nMsgLen = 0; CHAR* ptszMsgBuffer = NULL; - APIHelp_HttpRequest_Custom(_T("POST"), lpszUrl, st_JsonRoot.toStyledString().c_str(), &nHTTPCode, &ptszMsgBuffer, &nMsgLen); + APIClient_Http_Request(_T("POST"), lpszUrl, st_JsonRoot.toStyledString().c_str(), &nHTTPCode, &ptszMsgBuffer, &nMsgLen); printf("AuthClient_Delete:\n%s\n", ptszMsgBuffer); BaseLib_OperatorMemory_FreeCStyle((XPPMEM)&ptszMsgBuffer); @@ -274,7 +274,7 @@ int AuthClient_Try() int nMsgLen = 0; CHAR* ptszMsgBuffer = NULL; - APIHelp_HttpRequest_Custom(_T("POST"), lpszUrl, st_JsonRoot.toStyledString().c_str(), &nHTTPCode, &ptszMsgBuffer, &nMsgLen); + APIClient_Http_Request(_T("POST"), lpszUrl, st_JsonRoot.toStyledString().c_str(), &nHTTPCode, &ptszMsgBuffer, &nMsgLen); printf("AuthClient_Try:\n%s\n", ptszMsgBuffer); BaseLib_OperatorMemory_FreeCStyle((XPPMEM)&ptszMsgBuffer); diff --git a/XEngine_Apps/Authorize_APPLocal/Authorize_APPLocal.cpp b/XEngine_Apps/Authorize_APPLocal/Authorize_APPLocal.cpp new file mode 100644 index 0000000000000000000000000000000000000000..9543430c7c3c26d219ae97cb8a1231fa2a7dfbb2 --- /dev/null +++ b/XEngine_Apps/Authorize_APPLocal/Authorize_APPLocal.cpp @@ -0,0 +1,110 @@ +#ifdef _MSC_BUILD +#include +#include +#pragma comment(lib,"Ws2_32") +#pragma comment(lib,"jsoncpp") +#pragma comment(lib,"XEngine_BaseLib/XEngine_BaseLib") +#pragma comment(lib,"XEngine_Core/XEngine_OPenSsl") +#pragma comment(lib,"XEngine_NetHelp/NetHelp_APIClient") +#pragma comment(lib,"XEngine_HelpComponents/HelpComponents_Authorize") +#endif +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +//需要优先配置XEngine +//WINDOWS支持VS2022 x64 debug 编译调试 +//linux::g++ -std=c++17 -Wall -g Authorize_APPLocal.cpp -o Authorize_APPLocal.exe -L /usr/local/lib/XEngine_Release/XEngine_BaseLib -L /usr/local/lib/XEngine_Release/XEngine_Core -L /usr/local/lib/XEngine_Release/XEngine_NetHelp -L /usr/local/lib/XEngine_Release/XEngine_HelpComponents -lXEngine_BaseLib -lXEngine_OPenSsl -lNetHelp_APIClient -lHelpComponents_Authorize +//macos::g++ -std=c++17 -Wall -g Authorize_APPLocal.cpp -o Authorize_APPLocal.exe -lXEngine_BaseLib -lXEngine_OPenSsl -lNetHelp_APIClient -lHelpComponents_Authorize + +int main() +{ +#ifdef _MSC_BUILD + WSADATA st_WSAData; + WSAStartup(MAKEWORD(2, 2), &st_WSAData); +#endif + int nLen = 0; + int nCode = 0; + LPCTSTR lpszCreateUrl = _T("http://127.0.0.1:5302/auth/cdkey/create"); + + Json::Value st_JsonRoot; + Json::Value st_JsonAPPInfo; + Json::Value st_JsonREGInfo; + Json::Value st_JsonUserInfo; + st_JsonRoot["tszAddr"] = "http://app.xyry.org"; + st_JsonRoot["nPort"] = 5501; + + st_JsonAPPInfo["tszAppName"] = "XEngine"; + st_JsonAPPInfo["tszAppVer"] = "1.0.0.1001"; + + st_JsonREGInfo["tszHardware"] = "5501012NE21N"; + st_JsonREGInfo["enSerialType"] = ENUM_HELPCOMPONENTS_AUTHORIZE_SERIAL_TYPE_TIME; + st_JsonREGInfo["enRegType"] = ENUM_HELPCOMPONENTS_AUTHORIZE_REG_TYPE_TRY; + st_JsonREGInfo["enHWType"] = ENUM_HELPCOMPONENTS_AUTHORIZE_HW_TYPE_CPU; + + st_JsonUserInfo["tszUserName"] = "qyt"; + st_JsonUserInfo["tszUserContact"] = "486179@qq.com"; + + st_JsonRoot["st_AuthAppInfo"] = st_JsonAPPInfo; + st_JsonRoot["st_AuthRegInfo"] = st_JsonREGInfo; + st_JsonRoot["st_AuthUserInfo"] = st_JsonUserInfo; + + TCHAR* ptszCreateBuffer = NULL; + TCHAR* ptszAuthBuffer = NULL; + if (!APIClient_Http_Request(_T("POST"), lpszCreateUrl, st_JsonRoot.toStyledString().c_str(), &nCode, &ptszCreateBuffer, &nLen)) + { + printf("发送投递失败!\n"); + return 0; + } + printf("接受到数据,大小:%d,内容:%s\n", nLen, ptszCreateBuffer); + + TCHAR tszMsgBuffer[4096]; + memset(tszMsgBuffer, '\0', sizeof(tszMsgBuffer)); + //你也可以通过授权模块的API函数来读内存,都一回事,这里为了方便直接写了,请求分钟卡,拥有10分钟,也可以写自定义时间格式 + BaseLib_OperatorFile_WriteProfileFromMemory(ptszCreateBuffer, nLen, "AuthReg", "tszLeftTime", "10", tszMsgBuffer, &nLen); + BaseLib_OperatorMemory_FreeCStyle((XPPMEM)&ptszCreateBuffer); + + LPCTSTR lpszAuthUrl = _T("http://127.0.0.1:5302/auth/cdkey/auth?pass=123123"); + if (!APIClient_Http_Request(_T("POST"), lpszAuthUrl, tszMsgBuffer, &nCode, &ptszAuthBuffer, &nLen)) + { + printf("发送投递失败!\n"); + return 0; + } + //ptszAuthBuffer 写文件,然后验证即可.如下所示 + //step 1.解密 + CHAR tszCodecBuffer[4096]; + memset(tszCodecBuffer, '\0', sizeof(tszCodecBuffer)); + OPenSsl_XCrypto_Decoder(ptszAuthBuffer, &nLen, tszCodecBuffer, "123123"); + BaseLib_OperatorMemory_FreeCStyle((XPPMEM)&ptszAuthBuffer); + printf("接受到数据,大小:%d,内容:\n%s\n", nLen, tszCodecBuffer); + //step 2.转换格式 + XENGINE_AUTHORIZE_LOCAL st_Authorize; + memset(&st_Authorize, '\0', sizeof(XENGINE_AUTHORIZE_LOCAL)); + + Authorize_Local_ReadMemory(tszCodecBuffer, nLen, &st_Authorize); + //step 3.判断您是否超时 + if (Authorize_Local_GetLeftTimer(&st_Authorize)) + { + printf("ok\n"); + } + else + { + printf("timeout\n"); + } +#ifdef _MSC_BUILD + WSACleanup(); +#endif + return 0; +} \ No newline at end of file diff --git a/XEngine_Apps/Authorize_APPLocal/Authorize_APPLocal.vcxproj b/XEngine_Apps/Authorize_APPLocal/Authorize_APPLocal.vcxproj new file mode 100644 index 0000000000000000000000000000000000000000..56933eb2b136b93f62b621e4eeaf62b3b80347d4 --- /dev/null +++ b/XEngine_Apps/Authorize_APPLocal/Authorize_APPLocal.vcxproj @@ -0,0 +1,139 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + Debug + x64 + + + Release + x64 + + + + 16.0 + Win32Proj + {767151f7-230e-431b-ac6d-683f19f43c13} + AuthorizeAPPLocal + 10.0 + + + + Application + true + v143 + MultiByte + + + Application + false + v143 + true + Unicode + + + Application + true + v143 + Unicode + + + Application + false + v143 + true + Unicode + + + + + + + + + + + + + + + + + + + + + $(XEngine_Include);../../XEngine_Source/XEngine_ThirdPart/jsoncpp;$(IncludePath) + $(XEngine_Lib32);../../XEngine_Source/Debug;$(LibraryPath) + + + + Level3 + true + WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + + + Console + true + + + + + Level3 + true + true + true + WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + + + Console + true + true + true + + + + + Level3 + true + _DEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + + + Console + true + + + + + Level3 + true + true + true + NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + + + Console + true + true + true + + + + + + + + + \ No newline at end of file diff --git a/XEngine_Apps/Authorize_APPLocal/Authorize_APPLocal.vcxproj.filters b/XEngine_Apps/Authorize_APPLocal/Authorize_APPLocal.vcxproj.filters new file mode 100644 index 0000000000000000000000000000000000000000..8ab0c7ad3776e31dbd0e7875e21e4c10d31c51fe --- /dev/null +++ b/XEngine_Apps/Authorize_APPLocal/Authorize_APPLocal.vcxproj.filters @@ -0,0 +1,22 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms + + + + + 源文件 + + + \ No newline at end of file diff --git a/XEngine_Apps/Authorize_APPLocal/Authorize_APPLocal.vcxproj.user b/XEngine_Apps/Authorize_APPLocal/Authorize_APPLocal.vcxproj.user new file mode 100644 index 0000000000000000000000000000000000000000..88a550947edbc3c5003a41726f0749201fdb6822 --- /dev/null +++ b/XEngine_Apps/Authorize_APPLocal/Authorize_APPLocal.vcxproj.user @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/XEngine_Apps/VSCopy_x86.bat b/XEngine_Apps/VSCopy_x86.bat index ab7876b2b8d7f5025c15e737b9998ea0428e4516..a3158bc8c14d597ac018e92a26f72c67ac6507fb 100644 --- a/XEngine_Apps/VSCopy_x86.bat +++ b/XEngine_Apps/VSCopy_x86.bat @@ -4,7 +4,7 @@ copy /y "%XEngine_Lib32%\XEngine_Core\XEngine_OPenSsl.dll" "./" copy /y "%XEngine_Lib32%\XEngine_Client\XClient_Socket.dll" "./" -copy /y "%XEngine_Lib32%\XEngine_NetHelp\NetHelp_APIHelp.dll" "./" +copy /y "%XEngine_Lib32%\XEngine_NetHelp\NetHelp_APIClient.dll" "./" copy /y "%XEngine_Lib32%\XEngine_SystemSdk\XEngine_SystemApi.dll" "./" copy /y "%XEngine_Lib32%\XEngine_HelpComponents\zlib1.dll" "./" diff --git a/XEngine_Docment/Docment_en.docx b/XEngine_Docment/Docment_en.docx index 5ccb1b127c1fd397759a0bbf816ec95084861c32..d1f2905e85dc2cf2dde04c2db5c6a48b9036e44d 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 0055345ead644a7e381d11dc32a934c473e972c9..849b8481e87d7f01f8b46705958c87d742576a7a 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 23dfa8080998ae70c1932acf06368e287e14becd..e7cd54bf3a24aae53806087462c3d4919cfef084 100644 --- a/XEngine_Release/XEngine_Config/XEngine_Config.json +++ b/XEngine_Release/XEngine_Config/XEngine_Config.json @@ -45,6 +45,7 @@ "LogLeave":32 }, "XVer":[ + "V3.5.0.1001 Build20230203", "V3.4.0.1001 Build20221230", "V3.3.0.1001 Build20221101", "V3.2.0.1001 Build20220923", diff --git a/XEngine_Release/XEngine_DataBase/SQL_User.db b/XEngine_Release/XEngine_DataBase/SQL_User.db index fb3d51a5b3cfc7e77a2b5f2a6f860858507c63b9..244d4aaf9dd2324bb244ff32a067af806c4526f6 100644 Binary files a/XEngine_Release/XEngine_DataBase/SQL_User.db and b/XEngine_Release/XEngine_DataBase/SQL_User.db differ diff --git a/XEngine_Source/AuthorizeModule_Database/AuthorizeModule_Database.def b/XEngine_Source/AuthorizeModule_Database/AuthorizeModule_Database.def index f24c916a78e52e6ac9ad0ee343d3a10a9e3ef1db..6ccd03f916317f55ce9e210f3f981f1e11740999 100644 --- a/XEngine_Source/AuthorizeModule_Database/AuthorizeModule_Database.def +++ b/XEngine_Source/AuthorizeModule_Database/AuthorizeModule_Database.def @@ -5,6 +5,7 @@ EXPORTS Database_SQLite_Init Database_SQLite_Destroy + Database_SQLite_UserDelete Database_SQLite_UserRegister Database_SQLite_UserQuery @@ -12,17 +13,21 @@ EXPORTS Database_SQLite_UserLeave Database_SQLite_UserSet Database_SQLite_UserList + Database_SQLite_SerialInsert Database_SQLite_SerialDelete Database_SQLite_SerialQuery Database_SQLite_SerialQueryAll Database_SQLite_SerialPush + Database_SQLite_TryInsert Database_SQLite_TryQuery Database_SQLite_TryDelete Database_SQLite_TryClear Database_SQLite_TrySet + Database_SQLite_BannedInsert Database_SQLite_BannedDelete Database_SQLite_BannedList - Database_SQLite_BannedExist \ No newline at end of file + Database_SQLite_BannedExist + Database_SQLite_BannedUPDate \ No newline at end of file diff --git a/XEngine_Source/AuthorizeModule_Database/Database_Define.h b/XEngine_Source/AuthorizeModule_Database/Database_Define.h index 79973e6445c85194029cf9e18b66b95052e88349..bbdd41faaf254bc86420d1357b03e46b2d5bb7e6 100644 --- a/XEngine_Source/AuthorizeModule_Database/Database_Define.h +++ b/XEngine_Source/AuthorizeModule_Database/Database_Define.h @@ -403,4 +403,18 @@ extern "C" BOOL Database_SQLite_BannedList(AUTHREG_BANNED*** pppSt_BannedUser, i 意思:是否成功 备注: *********************************************************************/ -extern "C" BOOL Database_SQLite_BannedExist(AUTHREG_BANNED* pSt_Banned); \ No newline at end of file +extern "C" BOOL Database_SQLite_BannedExist(AUTHREG_BANNED* pSt_Banned); +/******************************************************************** +函数名称:Database_SQLite_BannedUPDate +函数功能:更新名单列表信息 + 参数.一:pSt_Banned + In/Out:In + 类型:数据结构指针 + 可空:N + 意思:要操作的数据 +返回值 + 类型:逻辑型 + 意思:是否成功 +备注: +*********************************************************************/ +extern "C" BOOL Database_SQLite_BannedUPDate(AUTHREG_BANNED* pSt_Banned); \ No newline at end of file diff --git a/XEngine_Source/AuthorizeModule_Database/Database_Error.h b/XEngine_Source/AuthorizeModule_Database/Database_Error.h index 8dd1e1f30b2a9a73252cc70136bd17a6825b3bcc..def1314d4006c51f3d4b139d7aa88c0a63e00d79 100644 --- a/XEngine_Source/AuthorizeModule_Database/Database_Error.h +++ b/XEngine_Source/AuthorizeModule_Database/Database_Error.h @@ -33,4 +33,6 @@ #define ERROR_AUTHORIZE_MODULE_DATABASE_GETTIME 0x0030015 //获取时间结构失败 #define ERROR_AUTHORIZE_MODULE_DATABASE_UPDATA 0x0030016 //更新数据库失败 #define ERROR_AUTHORIZE_MODULE_DATABASE_UNKNOWTYPE 0x0030017 //无法识别的卡的类型,无法正确处理离开消息 -#define ERROR_AUTHORIZE_MODULE_DATABASE_NONE 0x0030018 //获取失败,没有任何记录 \ No newline at end of file +#define ERROR_AUTHORIZE_MODULE_DATABASE_NONE 0x0030018 //获取失败,没有任何记录 +#define ERROR_AUTHORIZE_MODULE_DATABASE_NOTENABLE 0x0030019 //没有启用.不禁用 +#define ERROR_AUTHORIZE_MODULE_DATABASE_TIMELEFT 0x0030020 //超过禁用时间 \ No newline at end of file diff --git a/XEngine_Source/AuthorizeModule_Database/Database_SQLite/Database_SQLite.cpp b/XEngine_Source/AuthorizeModule_Database/Database_SQLite/Database_SQLite.cpp index e26e0484f7adef1cd5fd2f47e3e7df3c04f37c1b..6c09b944820725c1d67e1ac67b1ccff6b956f1ff 100644 --- a/XEngine_Source/AuthorizeModule_Database/Database_SQLite/Database_SQLite.cpp +++ b/XEngine_Source/AuthorizeModule_Database/Database_SQLite/Database_SQLite.cpp @@ -45,7 +45,7 @@ BOOL CDatabase_SQLite::Database_SQLite_Init(LPCTSTR lpszSQLFile, BOOL bIsChange SQLPacket_IsErrorOccur = FALSE; m_bChange = bIsChange; //打开数据库 - if (!DataBase_SQLite_Open(&xhData,lpszSQLFile)) + if (!DataBase_SQLite_Open(&xhData, lpszSQLFile)) { SQLPacket_IsErrorOccur = TRUE; SQLPacket_dwErrorCode = DataBase_GetLastError(); @@ -90,10 +90,10 @@ BOOL CDatabase_SQLite::Database_SQLite_UserDelete(LPCTSTR lpszUserName) { SQLPacket_IsErrorOccur = FALSE; TCHAR tszSQLStatement[1024]; //SQL语句 - memset(tszSQLStatement,'\0',1024); - _stprintf_s(tszSQLStatement,_T("delete from Authorize_User where UserName = '%s'"),lpszUserName); + memset(tszSQLStatement, '\0', 1024); + _stprintf_s(tszSQLStatement, _T("delete from Authorize_User where UserName = '%s'"), lpszUserName); //执行 - if (!DataBase_SQLite_Exec(xhData,tszSQLStatement)) + if (!DataBase_SQLite_Exec(xhData, tszSQLStatement)) { SQLPacket_IsErrorOccur = TRUE; SQLPacket_dwErrorCode = ERROR_AUTHORIZE_MODULE_DATABASE_EXEC; @@ -118,7 +118,7 @@ BOOL CDatabase_SQLite::Database_SQLite_UserRegister(AUTHREG_USERTABLE* pSt_UserI { SQLPacket_IsErrorOccur = FALSE; TCHAR tszSQLStatement[1024]; //SQL语句 - memset(tszSQLStatement,'\0',1024); + memset(tszSQLStatement, '\0', 1024); if (Database_SQLite_UserQuery(pSt_UserInfo->st_UserInfo.tszUserName)) { @@ -157,13 +157,13 @@ BOOL CDatabase_SQLite::Database_SQLite_UserQuery(LPCTSTR lpszUserName, AUTHREG_U { SQLPacket_IsErrorOccur = FALSE; TCHAR tszSQLStatement[1024]; //SQL语句 - char **ppszResult = NULL; + char** ppszResult = NULL; int nRow = 0; int nColumn = 0; - memset(tszSQLStatement,'\0',1024); + memset(tszSQLStatement, '\0', 1024); - _stprintf_s(tszSQLStatement,_T("select * from Authorize_User where UserName = '%s'"),lpszUserName); - if (!DataBase_SQLite_GetTable(xhData,tszSQLStatement,&ppszResult,&nRow,&nColumn)) + _stprintf_s(tszSQLStatement, _T("select * from Authorize_User where UserName = '%s'"), lpszUserName); + if (!DataBase_SQLite_GetTable(xhData, tszSQLStatement, &ppszResult, &nRow, &nColumn)) { SQLPacket_IsErrorOccur = TRUE; SQLPacket_dwErrorCode = ERROR_AUTHORIZE_MODULE_DATABASE_GETTABLE; @@ -205,12 +205,12 @@ BOOL CDatabase_SQLite::Database_SQLite_UserQuery(LPCTSTR lpszUserName, AUTHREG_U //身份证ID nFliedValue++; pSt_UserInfo->st_UserInfo.nIDNumber = _tcstoi64(ppszResult[nFliedValue], NULL, 10); - //用户级别 -1表示封禁 - nFliedValue++; - pSt_UserInfo->st_UserInfo.nUserLevel = _ttoi(ppszResult[nFliedValue]); - //注册日期 - nFliedValue++; - _tcscpy(pSt_UserInfo->st_UserInfo.tszCreateTime, ppszResult[nFliedValue]); + //用户级别 -1表示封禁 + nFliedValue++; + pSt_UserInfo->st_UserInfo.nUserLevel = _ttoi(ppszResult[nFliedValue]); + //注册日期 + nFliedValue++; + _tcscpy(pSt_UserInfo->st_UserInfo.tszCreateTime, ppszResult[nFliedValue]); } DataBase_SQLite_FreeTable(ppszResult); @@ -234,7 +234,7 @@ BOOL CDatabase_SQLite::Database_SQLite_UserQuery(LPCTSTR lpszUserName, AUTHREG_U 意思:是否成功充值 备注: *********************************************************************/ -BOOL CDatabase_SQLite::Database_SQLite_UserPay(LPCTSTR lpszUserName,LPCTSTR lpszSerialName) +BOOL CDatabase_SQLite::Database_SQLite_UserPay(LPCTSTR lpszUserName, LPCTSTR lpszSerialName) { SQLPacket_IsErrorOccur = FALSE; @@ -242,9 +242,9 @@ BOOL CDatabase_SQLite::Database_SQLite_UserPay(LPCTSTR lpszUserName,LPCTSTR lpsz AUTHREG_USERTABLE st_UserTable; TCHAR tszSQLStatement[1024]; //SQL语句 - memset(tszSQLStatement,'\0',1024); - memset(&st_SerialTable,'\0',sizeof(st_SerialTable)); - memset(&st_UserTable,'\0',sizeof(st_UserTable)); + memset(tszSQLStatement, '\0', 1024); + memset(&st_SerialTable, '\0', sizeof(st_SerialTable)); + memset(&st_UserTable, '\0', sizeof(st_UserTable)); //参数检查 if ((NULL == lpszUserName) || (NULL == lpszSerialName)) { @@ -253,7 +253,7 @@ BOOL CDatabase_SQLite::Database_SQLite_UserPay(LPCTSTR lpszUserName,LPCTSTR lpsz return FALSE; } //查询充值卡是否存在 - if (!Database_SQLite_SerialQuery(lpszSerialName,&st_SerialTable)) + if (!Database_SQLite_SerialQuery(lpszSerialName, &st_SerialTable)) { return FALSE; } @@ -265,7 +265,7 @@ BOOL CDatabase_SQLite::Database_SQLite_UserPay(LPCTSTR lpszUserName,LPCTSTR lpsz return FALSE; } //查询用户信息 - if (!Database_SQLite_UserQuery(lpszUserName,&st_UserTable)) + if (!Database_SQLite_UserQuery(lpszUserName, &st_UserTable)) { return FALSE; } @@ -427,67 +427,67 @@ BOOL CDatabase_SQLite::Database_SQLite_UserSet(AUTHREG_USERTABLE* pSt_UserTable) *********************************************************************/ BOOL CDatabase_SQLite::Database_SQLite_UserList(AUTHREG_USERTABLE*** pppSt_UserInfo, int* pInt_ListCount, int nPosStart, int nPosEnd) { - SQLPacket_IsErrorOccur = FALSE; + SQLPacket_IsErrorOccur = FALSE; - int nRow = 0; - int nColumn = 0; + int nRow = 0; + int nColumn = 0; char** ppszResult = NULL; TCHAR tszSQLStatement[1024]; //SQL语句 - memset(tszSQLStatement, '\0', 1024); + memset(tszSQLStatement, '\0', 1024); _stprintf_s(tszSQLStatement, _T("SELECT * FROM Authorize_User LIMIT %d,%d"), nPosStart, nPosEnd - nPosStart); - if (!DataBase_SQLite_GetTable(xhData, tszSQLStatement, &ppszResult, &nRow, &nColumn)) - { - SQLPacket_IsErrorOccur = TRUE; - SQLPacket_dwErrorCode = ERROR_AUTHORIZE_MODULE_DATABASE_GETTABLE; - return FALSE; - } - if ((0 == nRow) || (0 == nColumn)) - { - SQLPacket_IsErrorOccur = TRUE; - SQLPacket_dwErrorCode = ERROR_AUTHORIZE_MODULE_DATABASE_NOTUSER; - return FALSE; - } + if (!DataBase_SQLite_GetTable(xhData, tszSQLStatement, &ppszResult, &nRow, &nColumn)) + { + SQLPacket_IsErrorOccur = TRUE; + SQLPacket_dwErrorCode = ERROR_AUTHORIZE_MODULE_DATABASE_GETTABLE; + return FALSE; + } + if ((0 == nRow) || (0 == nColumn)) + { + SQLPacket_IsErrorOccur = TRUE; + SQLPacket_dwErrorCode = ERROR_AUTHORIZE_MODULE_DATABASE_NOTUSER; + return FALSE; + } *pInt_ListCount = nRow; BaseLib_OperatorMemory_Malloc((XPPPMEM)pppSt_UserInfo, nRow, sizeof(AUTHREG_USERTABLE)); - //ID - int nFliedValue = nColumn; + //ID + int nFliedValue = nColumn; for (int i = 0; i < nRow; i++) { nFliedValue++; //ID //用户名 _tcscpy((*pppSt_UserInfo)[i]->st_UserInfo.tszUserName, ppszResult[nFliedValue]); - //密码 - nFliedValue++; - _tcscpy((*pppSt_UserInfo)[i]->st_UserInfo.tszUserPass, ppszResult[nFliedValue]); - //过期时间 - nFliedValue++; - _tcscpy((*pppSt_UserInfo)[i]->tszLeftTime, ppszResult[nFliedValue]); - //电子邮件 - nFliedValue++; - _tcscpy((*pppSt_UserInfo)[i]->st_UserInfo.tszEMailAddr, ppszResult[nFliedValue]); - //硬件码 - nFliedValue++; - _tcscpy((*pppSt_UserInfo)[i]->tszHardCode, ppszResult[nFliedValue]); - //充值卡类型 - nFliedValue++; + //密码 + nFliedValue++; + _tcscpy((*pppSt_UserInfo)[i]->st_UserInfo.tszUserPass, ppszResult[nFliedValue]); + //过期时间 + nFliedValue++; + _tcscpy((*pppSt_UserInfo)[i]->tszLeftTime, ppszResult[nFliedValue]); + //电子邮件 + nFliedValue++; + _tcscpy((*pppSt_UserInfo)[i]->st_UserInfo.tszEMailAddr, ppszResult[nFliedValue]); + //硬件码 + nFliedValue++; + _tcscpy((*pppSt_UserInfo)[i]->tszHardCode, ppszResult[nFliedValue]); + //充值卡类型 + nFliedValue++; (*pppSt_UserInfo)[i]->enSerialType = (ENUM_HELPCOMPONENTS_AUTHORIZE_SERIAL_TYPE)_ttoi(ppszResult[nFliedValue]); - //QQ号 - nFliedValue++; + //QQ号 + nFliedValue++; (*pppSt_UserInfo)[i]->st_UserInfo.nPhoneNumber = _tcstoi64(ppszResult[nFliedValue], NULL, 10); - //身份证ID - nFliedValue++; + //身份证ID + nFliedValue++; (*pppSt_UserInfo)[i]->st_UserInfo.nIDNumber = _tcstoi64(ppszResult[nFliedValue], NULL, 10); - //用户级别 -1表示封禁 - nFliedValue++; + //用户级别 -1表示封禁 + nFliedValue++; (*pppSt_UserInfo)[i]->st_UserInfo.nUserLevel = _ttoi(ppszResult[nFliedValue]); - //注册日期 - nFliedValue++; - _tcscpy((*pppSt_UserInfo)[i]->st_UserInfo.tszCreateTime, ppszResult[nFliedValue]); + //注册日期 + nFliedValue++; + _tcscpy((*pppSt_UserInfo)[i]->st_UserInfo.tszCreateTime, ppszResult[nFliedValue]); nFliedValue++; } - DataBase_SQLite_FreeTable(ppszResult); - return TRUE; + DataBase_SQLite_FreeTable(ppszResult); + return TRUE; } /******************************************************************** 函数名称:Database_SQLite_SerialInsert @@ -507,7 +507,7 @@ BOOL CDatabase_SQLite::Database_SQLite_SerialInsert(LPCTSTR lpszSerialNumber) SQLPacket_IsErrorOccur = FALSE; TCHAR tszSQLStatement[1024]; //SQL语句 - memset(tszSQLStatement,'\0',1024); + memset(tszSQLStatement, '\0', 1024); if (Database_SQLite_SerialQuery(lpszSerialNumber)) { @@ -517,7 +517,7 @@ BOOL CDatabase_SQLite::Database_SQLite_SerialInsert(LPCTSTR lpszSerialNumber) } ENUM_HELPCOMPONENTS_AUTHORIZE_SERIAL_TYPE enAuthSerialType; XENGINE_LIBTIMER st_AuthTimer; - memset(&st_AuthTimer,'\0',sizeof(st_AuthTimer)); + memset(&st_AuthTimer, '\0', sizeof(st_AuthTimer)); if (!Authorize_Serial_GetType(lpszSerialNumber, &enAuthSerialType, &st_AuthTimer)) { @@ -547,7 +547,7 @@ BOOL CDatabase_SQLite::Database_SQLite_SerialInsert(LPCTSTR lpszSerialNumber) _stprintf_s(tszSQLStatement, _T("INSERT INTO Authorize_Serial values(NULL,'NOT','%s',0,'%d',0,datetime('now', 'localtime'))"), lpszSerialNumber, enAuthSerialType); } - if (!DataBase_SQLite_Exec(xhData,tszSQLStatement)) + if (!DataBase_SQLite_Exec(xhData, tszSQLStatement)) { SQLPacket_IsErrorOccur = TRUE; SQLPacket_dwErrorCode = ERROR_AUTHORIZE_MODULE_DATABASE_ISFAILED; @@ -573,10 +573,10 @@ BOOL CDatabase_SQLite::Database_SQLite_SerialDelete(LPCTSTR lpszSerialNumber) SQLPacket_IsErrorOccur = FALSE; TCHAR tszSQLStatement[1024]; //SQL语句 - memset(tszSQLStatement,'\0',1024); - _stprintf_s(tszSQLStatement,_T("delete from Authorize_Serial where SerialNumber = '%s'"),lpszSerialNumber); + memset(tszSQLStatement, '\0', 1024); + _stprintf_s(tszSQLStatement, _T("delete from Authorize_Serial where SerialNumber = '%s'"), lpszSerialNumber); //执行 - if (!DataBase_SQLite_Exec(xhData,tszSQLStatement)) + if (!DataBase_SQLite_Exec(xhData, tszSQLStatement)) { SQLPacket_IsErrorOccur = TRUE; SQLPacket_dwErrorCode = ERROR_AUTHORIZE_MODULE_DATABASE_ISFAILED; @@ -602,17 +602,17 @@ BOOL CDatabase_SQLite::Database_SQLite_SerialDelete(LPCTSTR lpszSerialNumber) 意思:是否查询成功,如果第二个参数为NULL,那么将只返回是否有这个序列号 备注: *********************************************************************/ -BOOL CDatabase_SQLite::Database_SQLite_SerialQuery(LPCTSTR lpszSerialNumber,LPAUTHREG_SERIALTABLE pSt_SerialTable /* = NULL */) +BOOL CDatabase_SQLite::Database_SQLite_SerialQuery(LPCTSTR lpszSerialNumber, LPAUTHREG_SERIALTABLE pSt_SerialTable /* = NULL */) { SQLPacket_IsErrorOccur = FALSE; TCHAR tszSQLStatement[1024]; //SQL语句 - char **ppszResult = NULL; + char** ppszResult = NULL; int nRow = 0; int nColumn = 0; - memset(tszSQLStatement,'\0',1024); + memset(tszSQLStatement, '\0', 1024); - _stprintf_s(tszSQLStatement,_T("select * from Authorize_Serial where SerialNumber = '%s'"),lpszSerialNumber); - if (!DataBase_SQLite_GetTable(xhData,tszSQLStatement,&ppszResult,&nRow,&nColumn)) + _stprintf_s(tszSQLStatement, _T("select * from Authorize_Serial where SerialNumber = '%s'"), lpszSerialNumber); + if (!DataBase_SQLite_GetTable(xhData, tszSQLStatement, &ppszResult, &nRow, &nColumn)) { SQLPacket_IsErrorOccur = TRUE; SQLPacket_dwErrorCode = ERROR_AUTHORIZE_MODULE_DATABASE_GETTABLE; @@ -631,22 +631,22 @@ BOOL CDatabase_SQLite::Database_SQLite_SerialQuery(LPCTSTR lpszSerialNumber,LPAU int nFliedValue = nColumn; //使用者 nFliedValue++; - _tcscpy(pSt_SerialTable->tszUserName,ppszResult[nFliedValue]); + _tcscpy(pSt_SerialTable->tszUserName, ppszResult[nFliedValue]); //序列号 nFliedValue++; - _tcscpy(pSt_SerialTable->tszSerialNumber,ppszResult[nFliedValue]); + _tcscpy(pSt_SerialTable->tszSerialNumber, ppszResult[nFliedValue]); //超时时间 nFliedValue++; - _tcscpy(pSt_SerialTable->tszMaxTime,ppszResult[nFliedValue]); + _tcscpy(pSt_SerialTable->tszMaxTime, ppszResult[nFliedValue]); //序列卡类型 nFliedValue++; pSt_SerialTable->enSerialType = (ENUM_HELPCOMPONENTS_AUTHORIZE_SERIAL_TYPE)_ttoi(ppszResult[nFliedValue]); //是否已经使用 nFliedValue++; pSt_SerialTable->bIsUsed = _ttoi(ppszResult[nFliedValue]); - //超时时间 - nFliedValue++; - _tcscpy(pSt_SerialTable->tszCreateTime, ppszResult[nFliedValue]); + //超时时间 + nFliedValue++; + _tcscpy(pSt_SerialTable->tszCreateTime, ppszResult[nFliedValue]); } DataBase_SQLite_FreeTable(ppszResult); @@ -683,16 +683,16 @@ BOOL CDatabase_SQLite::Database_SQLite_SerialQuery(LPCTSTR lpszSerialNumber,LPAU BOOL CDatabase_SQLite::Database_SQLite_SerialQueryAll(AUTHREG_SERIALTABLE*** pppSt_SerialTable, int* pInt_ListCount, int nPosStart, int nPosEnd) { SQLPacket_IsErrorOccur = FALSE; - - int nRow = 0; - int nColumn = 0; + + int nRow = 0; + int nColumn = 0; char** ppszResult = NULL; TCHAR tszSQLStatement[1024]; //SQL语句 - - memset(tszSQLStatement,'\0',1024); - + + memset(tszSQLStatement, '\0', 1024); + _stprintf_s(tszSQLStatement, _T("SELECT * FROM Authorize_Serial LIMIT %d,%d"), nPosStart, nPosEnd - nPosStart); - if (!DataBase_SQLite_GetTable(xhData,tszSQLStatement,&ppszResult,&nRow,&nColumn)) + if (!DataBase_SQLite_GetTable(xhData, tszSQLStatement, &ppszResult, &nRow, &nColumn)) { SQLPacket_IsErrorOccur = TRUE; SQLPacket_dwErrorCode = ERROR_AUTHORIZE_MODULE_DATABASE_GETTABLE; @@ -708,18 +708,18 @@ BOOL CDatabase_SQLite::Database_SQLite_SerialQueryAll(AUTHREG_SERIALTABLE*** ppp *pInt_ListCount = nRow; int nFliedValue = nColumn; - for (int i = 0;i < nRow;i++) + for (int i = 0; i < nRow; i++) { //ID nFliedValue++; //使用者 - _tcscpy((*pppSt_SerialTable)[i]->tszUserName,ppszResult[nFliedValue]); + _tcscpy((*pppSt_SerialTable)[i]->tszUserName, ppszResult[nFliedValue]); nFliedValue++; //序列号 - _tcscpy((*pppSt_SerialTable)[i]->tszSerialNumber,ppszResult[nFliedValue]); + _tcscpy((*pppSt_SerialTable)[i]->tszSerialNumber, ppszResult[nFliedValue]); nFliedValue++; //超时时间 - _tcscpy((*pppSt_SerialTable)[i]->tszMaxTime,ppszResult[nFliedValue]); + _tcscpy((*pppSt_SerialTable)[i]->tszMaxTime, ppszResult[nFliedValue]); nFliedValue++; //序列卡类型 (*pppSt_SerialTable)[i]->enSerialType = (ENUM_HELPCOMPONENTS_AUTHORIZE_SERIAL_TYPE)_ttoi(ppszResult[nFliedValue]); @@ -727,9 +727,9 @@ BOOL CDatabase_SQLite::Database_SQLite_SerialQueryAll(AUTHREG_SERIALTABLE*** ppp //是否已经使用 (*pppSt_SerialTable)[i]->bIsUsed = _ttoi(ppszResult[nFliedValue]); nFliedValue++; - //创建时间 + //创建时间 _tcscpy((*pppSt_SerialTable)[i]->tszCreateTime, ppszResult[nFliedValue]); - nFliedValue++; + nFliedValue++; } DataBase_SQLite_FreeTable(ppszResult); return TRUE; @@ -749,26 +749,26 @@ BOOL CDatabase_SQLite::Database_SQLite_SerialQueryAll(AUTHREG_SERIALTABLE*** ppp *********************************************************************/ BOOL CDatabase_SQLite::Database_SQLite_SerialPush(AUTHREG_SERIALTABLE* pSt_SerialTable) { - SQLPacket_IsErrorOccur = FALSE; + SQLPacket_IsErrorOccur = FALSE; - TCHAR tszSQLStatement[1024]; //SQL语句 - memset(tszSQLStatement, '\0', 1024); + TCHAR tszSQLStatement[1024]; //SQL语句 + memset(tszSQLStatement, '\0', 1024); - if (Database_SQLite_SerialQuery(pSt_SerialTable->tszSerialNumber)) - { - SQLPacket_IsErrorOccur = TRUE; - SQLPacket_dwErrorCode = ERROR_AUTHORIZE_MODULE_DATABASE_EXIST; - return FALSE; - } + if (Database_SQLite_SerialQuery(pSt_SerialTable->tszSerialNumber)) + { + SQLPacket_IsErrorOccur = TRUE; + SQLPacket_dwErrorCode = ERROR_AUTHORIZE_MODULE_DATABASE_EXIST; + return FALSE; + } _stprintf_s(tszSQLStatement, _T("INSERT INTO Authorize_Serial values(NULL,'%s','%s','%s',%d,%d,'%s')"), pSt_SerialTable->tszUserName, pSt_SerialTable->tszSerialNumber, pSt_SerialTable->tszMaxTime, pSt_SerialTable->enSerialType, pSt_SerialTable->bIsUsed, pSt_SerialTable->tszCreateTime); - if (!DataBase_SQLite_Exec(xhData, tszSQLStatement)) - { - SQLPacket_IsErrorOccur = TRUE; - SQLPacket_dwErrorCode = ERROR_AUTHORIZE_MODULE_DATABASE_ISFAILED; - return FALSE; - } - return TRUE; + if (!DataBase_SQLite_Exec(xhData, tszSQLStatement)) + { + SQLPacket_IsErrorOccur = TRUE; + SQLPacket_dwErrorCode = ERROR_AUTHORIZE_MODULE_DATABASE_ISFAILED; + return FALSE; + } + return TRUE; } /******************************************************************** 函数名称:Database_SQLite_TryInsert @@ -1056,38 +1056,38 @@ BOOL CDatabase_SQLite::Database_SQLite_TrySet(AUTHREG_NETVER* pSt_AuthVer) *********************************************************************/ BOOL CDatabase_SQLite::Database_SQLite_BannedInsert(AUTHREG_BANNED* pSt_Banned) { - SQLPacket_IsErrorOccur = FALSE; + SQLPacket_IsErrorOccur = FALSE; - if (NULL == pSt_Banned) - { - SQLPacket_IsErrorOccur = TRUE; - SQLPacket_dwErrorCode = ERROR_AUTHORIZE_MODULE_DATABASE_PARAMENT; - return FALSE; - } + if (NULL == pSt_Banned) + { + SQLPacket_IsErrorOccur = TRUE; + SQLPacket_dwErrorCode = ERROR_AUTHORIZE_MODULE_DATABASE_PARAMENT; + return FALSE; + } //存在直接返回 if (Database_SQLite_BannedExist(pSt_Banned)) { return TRUE; } - TCHAR tszSQLStatement[1024]; - memset(tszSQLStatement, '\0', sizeof(tszSQLStatement)); + TCHAR tszSQLStatement[1024]; + memset(tszSQLStatement, '\0', sizeof(tszSQLStatement)); //处理的类型 if (_tcslen(pSt_Banned->tszUserName) > 0) { - _stprintf_s(tszSQLStatement, _T("INSERT INTO Authorize_BannedUser(tszUserName,tszCreateTime) VALUES('%s',datetime('now', 'localtime'))"), pSt_Banned->tszUserName); + _stprintf_s(tszSQLStatement, _T("INSERT INTO Authorize_BannedUser(bEnable,tszUserName,tszLeftTime,tszCreateTime) VALUES(%d,'%s','%s',datetime('now', 'localtime'))"), pSt_Banned->bEnable, pSt_Banned->tszUserName, pSt_Banned->tszLeftTime); } else { - _stprintf_s(tszSQLStatement, _T("INSERT INTO Authorize_BannedAddr(tszIPStart,tszIPEnd,tszCreateTime) VALUES('%s','%s',datetime('now', 'localtime'))"), pSt_Banned->tszIPStart, pSt_Banned->tszIPEnd); + _stprintf_s(tszSQLStatement, _T("INSERT INTO Authorize_BannedAddr(bEnable,tszIPAddr,tszLeftTime,tszCreateTime) VALUES(%d,'%s','%s',datetime('now', 'localtime'))"), pSt_Banned->bEnable, pSt_Banned->tszIPAddr, pSt_Banned->tszLeftTime); } //插入数据库 - if (!DataBase_SQLite_Exec(xhData, tszSQLStatement)) - { - SQLPacket_IsErrorOccur = TRUE; - SQLPacket_dwErrorCode = DataBase_GetLastError(); - return FALSE; - } - return TRUE; + if (!DataBase_SQLite_Exec(xhData, tszSQLStatement)) + { + SQLPacket_IsErrorOccur = TRUE; + SQLPacket_dwErrorCode = DataBase_GetLastError(); + return FALSE; + } + return TRUE; } /******************************************************************** 函数名称:Database_SQLite_BannedDelete @@ -1104,40 +1104,33 @@ BOOL CDatabase_SQLite::Database_SQLite_BannedInsert(AUTHREG_BANNED* pSt_Banned) *********************************************************************/ BOOL CDatabase_SQLite::Database_SQLite_BannedDelete(AUTHREG_BANNED* pSt_Banned) { - SQLPacket_IsErrorOccur = FALSE; + SQLPacket_IsErrorOccur = FALSE; - if (NULL == pSt_Banned) - { - SQLPacket_IsErrorOccur = TRUE; - SQLPacket_dwErrorCode = ERROR_AUTHORIZE_MODULE_DATABASE_PARAMENT; - return FALSE; - } - TCHAR tszSQLStatement[1024]; - memset(tszSQLStatement, '\0', 1024); - //处理的类型 - if (_tcslen(pSt_Banned->tszUserName) > 0) - { + if (NULL == pSt_Banned) + { + SQLPacket_IsErrorOccur = TRUE; + SQLPacket_dwErrorCode = ERROR_AUTHORIZE_MODULE_DATABASE_PARAMENT; + return FALSE; + } + TCHAR tszSQLStatement[1024]; + memset(tszSQLStatement, '\0', 1024); + //处理的类型 + if (_tcslen(pSt_Banned->tszUserName) > 0) + { _stprintf_s(tszSQLStatement, _T("DELETE FROM Authorize_BannedUser WHERE tszUserName = '%s'"), pSt_Banned->tszUserName); - } - else - { - if (_tcslen(pSt_Banned->tszIPEnd) > 0) - { - _stprintf_s(tszSQLStatement, _T("DELETE FROM Authorize_BannedAddr WHERE tszIPStart = '%s' AND tszIPEnd = '%s'"), pSt_Banned->tszIPStart, pSt_Banned->tszIPEnd); - } - else - { - _stprintf_s(tszSQLStatement, _T("DELETE FROM Authorize_BannedAddr WHERE tszIPStart = '%s'"), pSt_Banned->tszIPStart); - } - } - //操作数据库 - if (!DataBase_SQLite_Exec(xhData, tszSQLStatement)) - { - SQLPacket_IsErrorOccur = TRUE; - SQLPacket_dwErrorCode = DataBase_GetLastError(); - return FALSE; - } - return TRUE; + } + else + { + _stprintf_s(tszSQLStatement, _T("DELETE FROM Authorize_BannedAddr WHERE tszIPAddr = '%s'"), pSt_Banned->tszIPAddr); + } + //操作数据库 + if (!DataBase_SQLite_Exec(xhData, tszSQLStatement)) + { + SQLPacket_IsErrorOccur = TRUE; + SQLPacket_dwErrorCode = DataBase_GetLastError(); + return FALSE; + } + return TRUE; } /******************************************************************** 函数名称:Database_SQLite_BannedList @@ -1169,102 +1162,114 @@ BOOL CDatabase_SQLite::Database_SQLite_BannedDelete(AUTHREG_BANNED* pSt_Banned) *********************************************************************/ BOOL CDatabase_SQLite::Database_SQLite_BannedList(AUTHREG_BANNED*** pppSt_BannedUser, int* pInt_UserCount, AUTHREG_BANNED*** pppSt_BannedAddr, int* pInt_AddrCount) { - SQLPacket_IsErrorOccur = FALSE; + SQLPacket_IsErrorOccur = FALSE; - int nRow = 0; - int nColumn = 0; - CHAR** ppszResult = NULL; - TCHAR tszSQLStatement[1024]; //SQL语句 + int nRow = 0; + int nColumn = 0; + CHAR** ppszResult = NULL; + TCHAR tszSQLStatement[1024]; //SQL语句 - memset(tszSQLStatement, '\0', 1024); - _stprintf_s(tszSQLStatement, _T("SELECT * FROM Authorize_BannedAddr")); + memset(tszSQLStatement, '\0', 1024); + _stprintf_s(tszSQLStatement, _T("SELECT * FROM Authorize_BannedAddr")); - if (!DataBase_SQLite_GetTable(xhData, tszSQLStatement, &ppszResult, &nRow, &nColumn)) - { - SQLPacket_IsErrorOccur = TRUE; - SQLPacket_dwErrorCode = DataBase_GetLastError(); - return FALSE; - } - int nFliedValue = nColumn; - list stl_ListAddr; - //轮训所有内容 - for (int i = 0; i < nRow; i++) - { + if (!DataBase_SQLite_GetTable(xhData, tszSQLStatement, &ppszResult, &nRow, &nColumn)) + { + SQLPacket_IsErrorOccur = TRUE; + SQLPacket_dwErrorCode = DataBase_GetLastError(); + return FALSE; + } + int nFliedValue = nColumn; + list stl_ListAddr; + //轮训所有内容 + for (int i = 0; i < nRow; i++) + { AUTHREG_BANNED st_Banned; - memset(&st_Banned, '\0', sizeof(AUTHREG_BANNED)); - //ID + memset(&st_Banned, '\0', sizeof(AUTHREG_BANNED)); + //ID st_Banned.nID = _ttoi64(ppszResult[nFliedValue]); + nFliedValue++; + //是否启用 + st_Banned.bEnable = _ttoi(ppszResult[nFliedValue]); nFliedValue++; - //起始地址 - _tcscpy(st_Banned.tszIPStart, ppszResult[nFliedValue]); - nFliedValue++; - //结束地址 - _tcscpy(st_Banned.tszIPEnd, ppszResult[nFliedValue]); - nFliedValue++; - //注册时间 - _tcscpy(st_Banned.tszTime, ppszResult[nFliedValue]); + //地址 + _tcscpy(st_Banned.tszIPAddr, ppszResult[nFliedValue]); + nFliedValue++; + //过期时间 + _tcscpy(st_Banned.tszLeftTime, ppszResult[nFliedValue]); + nFliedValue++; + //注册时间 + _tcscpy(st_Banned.tszCreateTime, ppszResult[nFliedValue]); nFliedValue++; stl_ListAddr.push_back(st_Banned); - } - DataBase_SQLite_FreeTable(ppszResult); + } + DataBase_SQLite_FreeTable(ppszResult); //用户列表 - nRow = 0; - nColumn = 0; - memset(tszSQLStatement, '\0', 1024); - _stprintf_s(tszSQLStatement, _T("SELECT * FROM Authorize_BannedUser")); + nRow = 0; + nColumn = 0; + memset(tszSQLStatement, '\0', 1024); + _stprintf_s(tszSQLStatement, _T("SELECT * FROM Authorize_BannedUser")); - if (!DataBase_SQLite_GetTable(xhData, tszSQLStatement, &ppszResult, &nRow, &nColumn)) - { - SQLPacket_IsErrorOccur = TRUE; - SQLPacket_dwErrorCode = DataBase_GetLastError(); - return FALSE; - } - nFliedValue = nColumn; - list stl_ListUser; - //轮训所有内容 - for (int i = 0; i < nRow; i++) - { - AUTHREG_BANNED st_Banned; - memset(&st_Banned, '\0', sizeof(AUTHREG_BANNED)); - //ID - st_Banned.nID = _ttoi64(ppszResult[nFliedValue]); - nFliedValue++; - //用户名 - _tcscpy(st_Banned.tszUserName, ppszResult[nFliedValue]); + if (!DataBase_SQLite_GetTable(xhData, tszSQLStatement, &ppszResult, &nRow, &nColumn)) + { + SQLPacket_IsErrorOccur = TRUE; + SQLPacket_dwErrorCode = DataBase_GetLastError(); + return FALSE; + } + nFliedValue = nColumn; + list stl_ListUser; + //轮训所有内容 + for (int i = 0; i < nRow; i++) + { + AUTHREG_BANNED st_Banned; + memset(&st_Banned, '\0', sizeof(AUTHREG_BANNED)); + //ID + st_Banned.nID = _ttoi64(ppszResult[nFliedValue]); + nFliedValue++; + //是否启用 + st_Banned.bEnable = _ttoi(ppszResult[nFliedValue]); nFliedValue++; - //注册时间 - _tcscpy(st_Banned.tszTime, ppszResult[nFliedValue]); + //用户名 + _tcscpy(st_Banned.tszUserName, ppszResult[nFliedValue]); + nFliedValue++; + //过期时间 + _tcscpy(st_Banned.tszLeftTime, ppszResult[nFliedValue]); + nFliedValue++; + //注册时间 + _tcscpy(st_Banned.tszCreateTime, ppszResult[nFliedValue]); nFliedValue++; stl_ListUser.push_back(st_Banned); - } - DataBase_SQLite_FreeTable(ppszResult); + } + DataBase_SQLite_FreeTable(ppszResult); //导出 *pInt_AddrCount = stl_ListAddr.size(); *pInt_UserCount = stl_ListUser.size(); BaseLib_OperatorMemory_Malloc((XPPPMEM)pppSt_BannedAddr, stl_ListAddr.size(), sizeof(AUTHREG_BANNED)); BaseLib_OperatorMemory_Malloc((XPPPMEM)pppSt_BannedUser, stl_ListUser.size(), sizeof(AUTHREG_BANNED)); - list::const_iterator stl_ListIterator = stl_ListAddr.begin(); + list::const_iterator stl_ListIterator = stl_ListAddr.begin(); for (int i = 0; stl_ListIterator != stl_ListAddr.end(); stl_ListIterator++, i++) - { + { (*pppSt_BannedAddr)[i]->nID = stl_ListIterator->nID; - _tcscpy((*pppSt_BannedAddr)[i]->tszIPStart, stl_ListIterator->tszIPStart); - _tcscpy((*pppSt_BannedAddr)[i]->tszIPEnd, stl_ListIterator->tszIPEnd); - _tcscpy((*pppSt_BannedAddr)[i]->tszTime, stl_ListIterator->tszTime); - } - stl_ListIterator = stl_ListUser.begin(); - for (int i = 0; stl_ListIterator != stl_ListUser.end(); stl_ListIterator++, i++) - { - (*pppSt_BannedUser)[i]->nID = stl_ListIterator->nID; - _tcscpy((*pppSt_BannedUser)[i]->tszUserName, stl_ListIterator->tszUserName); - _tcscpy((*pppSt_BannedUser)[i]->tszTime, stl_ListIterator->tszTime); - } + (*pppSt_BannedAddr)[i]->bEnable = stl_ListIterator->bEnable; + _tcscpy((*pppSt_BannedAddr)[i]->tszIPAddr, stl_ListIterator->tszIPAddr); + _tcscpy((*pppSt_BannedAddr)[i]->tszLeftTime, stl_ListIterator->tszLeftTime); + _tcscpy((*pppSt_BannedAddr)[i]->tszCreateTime, stl_ListIterator->tszCreateTime); + } + stl_ListIterator = stl_ListUser.begin(); + for (int i = 0; stl_ListIterator != stl_ListUser.end(); stl_ListIterator++, i++) + { + (*pppSt_BannedUser)[i]->nID = stl_ListIterator->nID; + (*pppSt_BannedUser)[i]->bEnable = stl_ListIterator->bEnable; + _tcscpy((*pppSt_BannedUser)[i]->tszUserName, stl_ListIterator->tszUserName); + _tcscpy((*pppSt_BannedUser)[i]->tszLeftTime, stl_ListIterator->tszLeftTime); + _tcscpy((*pppSt_BannedUser)[i]->tszCreateTime, stl_ListIterator->tszCreateTime); + } stl_ListAddr.clear(); stl_ListUser.clear(); - return TRUE; + return TRUE; } /******************************************************************** 函数名称:Database_SQLite_BannedExist @@ -1281,57 +1286,150 @@ BOOL CDatabase_SQLite::Database_SQLite_BannedList(AUTHREG_BANNED*** pppSt_Banned *********************************************************************/ BOOL CDatabase_SQLite::Database_SQLite_BannedExist(AUTHREG_BANNED* pSt_Banned) { - SQLPacket_IsErrorOccur = FALSE; - + SQLPacket_IsErrorOccur = FALSE; //判断用域名是否存在 if (_tcslen(pSt_Banned->tszUserName) > 0) - { - int nRow = 0; - int nColumn = 0; - CHAR** ppszResult = NULL; - TCHAR tszSQLStatement[1024]; + { + int nRow = 0; + int nColumn = 0; + CHAR** ppszResult = NULL; + TCHAR tszSQLStatement[1024]; memset(tszSQLStatement, '\0', 1024); _stprintf_s(tszSQLStatement, _T("SELECT * FROM Authorize_BannedUser WHERE tszUserName = '%s'"), pSt_Banned->tszUserName); - if (!DataBase_SQLite_GetTable(xhData, tszSQLStatement, &ppszResult, &nRow, &nColumn)) - { - SQLPacket_IsErrorOccur = TRUE; - SQLPacket_dwErrorCode = DataBase_GetLastError(); - return FALSE; - } - DataBase_SQLite_FreeTable(ppszResult); - + if (!DataBase_SQLite_GetTable(xhData, tszSQLStatement, &ppszResult, &nRow, &nColumn)) + { + SQLPacket_IsErrorOccur = TRUE; + SQLPacket_dwErrorCode = DataBase_GetLastError(); + return FALSE; + } if (nRow <= 0) { SQLPacket_IsErrorOccur = TRUE; SQLPacket_dwErrorCode = ERROR_AUTHORIZE_MODULE_DATABASE_NOTMATCH; + DataBase_SQLite_FreeTable(ppszResult); return FALSE; } + int nFliedValue = nColumn; + //ID + pSt_Banned->nID = _ttoi64(ppszResult[nFliedValue]); + nFliedValue++; + //是否启用 + pSt_Banned->bEnable = _ttoi(ppszResult[nFliedValue]); + nFliedValue++; + //地址 + nFliedValue++; + //过期时间 + _tcscpy(pSt_Banned->tszLeftTime, ppszResult[nFliedValue]); + nFliedValue++; + //注册时间 + _tcscpy(pSt_Banned->tszCreateTime, ppszResult[nFliedValue]); + DataBase_SQLite_FreeTable(ppszResult); } //判断IP地址是否存在 - if (_tcslen(pSt_Banned->tszIPStart) > 0) - { - int nRow = 0; - int nColumn = 0; - CHAR** ppszResult = NULL; - TCHAR tszSQLStatement[1024]; - memset(tszSQLStatement, '\0', 1024); - - _stprintf_s(tszSQLStatement, _T("SELECT * FROM Authorize_BannedAddr WHERE tszIPStart = '%s'"), pSt_Banned->tszIPStart); - if (!DataBase_SQLite_GetTable(xhData, tszSQLStatement, &ppszResult, &nRow, &nColumn)) - { - SQLPacket_IsErrorOccur = TRUE; - SQLPacket_dwErrorCode = DataBase_GetLastError(); - return FALSE; - } + if (_tcslen(pSt_Banned->tszIPAddr) > 0) + { + int nRow = 0; + int nColumn = 0; + CHAR** ppszResult = NULL; + TCHAR tszSQLStatement[1024]; + memset(tszSQLStatement, '\0', 1024); + + _stprintf_s(tszSQLStatement, _T("SELECT * FROM Authorize_BannedAddr WHERE tszIPAddr = '%s'"), pSt_Banned->tszIPAddr); + if (!DataBase_SQLite_GetTable(xhData, tszSQLStatement, &ppszResult, &nRow, &nColumn)) + { + SQLPacket_IsErrorOccur = TRUE; + SQLPacket_dwErrorCode = DataBase_GetLastError(); + return FALSE; + } + if (nRow <= 0) + { + SQLPacket_IsErrorOccur = TRUE; + SQLPacket_dwErrorCode = ERROR_AUTHORIZE_MODULE_DATABASE_NOTMATCH; + DataBase_SQLite_FreeTable(ppszResult); + return FALSE; + } + int nFliedValue = nColumn; + //ID + pSt_Banned->nID = _ttoi64(ppszResult[nFliedValue]); + nFliedValue++; + //是否启用 + pSt_Banned->bEnable = _ttoi(ppszResult[nFliedValue]); + nFliedValue++; + //地址 + nFliedValue++; + //过期时间 + _tcscpy(pSt_Banned->tszLeftTime, ppszResult[nFliedValue]); + nFliedValue++; + //注册时间 + _tcscpy(pSt_Banned->tszCreateTime, ppszResult[nFliedValue]); DataBase_SQLite_FreeTable(ppszResult); + } + //处理是否被禁用 + if (!pSt_Banned->bEnable) + { + SQLPacket_IsErrorOccur = TRUE; + SQLPacket_dwErrorCode = ERROR_AUTHORIZE_MODULE_DATABASE_NOTENABLE; + return FALSE; + } + if (_tcslen(pSt_Banned->tszLeftTime) > 0) + { + __int64x nTimer = 0; + TCHAR tszStrTime[128]; + memset(tszStrTime, '\0', sizeof(tszStrTime)); - if (nRow <= 0) + BaseLib_OperatorTime_TimeToStr(tszStrTime); + BaseLib_OperatorTimeSpan_GetForStr(pSt_Banned->tszLeftTime, tszStrTime, &nTimer, 3); + if (nTimer > 0) { SQLPacket_IsErrorOccur = TRUE; - SQLPacket_dwErrorCode = ERROR_AUTHORIZE_MODULE_DATABASE_NOTMATCH; + SQLPacket_dwErrorCode = ERROR_AUTHORIZE_MODULE_DATABASE_TIMELEFT; return FALSE; } + } + + return TRUE; +} +/******************************************************************** +函数名称:Database_SQLite_BannedUPDate +函数功能:更新名单列表信息 + 参数.一:pSt_Banned + In/Out:In + 类型:数据结构指针 + 可空:N + 意思:要操作的数据 +返回值 + 类型:逻辑型 + 意思:是否成功 +备注: +*********************************************************************/ +BOOL CDatabase_SQLite::Database_SQLite_BannedUPDate(AUTHREG_BANNED* pSt_Banned) +{ + SQLPacket_IsErrorOccur = FALSE; + + if (NULL == pSt_Banned) + { + SQLPacket_IsErrorOccur = TRUE; + SQLPacket_dwErrorCode = ERROR_AUTHORIZE_MODULE_DATABASE_PARAMENT; + return FALSE; + } + TCHAR tszSQLStatement[1024]; + memset(tszSQLStatement, '\0', sizeof(tszSQLStatement)); + //处理的类型 + if (_tcslen(pSt_Banned->tszUserName) > 0) + { + _stprintf_s(tszSQLStatement, _T("UPDATE Authorize_BannedUser SET bEnable = %d,tszLeftTime = '%s' WHERE tszUserName = '%s'"), pSt_Banned->bEnable, pSt_Banned->tszLeftTime, pSt_Banned->tszUserName); + } + else + { + _stprintf_s(tszSQLStatement, _T("UPDATE Authorize_BannedAddr SET bEnable = %d,tszLeftTime = '%s' WHERE tszIPAddr = '%s'"), pSt_Banned->bEnable, pSt_Banned->tszLeftTime, pSt_Banned->tszIPAddr); + } + //插入数据库 + if (!DataBase_SQLite_Exec(xhData, tszSQLStatement)) + { + SQLPacket_IsErrorOccur = TRUE; + SQLPacket_dwErrorCode = DataBase_GetLastError(); + return FALSE; } return TRUE; } diff --git a/XEngine_Source/AuthorizeModule_Database/Database_SQLite/Database_SQLite.h b/XEngine_Source/AuthorizeModule_Database/Database_SQLite/Database_SQLite.h index 4a00c1825d4c0b649348cb17d8b5b4a559030023..180945a85f88edb99d08b5b5def3a2aad92941ce 100644 --- a/XEngine_Source/AuthorizeModule_Database/Database_SQLite/Database_SQLite.h +++ b/XEngine_Source/AuthorizeModule_Database/Database_SQLite/Database_SQLite.h @@ -47,9 +47,10 @@ public: BOOL Database_SQLite_BannedDelete(AUTHREG_BANNED* pSt_Banned); BOOL Database_SQLite_BannedList(AUTHREG_BANNED*** pppSt_BannedUser, int* pInt_UserCount, AUTHREG_BANNED*** pppSt_BannedAddr, int* pInt_AddrCount); BOOL Database_SQLite_BannedExist(AUTHREG_BANNED* pSt_Banned); + BOOL Database_SQLite_BannedUPDate(AUTHREG_BANNED* pSt_Banned); protected: BOOL Database_SQLite_UserPayTime(LPCTSTR lpszUserName, LPCTSTR lpszUserTime, LPCTSTR lpszCardTime, ENUM_HELPCOMPONENTS_AUTHORIZE_SERIAL_TYPE en_AuthSerialType, ENUM_HELPCOMPONENTS_AUTHORIZE_SERIAL_TYPE en_AuthUserType); private: BOOL m_bChange; - XHDATA xhData; //数据库句柄 + XNETHANDLE xhData; //数据库句柄 }; diff --git a/XEngine_Source/AuthorizeModule_Database/pch.cpp b/XEngine_Source/AuthorizeModule_Database/pch.cpp index 2df7b11df2ea1c89ad07db97f84f8d40af3fe53f..ec2b9f897a508cf47c694081af4e51e1010fb127 100644 --- a/XEngine_Source/AuthorizeModule_Database/pch.cpp +++ b/XEngine_Source/AuthorizeModule_Database/pch.cpp @@ -120,4 +120,8 @@ extern "C" BOOL Database_SQLite_BannedList(AUTHREG_BANNED * **pppSt_BannedUser, extern "C" BOOL Database_SQLite_BannedExist(AUTHREG_BANNED * pSt_Banned) { return m_SQLAuth.Database_SQLite_BannedExist(pSt_Banned); +} +extern "C" BOOL Database_SQLite_BannedUPDate(AUTHREG_BANNED * pSt_Banned) +{ + return m_SQLAuth.Database_SQLite_BannedUPDate(pSt_Banned); } \ No newline at end of file diff --git a/XEngine_Source/AuthorizeModule_Protocol/AuthorizeModule_Protocol.def b/XEngine_Source/AuthorizeModule_Protocol/AuthorizeModule_Protocol.def index a46d1539896a23de485ebc096b113535e640c947..d8af1ad0a4eb39281613f8e31640f14fa167d120 100644 --- a/XEngine_Source/AuthorizeModule_Protocol/AuthorizeModule_Protocol.def +++ b/XEngine_Source/AuthorizeModule_Protocol/AuthorizeModule_Protocol.def @@ -27,4 +27,5 @@ EXPORTS Protocol_Parse_HttpParseTime Protocol_Parse_HttpParseSwitch Protocol_Parse_HttpParsePos - Protocol_Parse_HttpParseBanned \ No newline at end of file + Protocol_Parse_HttpParseBanned + Protocol_Parse_HttpParseCDKey \ No newline at end of file diff --git a/XEngine_Source/AuthorizeModule_Protocol/Protocol_Define.h b/XEngine_Source/AuthorizeModule_Protocol/Protocol_Define.h index e48ded7d3911a70756fd83dfe4bd76ab89933761..f11353becbb42724671f57dd38daff7bc52c9ce9 100644 --- a/XEngine_Source/AuthorizeModule_Protocol/Protocol_Define.h +++ b/XEngine_Source/AuthorizeModule_Protocol/Protocol_Define.h @@ -670,4 +670,28 @@ extern "C" BOOL Protocol_Parse_HttpParsePos(LPCTSTR lpszMsgBuffer, int nMsgLen, 意思:是否成功 备注: *********************************************************************/ -extern "C" BOOL Protocol_Parse_HttpParseBanned(LPCTSTR lpszMsgBuffer, int nMsgLen, AUTHREG_BANNED* pSt_AuthBanned); \ No newline at end of file +extern "C" BOOL Protocol_Parse_HttpParseBanned(LPCTSTR lpszMsgBuffer, int nMsgLen, AUTHREG_BANNED* pSt_AuthBanned); +/******************************************************************** +函数名称:Protocol_Parse_HttpParseCDKey +函数功能:解析CDKEY + 参数.一:lpszMsgBuffer + In/Out:In + 类型:常量字符指针 + 可空:N + 意思:输入要解析的缓冲区 + 参数.二:nMsgLen + In/Out:In + 类型:整数型 + 可空:N + 意思:输入缓冲区大小 + 参数.三:pSt_Authorize + In/Out:Out + 类型:数据结构指针 + 可空:N + 意思:输出解析后的信息 +返回值 + 类型:逻辑型 + 意思:是否成功 +备注: +*********************************************************************/ +extern "C" BOOL Protocol_Parse_HttpParseCDKey(LPCTSTR lpszMsgBuffer, int nMsgLen, XENGINE_AUTHORIZE_LOCAL* pSt_Authorize); \ No newline at end of file diff --git a/XEngine_Source/AuthorizeModule_Protocol/Protocol_Packet/Protocol_Packet.cpp b/XEngine_Source/AuthorizeModule_Protocol/Protocol_Packet/Protocol_Packet.cpp index 1cd85207c7bbd45d93463fe7228f19a2cd284690..e5634e911c9fbb97b0aa5436698cba34b4713a11 100644 --- a/XEngine_Source/AuthorizeModule_Protocol/Protocol_Packet/Protocol_Packet.cpp +++ b/XEngine_Source/AuthorizeModule_Protocol/Protocol_Packet/Protocol_Packet.cpp @@ -646,7 +646,9 @@ BOOL CProtocol_Packet::Protocol_Packet_HttpBanned(TCHAR* ptszMsgBuffer, int* pIn { Json::Value st_JsonObject; st_JsonObject["nID"] = (Json::Value::Int64)(*pppSt_BannedUser)[i]->nID; - st_JsonObject["tszTime"] = (*pppSt_BannedUser)[i]->tszTime; + st_JsonObject["bEnable"] = (*pppSt_BannedUser)[i]->bEnable; + st_JsonObject["tszLeftTime"] = (*pppSt_BannedUser)[i]->tszLeftTime; + st_JsonObject["tszCreateTime"] = (*pppSt_BannedUser)[i]->tszCreateTime; st_JsonObject["tszUserName"] = (*pppSt_BannedUser)[i]->tszUserName; st_JsonUser.append(st_JsonObject); } @@ -654,9 +656,10 @@ BOOL CProtocol_Packet::Protocol_Packet_HttpBanned(TCHAR* ptszMsgBuffer, int* pIn { Json::Value st_JsonObject; st_JsonObject["nID"] = (Json::Value::Int64)(*pppSt_BannedAddr)[i]->nID; - st_JsonObject["tszIPEnd"] = (*pppSt_BannedAddr)[i]->tszIPEnd; - st_JsonObject["tszIPStart"] = (*pppSt_BannedAddr)[i]->tszIPStart; - st_JsonObject["tszTime"] = (*pppSt_BannedAddr)[i]->tszTime; + st_JsonObject["bEnable"] = (*pppSt_BannedAddr)[i]->bEnable; + st_JsonObject["tszIPAddr"] = (*pppSt_BannedAddr)[i]->tszIPAddr; + st_JsonObject["tszLeftTime"] = (*pppSt_BannedAddr)[i]->tszLeftTime; + st_JsonObject["tszCreateTime"] = (*pppSt_BannedAddr)[i]->tszCreateTime; st_JsonAddr.append(st_JsonObject); } st_JsonRoot["msg"] = "success"; diff --git a/XEngine_Source/AuthorizeModule_Protocol/Protocol_Parse/Protocol_Parse.cpp b/XEngine_Source/AuthorizeModule_Protocol/Protocol_Parse/Protocol_Parse.cpp index 39a5a2396037df75eefdb412ce9bb3bfaad24f43..d17dbb94a0c2485bada64a0c2ce8da1eec43a6da 100644 --- a/XEngine_Source/AuthorizeModule_Protocol/Protocol_Parse/Protocol_Parse.cpp +++ b/XEngine_Source/AuthorizeModule_Protocol/Protocol_Parse/Protocol_Parse.cpp @@ -917,21 +917,158 @@ BOOL CProtocol_Parse::Protocol_Parse_HttpParseBanned(LPCTSTR lpszMsgBuffer, int { pSt_AuthBanned->nID = st_JsonObject["nID"].asInt64(); } - if (!st_JsonObject["tszIPEnd"].isNull()) + if (!st_JsonObject["bEnable"].isNull()) { - _tcscpy(pSt_AuthBanned->tszIPEnd, st_JsonObject["tszIPEnd"].asCString()); + pSt_AuthBanned->bEnable = st_JsonObject["bEnable"].asBool(); } - if (!st_JsonObject["tszIPStart"].isNull()) + if (!st_JsonObject["tszIPAddr"].isNull()) { - _tcscpy(pSt_AuthBanned->tszIPStart, st_JsonObject["tszIPStart"].asCString()); + _tcscpy(pSt_AuthBanned->tszIPAddr, st_JsonObject["tszIPAddr"].asCString()); } - if (!st_JsonObject["tszTime"].isNull()) + if (!st_JsonObject["tszLeftTime"].isNull()) { - _tcscpy(pSt_AuthBanned->tszTime, st_JsonObject["tszTime"].asCString()); + _tcscpy(pSt_AuthBanned->tszLeftTime, st_JsonObject["tszLeftTime"].asCString()); + } + if (!st_JsonObject["tszCreateTime"].isNull()) + { + _tcscpy(pSt_AuthBanned->tszCreateTime, st_JsonObject["tszCreateTime"].asCString()); } if (!st_JsonObject["tszUserName"].isNull()) { _tcscpy(pSt_AuthBanned->tszUserName, st_JsonObject["tszUserName"].asCString()); } return TRUE; +} +/******************************************************************** +函数名称:Protocol_Parse_HttpParseCDKey +函数功能:解析CDKEY + 参数.一:lpszMsgBuffer + In/Out:In + 类型:常量字符指针 + 可空:N + 意思:输入要解析的缓冲区 + 参数.二:nMsgLen + In/Out:In + 类型:整数型 + 可空:N + 意思:输入缓冲区大小 + 参数.三:pSt_Authorize + In/Out:Out + 类型:数据结构指针 + 可空:N + 意思:输出解析后的信息 +返回值 + 类型:逻辑型 + 意思:是否成功 +备注: +*********************************************************************/ +BOOL CProtocol_Parse::Protocol_Parse_HttpParseCDKey(LPCTSTR lpszMsgBuffer, int nMsgLen, XENGINE_AUTHORIZE_LOCAL* pSt_Authorize) +{ + Protocol_IsErrorOccur = FALSE; + + if ((NULL == lpszMsgBuffer) || (NULL == pSt_Authorize)) + { + Protocol_IsErrorOccur = TRUE; + Protocol_dwErrorCode = ERROR_AUTHORIZE_MODULE_PROTOCOL_PARAMENT; + return FALSE; + } + Json::Value st_JsonRoot; + JSONCPP_STRING st_JsonError; + Json::CharReaderBuilder st_ReaderBuilder; + //解析JSON + std::unique_ptr const pSt_JsonReader(st_ReaderBuilder.newCharReader()); + if (!pSt_JsonReader->parse(lpszMsgBuffer, lpszMsgBuffer + nMsgLen, &st_JsonRoot, &st_JsonError)) + { + Protocol_IsErrorOccur = TRUE; + Protocol_dwErrorCode = ERROR_AUTHORIZE_MODULE_PROTOCOL_PARSE; + return FALSE; + } + + if (!st_JsonRoot["tszAddr"].isNull()) + { + _tcscpy(pSt_Authorize->tszAddr, st_JsonRoot["tszAddr"].asCString()); + } + if (!st_JsonRoot["nPort"].isNull()) + { + pSt_Authorize->nPort = st_JsonRoot["nPort"].asInt(); + } + //应用信息 + Json::Value st_JsonAPPInfo = st_JsonRoot["st_AuthAppInfo"]; + if (!st_JsonAPPInfo["nExecTime"].isNull()) + { + pSt_Authorize->st_AuthAppInfo.nExecTime = st_JsonAPPInfo["nExecTime"].asInt(); + } + if (!st_JsonAPPInfo["bInit"].isNull()) + { + pSt_Authorize->st_AuthAppInfo.bInit = st_JsonAPPInfo["bInit"].asBool(); + } + if (!st_JsonAPPInfo["tszAppName"].isNull()) + { + _tcscpy(pSt_Authorize->st_AuthAppInfo.tszAppName, st_JsonAPPInfo["tszAppName"].asCString()); + } + if (!st_JsonAPPInfo["tszAppVer"].isNull()) + { + _tcscpy(pSt_Authorize->st_AuthAppInfo.tszAppVer, st_JsonAPPInfo["tszAppVer"].asCString()); + } + //注册信息 + Json::Value st_JsonREGInfo = st_JsonRoot["st_AuthRegInfo"]; + if (!st_JsonREGInfo["nHasTime"].isNull()) + { + pSt_Authorize->st_AuthRegInfo.nHasTime = (ENUM_HELPCOMPONENTS_AUTHORIZE_REG_TYPE)st_JsonREGInfo["nHasTime"].asInt(); + } + if (!st_JsonREGInfo["enSerialType"].isNull()) + { + pSt_Authorize->st_AuthRegInfo.enSerialType = (ENUM_HELPCOMPONENTS_AUTHORIZE_SERIAL_TYPE)st_JsonREGInfo["enSerialType"].asInt(); + } + if (!st_JsonREGInfo["enRegType"].isNull()) + { + pSt_Authorize->st_AuthRegInfo.enRegType = (ENUM_HELPCOMPONENTS_AUTHORIZE_REG_TYPE)st_JsonREGInfo["enRegType"].asInt(); + } + if (!st_JsonREGInfo["enHWType"].isNull()) + { + pSt_Authorize->st_AuthRegInfo.enHWType = (ENUM_HELPCOMPONENTS_AUTHORIZE_HW_TYPE)st_JsonREGInfo["enHWType"].asInt(); + } + if (!st_JsonREGInfo["enVModeType"].isNull()) + { + pSt_Authorize->st_AuthRegInfo.enVModeType = (ENUM_HELPCOMPONENTS_AUTHORIZE_VERMODE_TYPE)st_JsonREGInfo["enVModeType"].asInt(); + } + if (!st_JsonREGInfo["tszHardware"].isNull()) + { + _tcscpy(pSt_Authorize->st_AuthRegInfo.tszHardware, st_JsonREGInfo["tszHardware"].asCString()); + } + if (!st_JsonREGInfo["tszCreateTime"].isNull()) + { + _tcscpy(pSt_Authorize->st_AuthRegInfo.tszCreateTime, st_JsonREGInfo["tszCreateTime"].asCString()); + } + if (!st_JsonREGInfo["tszRegisterTime"].isNull()) + { + _tcscpy(pSt_Authorize->st_AuthRegInfo.tszRegisterTime, st_JsonREGInfo["tszRegisterTime"].asCString()); + } + if (!st_JsonREGInfo["tszLeftTime"].isNull()) + { + _tcscpy(pSt_Authorize->st_AuthRegInfo.tszLeftTime, st_JsonREGInfo["tszLeftTime"].asCString()); + } + if (!st_JsonREGInfo["tszStartTime"].isNull()) + { + _tcscpy(pSt_Authorize->st_AuthRegInfo.tszStartTime, st_JsonREGInfo["tszStartTime"].asCString()); + } + if (!st_JsonREGInfo["tszExpiryTime"].isNull()) + { + _tcscpy(pSt_Authorize->st_AuthRegInfo.tszExpiryTime, st_JsonREGInfo["tszExpiryTime"].asCString()); + } + //CDKEY用户信息 + Json::Value st_JsonUserInfo = st_JsonRoot["st_AuthUserInfo"]; + if (!st_JsonUserInfo["tszUserName"].isNull()) + { + _tcscpy(pSt_Authorize->st_AuthUserInfo.tszUserName, st_JsonUserInfo["tszUserName"].asCString()); + } + if (!st_JsonUserInfo["tszUserContact"].isNull()) + { + _tcscpy(pSt_Authorize->st_AuthUserInfo.tszUserContact, st_JsonUserInfo["tszUserContact"].asCString()); + } + if (!st_JsonUserInfo["tszCustom"].isNull()) + { + _tcscpy(pSt_Authorize->st_AuthUserInfo.tszCustom, st_JsonUserInfo["tszCustom"].asCString()); + } + return TRUE; } \ No newline at end of file diff --git a/XEngine_Source/AuthorizeModule_Protocol/Protocol_Parse/Protocol_Parse.h b/XEngine_Source/AuthorizeModule_Protocol/Protocol_Parse/Protocol_Parse.h index 52055bc9270d7598a30a68fd0381984ba89e65a2..a5a3721b112c9701e54d6dbbb2ab1c0e0de8324e 100644 --- a/XEngine_Source/AuthorizeModule_Protocol/Protocol_Parse/Protocol_Parse.h +++ b/XEngine_Source/AuthorizeModule_Protocol/Protocol_Parse/Protocol_Parse.h @@ -32,6 +32,7 @@ public: BOOL Protocol_Parse_HttpParseSwitch(LPCTSTR lpszMsgBuffer, int nMsgLen, XENGINE_FUNCTIONSWITCH* pSt_FunSwitch); BOOL Protocol_Parse_HttpParsePos(LPCTSTR lpszMsgBuffer, int nMsgLen, int* pInt_PosStart, int* pInt_PosEnd); BOOL Protocol_Parse_HttpParseBanned(LPCTSTR lpszMsgBuffer, int nMsgLen, AUTHREG_BANNED* pSt_AuthBanned); + BOOL Protocol_Parse_HttpParseCDKey(LPCTSTR lpszMsgBuffer, int nMsgLen, XENGINE_AUTHORIZE_LOCAL* pSt_Authorize); protected: private: }; \ No newline at end of file diff --git a/XEngine_Source/AuthorizeModule_Protocol/pch.cpp b/XEngine_Source/AuthorizeModule_Protocol/pch.cpp index d8cbff308192045083ac79b8e791614090e23ea6..3af1f338d38e20b8b253b5dd46322837d9fed822 100644 --- a/XEngine_Source/AuthorizeModule_Protocol/pch.cpp +++ b/XEngine_Source/AuthorizeModule_Protocol/pch.cpp @@ -129,4 +129,8 @@ extern "C" BOOL Protocol_Parse_HttpParsePos(LPCTSTR lpszMsgBuffer, int nMsgLen, extern "C" BOOL Protocol_Parse_HttpParseBanned(LPCTSTR lpszMsgBuffer, int nMsgLen, AUTHREG_BANNED * pSt_AuthBanned) { return m_ProtocolParse.Protocol_Parse_HttpParseBanned(lpszMsgBuffer, nMsgLen, pSt_AuthBanned); +} +extern "C" BOOL Protocol_Parse_HttpParseCDKey(LPCTSTR lpszMsgBuffer, int nMsgLen, XENGINE_AUTHORIZE_LOCAL * pSt_Authorize) +{ + return m_ProtocolParse.Protocol_Parse_HttpParseCDKey(lpszMsgBuffer, nMsgLen, pSt_Authorize); } \ No newline at end of file diff --git a/XEngine_Source/VSCopy_x64.bat b/XEngine_Source/VSCopy_x64.bat index 9e160afb0eba477a825e8920df8bcfce0cbc15b4..46994819d4c9a82a085c591de235919999837c0c 100644 --- a/XEngine_Source/VSCopy_x64.bat +++ b/XEngine_Source/VSCopy_x64.bat @@ -12,7 +12,7 @@ copy /y "%XEngine_Lib64%\XEngine_HelpComponents\HelpComponents_Authorize.dll" ". copy /y "%XEngine_Lib64%\XEngine_RfcComponents\RfcComponents_WSProtocol.dll" "./" copy /y "%XEngine_Lib64%\XEngine_RfcComponents\RfcComponents_HttpServer.dll" "./" -copy /y "%XEngine_Lib64%\XEngine_NetHelp\NetHelp_APIHelp.dll" "./" +copy /y "%XEngine_Lib64%\XEngine_NetHelp\NetHelp_APIClient.dll" "./" copy /y "%XEngine_Lib64%\XEngine_SystemSdk\XEngine_SystemApi.dll" "./" copy /y "%XEngine_Lib64%\XEngine_HelpComponents\bson-1.0.dll" "./" diff --git a/XEngine_Source/VSCopy_x86.bat b/XEngine_Source/VSCopy_x86.bat index 12d4d08ca9f1a02f9086c911b847883875378552..06c70339b3c8e73aa502b998830260f2a71bfa8b 100644 --- a/XEngine_Source/VSCopy_x86.bat +++ b/XEngine_Source/VSCopy_x86.bat @@ -12,7 +12,7 @@ copy /y "%XEngine_Lib32%\XEngine_HelpComponents\HelpComponents_Authorize.dll" ". copy /y "%XEngine_Lib32%\XEngine_RfcComponents\RfcComponents_WSProtocol.dll" "./" copy /y "%XEngine_Lib32%\XEngine_RfcComponents\RfcComponents_HttpServer.dll" "./" -copy /y "%XEngine_Lib32%\XEngine_NetHelp\NetHelp_APIHelp.dll" "./" +copy /y "%XEngine_Lib32%\XEngine_NetHelp\NetHelp_APIClient.dll" "./" copy /y "%XEngine_Lib32%\XEngine_SystemSdk\XEngine_SystemApi.dll" "./" copy /y "%XEngine_Lib32%\XEngine_HelpComponents\bson-1.0.dll" "./" diff --git a/XEngine_Source/XAuth_Protocol.h b/XEngine_Source/XAuth_Protocol.h index 1787e859dcb85d115275e36cf338f3fdfc0c506a..7f326af6bfdbb45c87e40c91ba2c000b5094efd3 100644 --- a/XEngine_Source/XAuth_Protocol.h +++ b/XEngine_Source/XAuth_Protocol.h @@ -82,7 +82,8 @@ typedef struct { __int64x nID; //ID CHAR tszUserName[MAX_PATH]; //用户名 - CHAR tszIPStart[128]; //起始IP - CHAR tszIPEnd[128]; //结束IP - CHAR tszTime[64]; //时间 + CHAR tszIPAddr[128]; //IP + CHAR tszLeftTime[64]; //过期时间 + CHAR tszCreateTime[64]; //创建时间 + BOOL bEnable; //是否启用 }AUTHREG_BANNED, * LPAUTHREG_BANNED; \ No newline at end of file diff --git a/XEngine_Source/XEngine_APPService/XEngine_AuthorizeApp/Authorize_Dialog/Dialog_Banned.cpp b/XEngine_Source/XEngine_APPService/XEngine_AuthorizeApp/Authorize_Dialog/Dialog_Banned.cpp index 92142996fde977f5f2502416cf52bae743ca0275..f2d1b97d58afa1d1aa2cba8722cb9166d62f45cc 100644 --- a/XEngine_Source/XEngine_APPService/XEngine_AuthorizeApp/Authorize_Dialog/Dialog_Banned.cpp +++ b/XEngine_Source/XEngine_APPService/XEngine_AuthorizeApp/Authorize_Dialog/Dialog_Banned.cpp @@ -27,11 +27,13 @@ void CDialog_Banned::DoDataExchange(CDataExchange* pDX) DDX_Control(pDX, IDC_RADIO1, m_RadioIPAddr); DDX_Control(pDX, IDC_RADIO2, m_RadioUser); DDX_Control(pDX, IDC_STATIC_TIPS, m_StaticTips); - DDX_Control(pDX, IDC_STATIC_TIPS2, m_StaticIPEnd); - DDX_Control(pDX, IDC_EDIT2, m_EditIPEnd); DDX_Control(pDX, IDC_LIST1, m_ListAddr); DDX_Control(pDX, IDC_LIST2, m_ListUser); DDX_Control(pDX, IDC_EDIT1, m_EditUser); + DDX_Control(pDX, IDC_DATETIMEPICKER1, m_DataTime); + DDX_Control(pDX, IDC_CHECK1, m_BtnCheckTime); + DDX_Control(pDX, IDC_RADIO4, m_RadioEnable); + DDX_Control(pDX, IDC_RADIO6, m_RadioDisable); } @@ -41,6 +43,10 @@ BEGIN_MESSAGE_MAP(CDialog_Banned, CDialogEx) ON_BN_CLICKED(IDC_BUTTON2, &CDialog_Banned::OnBnClickedButton2) ON_BN_CLICKED(IDC_BUTTON4, &CDialog_Banned::OnBnClickedButton4) ON_BN_CLICKED(IDC_BUTTON3, &CDialog_Banned::OnBnClickedButton3) + ON_BN_CLICKED(IDC_CHECK1, &CDialog_Banned::OnBnClickedCheck1) + ON_BN_CLICKED(IDC_BUTTON5, &CDialog_Banned::OnBnClickedButton5) + ON_NOTIFY(NM_CLICK, IDC_LIST2, &CDialog_Banned::OnNMClickList2) + ON_NOTIFY(NM_CLICK, IDC_LIST1, &CDialog_Banned::OnNMClickList1) END_MESSAGE_MAP() @@ -51,9 +57,6 @@ void CDialog_Banned::OnBnClickedRadio1() { // TODO: 在此添加控件通知处理程序代码 m_StaticTips.SetWindowText(_T("要禁用的IP地址:")); - m_StaticIPEnd.SetWindowText(_T("禁用的结束IP地址:")); - m_StaticIPEnd.ShowWindow(SW_SHOW); - m_EditIPEnd.ShowWindow(SW_SHOW); } @@ -61,9 +64,6 @@ void CDialog_Banned::OnBnClickedRadio2() { // TODO: 在此添加控件通知处理程序代码 m_StaticTips.SetWindowText(_T("要禁用的用户名:")); - - m_StaticIPEnd.ShowWindow(SW_HIDE); - m_EditIPEnd.ShowWindow(SW_HIDE); } @@ -75,19 +75,23 @@ BOOL CDialog_Banned::OnInitDialog() m_StaticTips.SetWindowText(_T("要禁用的用户名:")); m_RadioUser.SetCheck(BST_CHECKED); - m_StaticIPEnd.ShowWindow(SW_HIDE); - m_EditIPEnd.ShowWindow(SW_HIDE); - m_ListAddr.InsertColumn(0, _T("序号"), LVCFMT_LEFT, 80); - m_ListAddr.InsertColumn(1, _T("起始IP地址"), LVCFMT_LEFT, 120); - m_ListAddr.InsertColumn(2, _T("结束IP地址"), LVCFMT_LEFT, 120); - m_ListAddr.InsertColumn(3, _T("创建日期"), LVCFMT_LEFT, 120); + m_ListAddr.InsertColumn(1, _T("是否启用"), LVCFMT_LEFT, 60); + m_ListAddr.InsertColumn(2, _T("IP地址"), LVCFMT_LEFT, 120); + m_ListAddr.InsertColumn(3, _T("过期日期"), LVCFMT_LEFT, 120); + m_ListAddr.InsertColumn(4, _T("创建日期"), LVCFMT_LEFT, 120); m_ListAddr.SetExtendedStyle(LVS_EX_FULLROWSELECT); m_ListUser.InsertColumn(0, _T("序号"), LVCFMT_LEFT, 80); - m_ListUser.InsertColumn(1, _T("用户名"), LVCFMT_LEFT, 120); - m_ListUser.InsertColumn(2, _T("创建日期"), LVCFMT_LEFT, 120); + m_ListUser.InsertColumn(1, _T("是否启用"), LVCFMT_LEFT, 60); + m_ListUser.InsertColumn(2, _T("用户名"), LVCFMT_LEFT, 120); + m_ListUser.InsertColumn(3, _T("过期日期"), LVCFMT_LEFT, 120); + m_ListUser.InsertColumn(4, _T("创建日期"), LVCFMT_LEFT, 120); m_ListUser.SetExtendedStyle(LVS_EX_FULLROWSELECT); + + m_DataTime.EnableWindow(FALSE); + m_RadioEnable.SetCheck(BST_CHECKED); + m_DataTime.SetFormat(_T("yyyy-mm-dd hh:mm:ss")); return TRUE; // return TRUE unless you set the focus to a control // 异常: OCX 属性页应返回 FALSE } @@ -100,14 +104,14 @@ void CDialog_Banned::OnBnClickedButton2() CString m_StrIPPort; CString m_StrToken; CString m_StrUser; - CString m_StrIPEnd; + CString m_StrTime; CDialog_Config* pWnd = (CDialog_Config*)CDialog_Config::FromHandle(hConfigWnd); pWnd->m_EditIPAddr.GetWindowText(m_StrIPAddr); pWnd->m_EditIPPort.GetWindowText(m_StrIPPort); pWnd->m_EditToken.GetWindowText(m_StrToken); m_EditUser.GetWindowText(m_StrUser); - m_EditIPEnd.GetWindowText(m_StrIPEnd); + m_DataTime.GetWindowText(m_StrTime); TCHAR tszUrlAddr[MAX_PATH]; memset(tszUrlAddr, '\0', MAX_PATH); @@ -124,8 +128,19 @@ void CDialog_Banned::OnBnClickedButton2() } else { - st_JsonObject["tszIPStart"] = m_StrUser.GetBuffer(); - st_JsonObject["tszIPEnd"] = m_StrIPEnd.GetBuffer(); + st_JsonObject["tszIPAddr"] = m_StrUser.GetBuffer(); + } + if (BST_CHECKED == m_RadioEnable.GetCheck()) + { + st_JsonObject["bEnable"] = true; + } + else + { + st_JsonObject["bEnable"] = false; + } + if (BST_CHECKED == m_BtnCheckTime.GetCheck()) + { + st_JsonObject["tszLeftTime"] = m_StrTime.GetBuffer(); } st_JsonRoot["st_Banned"] = st_JsonObject; //是否加密 @@ -139,11 +154,11 @@ void CDialog_Banned::OnBnClickedButton2() nMsgLen = st_JsonRoot.toStyledString().length(); OPenSsl_XCrypto_Encoder(st_JsonRoot.toStyledString().c_str(), &nMsgLen, (UCHAR*)tszMsgBuffer, tszPassBuffer); - APIHelp_HttpRequest_Custom(_T("POST"), tszUrlAddr, tszMsgBuffer, NULL, &ptszMsgBuffer, &nMsgLen); + APIClient_Http_Request(_T("POST"), tszUrlAddr, tszMsgBuffer, NULL, &ptszMsgBuffer, &nMsgLen); } else { - APIHelp_HttpRequest_Custom(_T("POST"), tszUrlAddr, st_JsonRoot.toStyledString().c_str(), NULL, &ptszMsgBuffer, &nMsgLen); + APIClient_Http_Request(_T("POST"), tszUrlAddr, st_JsonRoot.toStyledString().c_str(), NULL, &ptszMsgBuffer, &nMsgLen); } JSONCPP_STRING st_JsonError; Json::CharReaderBuilder st_ReaderBuilder; @@ -217,11 +232,11 @@ void CDialog_Banned::OnBnClickedButton4() nMsgLen = st_JsonRoot.toStyledString().length(); OPenSsl_XCrypto_Encoder(st_JsonRoot.toStyledString().c_str(), &nMsgLen, (UCHAR*)tszMsgBuffer, tszPassBuffer); - APIHelp_HttpRequest_Custom(_T("POST"), tszUrlAddr, tszMsgBuffer, NULL, &ptszMsgBuffer, &nMsgLen); + APIClient_Http_Request(_T("POST"), tszUrlAddr, tszMsgBuffer, NULL, &ptszMsgBuffer, &nMsgLen); } else { - APIHelp_HttpRequest_Custom(_T("POST"), tszUrlAddr, st_JsonRoot.toStyledString().c_str(), NULL, &ptszMsgBuffer, &nMsgLen); + APIClient_Http_Request(_T("POST"), tszUrlAddr, st_JsonRoot.toStyledString().c_str(), NULL, &ptszMsgBuffer, &nMsgLen); } JSONCPP_STRING st_JsonError; Json::CharReaderBuilder st_ReaderBuilder; @@ -258,9 +273,17 @@ void CDialog_Banned::OnBnClickedButton4() m_ListAddr.InsertItem(i, _T("")); m_ListAddr.SetItemText(i, 0, tszIndex); - m_ListAddr.SetItemText(i, 1, st_JsonArray["tszIPStart"].asCString()); - m_ListAddr.SetItemText(i, 2, st_JsonArray["tszIPEnd"].asCString()); - m_ListAddr.SetItemText(i, 3, st_JsonArray["tszTime"].asCString()); + if (st_JsonArray["bEnable"].asBool()) + { + m_ListAddr.SetItemText(i, 1, "启用"); + } + else + { + m_ListAddr.SetItemText(i, 1, "禁用"); + } + m_ListAddr.SetItemText(i, 2, st_JsonArray["tszIPAddr"].asCString()); + m_ListAddr.SetItemText(i, 3, st_JsonArray["tszLeftTime"].asCString()); + m_ListAddr.SetItemText(i, 4, st_JsonArray["tszCreateTime"].asCString()); } for (unsigned int i = 0; i < st_JsonRoot["ArrayUser"].size(); i++) { @@ -272,8 +295,17 @@ void CDialog_Banned::OnBnClickedButton4() m_ListUser.InsertItem(i, _T("")); m_ListUser.SetItemText(i, 0, tszIndex); - m_ListUser.SetItemText(i, 1, st_JsonArray["tszUserName"].asCString()); - m_ListUser.SetItemText(i, 2, st_JsonArray["tszTime"].asCString()); + if (st_JsonArray["bEnable"].asBool()) + { + m_ListUser.SetItemText(i, 1, "启用"); + } + else + { + m_ListUser.SetItemText(i, 1, "禁用"); + } + m_ListUser.SetItemText(i, 2, st_JsonArray["tszUserName"].asCString()); + m_ListUser.SetItemText(i, 3, st_JsonArray["tszLeftTime"].asCString()); + m_ListUser.SetItemText(i, 4, st_JsonArray["tszCreateTime"].asCString()); } BaseLib_OperatorMemory_FreeCStyle((XPPMEM)&ptszMsgBuffer); } @@ -282,8 +314,6 @@ void CDialog_Banned::OnBnClickedButton4() void CDialog_Banned::OnBnClickedButton3() { CString m_StrUser; - CString m_StrIPStart; - CString m_StrIPEnd; Json::Value st_JsonRoot; Json::Value st_JsonObject; // TODO: 在此添加控件通知处理程序代码 @@ -291,18 +321,15 @@ void CDialog_Banned::OnBnClickedButton3() int nSelect = m_ListUser.GetNextSelectedItem(pSt_Sition); if (nSelect >= 0) { - m_StrUser = m_ListUser.GetItemText(nSelect, 1); + m_StrUser = m_ListUser.GetItemText(nSelect, 2); st_JsonObject["tszUserName"] = m_StrUser.GetBuffer(); } pSt_Sition = m_ListAddr.GetFirstSelectedItemPosition(); nSelect = m_ListAddr.GetNextSelectedItem(pSt_Sition); if (nSelect >= 0) { - m_StrIPStart = m_ListAddr.GetItemText(nSelect, 1); - m_StrIPEnd = m_ListAddr.GetItemText(nSelect, 2); - - st_JsonObject["tszIPStart"] = m_StrIPStart.GetBuffer(); - st_JsonObject["tszIPEnd"] = m_StrIPEnd.GetBuffer(); + m_StrUser = m_ListAddr.GetItemText(nSelect, 2); + st_JsonObject["tszIPAddr"] = m_StrUser.GetBuffer(); } CString m_StrIPAddr; CString m_StrIPPort; @@ -332,11 +359,11 @@ void CDialog_Banned::OnBnClickedButton3() nMsgLen = st_JsonRoot.toStyledString().length(); OPenSsl_XCrypto_Encoder(st_JsonRoot.toStyledString().c_str(), &nMsgLen, (UCHAR*)tszMsgBuffer, tszPassBuffer); - APIHelp_HttpRequest_Custom(_T("POST"), tszUrlAddr, tszMsgBuffer, NULL, &ptszMsgBuffer, &nMsgLen); + APIClient_Http_Request(_T("POST"), tszUrlAddr, tszMsgBuffer, NULL, &ptszMsgBuffer, &nMsgLen); } else { - APIHelp_HttpRequest_Custom(_T("POST"), tszUrlAddr, st_JsonRoot.toStyledString().c_str(), NULL, &ptszMsgBuffer, &nMsgLen); + APIClient_Http_Request(_T("POST"), tszUrlAddr, st_JsonRoot.toStyledString().c_str(), NULL, &ptszMsgBuffer, &nMsgLen); } st_JsonRoot.clear(); JSONCPP_STRING st_JsonError; @@ -375,3 +402,237 @@ void CDialog_Banned::OnBnClickedButton3() //刷新 OnBnClickedButton4(); } + + +void CDialog_Banned::OnBnClickedCheck1() +{ + // TODO: 在此添加控件通知处理程序代码 + if (BST_CHECKED == m_BtnCheckTime.GetCheck()) + { + m_DataTime.EnableWindow(TRUE); + m_BtnCheckTime.SetCheck(BST_CHECKED); + } + else + { + m_DataTime.EnableWindow(FALSE); + m_BtnCheckTime.SetCheck(BST_UNCHECKED); + } +} + + +void CDialog_Banned::OnBnClickedButton5() +{ + // TODO: 在此添加控件通知处理程序代码 + CString m_StrIPAddr; + CString m_StrIPPort; + CString m_StrToken; + CString m_StrUser; + CString m_StrTime; + + CDialog_Config* pWnd = (CDialog_Config*)CDialog_Config::FromHandle(hConfigWnd); + pWnd->m_EditIPAddr.GetWindowText(m_StrIPAddr); + pWnd->m_EditIPPort.GetWindowText(m_StrIPPort); + pWnd->m_EditToken.GetWindowText(m_StrToken); + m_EditUser.GetWindowText(m_StrUser); + m_DataTime.GetWindowText(m_StrTime); + + TCHAR tszUrlAddr[MAX_PATH]; + memset(tszUrlAddr, '\0', MAX_PATH); + + _stprintf(tszUrlAddr, _T("http://%s:%s/auth/banned/modify"), m_StrIPAddr.GetBuffer(), m_StrIPPort.GetBuffer()); + int nMsgLen = 0; + CHAR* ptszMsgBuffer = NULL; + Json::Value st_JsonRoot; + Json::Value st_JsonObject; + st_JsonRoot["xhToken"] = _ttoi64(m_StrToken.GetBuffer()); + if (BST_CHECKED == m_RadioUser.GetCheck()) + { + st_JsonObject["tszUserName"] = m_StrUser.GetBuffer(); + } + else + { + st_JsonObject["tszIPAddr"] = m_StrUser.GetBuffer(); + } + if (BST_CHECKED == m_RadioEnable.GetCheck()) + { + st_JsonObject["bEnable"] = true; + } + else + { + st_JsonObject["bEnable"] = false; + } + if (BST_CHECKED == m_BtnCheckTime.GetCheck()) + { + st_JsonObject["tszLeftTime"] = m_StrTime.GetBuffer(); + } + st_JsonRoot["st_Banned"] = st_JsonObject; + //是否加密 + TCHAR tszPassBuffer[64]; + memset(tszPassBuffer, '\0', sizeof(tszPassBuffer)); + ::GetDlgItemText(hConfigWnd, IDC_EDIT6, tszPassBuffer, sizeof(tszPassBuffer)); + if (bCrypto) + { + TCHAR tszMsgBuffer[2048]; + memset(tszMsgBuffer, '\0', sizeof(tszMsgBuffer)); + + nMsgLen = st_JsonRoot.toStyledString().length(); + OPenSsl_XCrypto_Encoder(st_JsonRoot.toStyledString().c_str(), &nMsgLen, (UCHAR*)tszMsgBuffer, tszPassBuffer); + APIClient_Http_Request(_T("POST"), tszUrlAddr, tszMsgBuffer, NULL, &ptszMsgBuffer, &nMsgLen); + } + else + { + APIClient_Http_Request(_T("POST"), tszUrlAddr, st_JsonRoot.toStyledString().c_str(), NULL, &ptszMsgBuffer, &nMsgLen); + } + JSONCPP_STRING st_JsonError; + Json::CharReaderBuilder st_ReaderBuilder; + st_JsonRoot.clear(); + std::unique_ptr const pSt_JsonReader(st_ReaderBuilder.newCharReader()); + if (bCrypto) + { + TCHAR tszMsgBuffer[2048]; + memset(tszMsgBuffer, '\0', sizeof(tszMsgBuffer)); + + OPenSsl_XCrypto_Decoder(ptszMsgBuffer, &nMsgLen, tszMsgBuffer, tszPassBuffer); + if (!pSt_JsonReader->parse(tszMsgBuffer, tszMsgBuffer + nMsgLen, &st_JsonRoot, &st_JsonError)) + { + Authorize_Help_LogPrint(_T("解析客户列表接口数据错误,无法继续")); + return; + } + } + else + { + if (!pSt_JsonReader->parse(ptszMsgBuffer, ptszMsgBuffer + nMsgLen, &st_JsonRoot, &st_JsonError)) + { + Authorize_Help_LogPrint(_T("解析客户列表接口数据错误,无法继续")); + return; + } + } + + if (0 == st_JsonRoot["code"].asInt()) + { + Authorize_Help_LogPrint(_T("更新黑名单信息成功")); + } + else + { + Authorize_Help_LogPrint(_T("更新黑名单信息成功")); + } + BaseLib_OperatorMemory_FreeCStyle((XPPMEM)&ptszMsgBuffer); + OnBnClickedButton4(); +} + + +void CDialog_Banned::OnNMClickList2(NMHDR* pNMHDR, LRESULT* pResult) +{ + LPNMITEMACTIVATE pNMItemActivate = reinterpret_cast(pNMHDR); + // TODO: 在此添加控件通知处理程序代码 + POSITION pSt_Sition = m_ListUser.GetFirstSelectedItemPosition(); + int nItemCount = m_ListUser.GetNextSelectedItem(pSt_Sition); + if (nItemCount < 0) + { + return; + } + CString m_StrEnable = m_ListUser.GetItemText(nItemCount, 1); + CString m_StrUser = m_ListUser.GetItemText(nItemCount, 2); + CString m_StrTime = m_ListUser.GetItemText(nItemCount, 3); + + if (0 == _tcsnicmp(m_StrEnable.GetBuffer(), _T("启用"), m_StrEnable.GetLength())) + { + m_RadioEnable.SetCheck(BST_CHECKED); + m_RadioDisable.SetCheck(BST_UNCHECKED); + } + else + { + m_RadioEnable.SetCheck(BST_UNCHECKED); + m_RadioDisable.SetCheck(BST_CHECKED); + } + m_RadioIPAddr.SetCheck(BST_UNCHECKED); + m_RadioUser.SetCheck(BST_CHECKED); + + m_EditUser.SetWindowText(m_StrUser.GetBuffer()); + if (m_StrTime.GetLength() > 0) + { + SYSTEMTIME st_SysTime; + XENGINE_LIBTIMER st_LibTime; + + memset(&st_SysTime, '\0', sizeof(SYSTEMTIME)); + memset(&st_LibTime, '\0', sizeof(XENGINE_LIBTIMER)); + + BaseLib_OperatorTime_StrToTime(m_StrTime.GetBuffer(), &st_LibTime); + + st_SysTime.wYear = st_LibTime.wYear; + st_SysTime.wMonth = st_LibTime.wMonth; + st_SysTime.wDay = st_LibTime.wDay; + st_SysTime.wHour = st_LibTime.wHour; + st_SysTime.wMinute = st_LibTime.wMinute; + st_SysTime.wSecond = st_LibTime.wSecond; + + m_BtnCheckTime.SetCheck(BST_CHECKED); + m_DataTime.EnableWindow(TRUE); + m_DataTime.SetTime(&st_SysTime); + } + else + { + m_BtnCheckTime.SetCheck(BST_UNCHECKED); + m_DataTime.EnableWindow(FALSE); + } + *pResult = 0; +} + + +void CDialog_Banned::OnNMClickList1(NMHDR* pNMHDR, LRESULT* pResult) +{ + LPNMITEMACTIVATE pNMItemActivate = reinterpret_cast(pNMHDR); + // TODO: 在此添加控件通知处理程序代码 + POSITION pSt_Sition = m_ListAddr.GetFirstSelectedItemPosition(); + int nItemCount = m_ListAddr.GetNextSelectedItem(pSt_Sition); + if (nItemCount < 0) + { + return; + } + CString m_StrEnable = m_ListAddr.GetItemText(nItemCount, 1); + CString m_StrUser = m_ListAddr.GetItemText(nItemCount, 2); + CString m_StrTime = m_ListAddr.GetItemText(nItemCount, 3); + + if (0 == _tcsnicmp(m_StrEnable.GetBuffer(), _T("启用"), m_StrEnable.GetLength())) + { + m_RadioEnable.SetCheck(BST_CHECKED); + m_RadioDisable.SetCheck(BST_UNCHECKED); + } + else + { + m_RadioEnable.SetCheck(BST_UNCHECKED); + m_RadioDisable.SetCheck(BST_CHECKED); + } + m_RadioIPAddr.SetCheck(BST_CHECKED); + m_RadioUser.SetCheck(BST_UNCHECKED); + + m_EditUser.SetWindowText(m_StrUser.GetBuffer()); + if (m_StrTime.GetLength() > 0) + { + SYSTEMTIME st_SysTime; + XENGINE_LIBTIMER st_LibTime; + + memset(&st_SysTime, '\0', sizeof(SYSTEMTIME)); + memset(&st_LibTime, '\0', sizeof(XENGINE_LIBTIMER)); + + BaseLib_OperatorTime_StrToTime(m_StrTime.GetBuffer(), &st_LibTime); + + st_SysTime.wYear = st_LibTime.wYear; + st_SysTime.wMonth = st_LibTime.wMonth; + st_SysTime.wDay = st_LibTime.wDay; + st_SysTime.wHour = st_LibTime.wHour; + st_SysTime.wMinute = st_LibTime.wMinute; + st_SysTime.wSecond = st_LibTime.wSecond; + + m_BtnCheckTime.SetCheck(BST_CHECKED); + m_DataTime.EnableWindow(TRUE); + m_DataTime.SetTime(&st_SysTime); + } + else + { + m_BtnCheckTime.SetCheck(BST_UNCHECKED); + m_DataTime.EnableWindow(FALSE); + } + + *pResult = 0; +} diff --git a/XEngine_Source/XEngine_APPService/XEngine_AuthorizeApp/Authorize_Dialog/Dialog_Banned.h b/XEngine_Source/XEngine_APPService/XEngine_AuthorizeApp/Authorize_Dialog/Dialog_Banned.h index e401b232e0e6e2066374c64c334c8e8163c38635..ae7b1e1ad2e371d884fb70990754f9c8f9ece9bb 100644 --- a/XEngine_Source/XEngine_APPService/XEngine_AuthorizeApp/Authorize_Dialog/Dialog_Banned.h +++ b/XEngine_Source/XEngine_APPService/XEngine_AuthorizeApp/Authorize_Dialog/Dialog_Banned.h @@ -28,12 +28,18 @@ public: CStatic m_StaticTips; afx_msg void OnBnClickedRadio2(); virtual BOOL OnInitDialog(); - CStatic m_StaticIPEnd; - CEdit m_EditIPEnd; afx_msg void OnBnClickedButton2(); afx_msg void OnBnClickedButton4(); afx_msg void OnBnClickedButton3(); CListCtrl m_ListAddr; CListCtrl m_ListUser; CEdit m_EditUser; + CDateTimeCtrl m_DataTime; + afx_msg void OnBnClickedCheck1(); + CButton m_BtnCheckTime; + CButton m_RadioEnable; + CButton m_RadioDisable; + afx_msg void OnBnClickedButton5(); + afx_msg void OnNMClickList2(NMHDR* pNMHDR, LRESULT* pResult); + afx_msg void OnNMClickList1(NMHDR* pNMHDR, LRESULT* pResult); }; diff --git a/XEngine_Source/XEngine_APPService/XEngine_AuthorizeApp/Authorize_Dialog/Dialog_Config.cpp b/XEngine_Source/XEngine_APPService/XEngine_AuthorizeApp/Authorize_Dialog/Dialog_Config.cpp index b0b8903a315903b4fd5948c11a75852bf9ed19df..3c6e5d68a72838f989850b3a651206154bdea8f6 100644 --- a/XEngine_Source/XEngine_APPService/XEngine_AuthorizeApp/Authorize_Dialog/Dialog_Config.cpp +++ b/XEngine_Source/XEngine_APPService/XEngine_AuthorizeApp/Authorize_Dialog/Dialog_Config.cpp @@ -96,12 +96,12 @@ void CDialog_Config::OnBnClickedButton1() m_EditIPPort.GetWindowText(m_StrIPPort); m_EditUser.GetWindowText(m_StrUser); m_EditPass.GetWindowText(m_StrPass); - - _stprintf(tszUrlAddr, _T("http://%s:%s/api?function=login&user=%s&pass=%s"), m_StrIPAddr.GetBuffer(), m_StrIPPort.GetBuffer(), m_StrUser.GetBuffer(), m_StrPass.GetBuffer()); + + _stprintf(tszUrlAddr, _T("http://%s:%s/api?function=login&user=%s&pass=%s&device=%d"), m_StrIPAddr.GetBuffer(), m_StrIPPort.GetBuffer(), m_StrUser.GetBuffer(), m_StrPass.GetBuffer(), ENUM_PROTOCOL_FOR_DEVICE_TYPE_PC_WINDOWS); //请求用户信息 int nMsgLen = 0; CHAR* ptszMsgBuffer = NULL; - APIHelp_HttpRequest_Custom(_T("GET"), tszUrlAddr, NULL, NULL, &ptszMsgBuffer, &nMsgLen); + APIClient_Http_Request(_T("GET"), tszUrlAddr, NULL, NULL, &ptszMsgBuffer, &nMsgLen); Json::Value st_JsonRoot; JSONCPP_STRING st_JsonError; @@ -167,7 +167,7 @@ void CDialog_Config::OnBnClickedButton2() //请求用户信息 int nMsgLen = 0; CHAR* ptszMsgBuffer = NULL; - APIHelp_HttpRequest_Custom(_T("GET"), tszUrlAddr, NULL, NULL, &ptszMsgBuffer, &nMsgLen); + APIClient_Http_Request(_T("GET"), tszUrlAddr, NULL, NULL, &ptszMsgBuffer, &nMsgLen); Json::Value st_JsonRoot; JSONCPP_STRING st_JsonError; @@ -228,7 +228,7 @@ void CDialog_Config::OnBnClickedButton5() //请求用户信息 int nMsgLen = 0; CHAR* ptszMsgBuffer = NULL; - APIHelp_HttpRequest_Custom(_T("GET"), tszUrlAddr, NULL, NULL, &ptszMsgBuffer, &nMsgLen); + APIClient_Http_Request(_T("GET"), tszUrlAddr, NULL, NULL, &ptszMsgBuffer, &nMsgLen); Json::Value st_JsonRoot; JSONCPP_STRING st_JsonError; diff --git a/XEngine_Source/XEngine_APPService/XEngine_AuthorizeApp/Authorize_Dialog/Dialog_Modify.cpp b/XEngine_Source/XEngine_APPService/XEngine_AuthorizeApp/Authorize_Dialog/Dialog_Modify.cpp index 32b0037e8d9451a0744467dd33909ff585d86e95..efbadf844e3ccf424348c42fa3bb603e8442ef6e 100644 --- a/XEngine_Source/XEngine_APPService/XEngine_AuthorizeApp/Authorize_Dialog/Dialog_Modify.cpp +++ b/XEngine_Source/XEngine_APPService/XEngine_AuthorizeApp/Authorize_Dialog/Dialog_Modify.cpp @@ -106,11 +106,11 @@ BOOL CDialog_Modify::OnInitDialog() nMsgLen = st_JsonRoot.toStyledString().length(); OPenSsl_XCrypto_Encoder(st_JsonRoot.toStyledString().c_str(), &nMsgLen, (UCHAR*)tszMsgBuffer, tszPassBuffer); - APIHelp_HttpRequest_Custom(_T("POST"), tszUrlAddr, tszMsgBuffer, NULL, &ptszMsgBuffer, &nMsgLen); + APIClient_Http_Request(_T("POST"), tszUrlAddr, tszMsgBuffer, NULL, &ptszMsgBuffer, &nMsgLen); } else { - APIHelp_HttpRequest_Custom(_T("POST"), tszUrlAddr, st_JsonRoot.toStyledString().c_str(), NULL, &ptszMsgBuffer, &nMsgLen); + APIClient_Http_Request(_T("POST"), tszUrlAddr, st_JsonRoot.toStyledString().c_str(), NULL, &ptszMsgBuffer, &nMsgLen); } st_JsonObject.clear(); st_JsonRoot.clear(); @@ -159,6 +159,11 @@ BOOL CDialog_Modify::OnInitDialog() m_ComboSerial.SetCurSel(st_JsonObject["enSerialType"].asInt()); m_ComboLeave.SetCurSel(st_JsonObject["st_UserInfo"]["nUserLevel"].asInt() + 1); + + if (ENUM_XENGINE_PROTOCOLHDR_LEVEL_TYPE_ROOT == st_JsonObject["st_UserInfo"]["nUserLevel"].asInt()) + { + m_ComboLeave.EnableWindow(FALSE); + } } return TRUE; // return TRUE unless you set the focus to a control // 异常: OCX 属性页应返回 FALSE @@ -240,11 +245,11 @@ void CDialog_Modify::OnBnClickedButton2() nMsgLen = st_JsonRoot.toStyledString().length(); OPenSsl_XCrypto_Encoder(st_JsonRoot.toStyledString().c_str(), &nMsgLen, (UCHAR*)tszMsgBuffer, tszPassBuffer); - APIHelp_HttpRequest_Custom(_T("POST"), tszUrlAddr, tszMsgBuffer, NULL, &ptszMsgBuffer, &nMsgLen); + APIClient_Http_Request(_T("POST"), tszUrlAddr, tszMsgBuffer, NULL, &ptszMsgBuffer, &nMsgLen); } else { - APIHelp_HttpRequest_Custom(_T("POST"), tszUrlAddr, st_JsonRoot.toStyledString().c_str(), NULL, &ptszMsgBuffer, &nMsgLen); + APIClient_Http_Request(_T("POST"), tszUrlAddr, st_JsonRoot.toStyledString().c_str(), NULL, &ptszMsgBuffer, &nMsgLen); } st_JsonRoot.clear(); JSONCPP_STRING st_JsonError; diff --git a/XEngine_Source/XEngine_APPService/XEngine_AuthorizeApp/Authorize_Dialog/Dialog_Serial.cpp b/XEngine_Source/XEngine_APPService/XEngine_AuthorizeApp/Authorize_Dialog/Dialog_Serial.cpp index 8be34cc5983c4ad08828fd0c206470aefa00ba1f..c16a088f4f84a7474aa196b18d3daad8b82ba620 100644 --- a/XEngine_Source/XEngine_APPService/XEngine_AuthorizeApp/Authorize_Dialog/Dialog_Serial.cpp +++ b/XEngine_Source/XEngine_APPService/XEngine_AuthorizeApp/Authorize_Dialog/Dialog_Serial.cpp @@ -121,11 +121,11 @@ void CDialog_Serial::OnBnClickedButton1() nMsgLen = st_JsonRoot.toStyledString().length(); OPenSsl_XCrypto_Encoder(st_JsonRoot.toStyledString().c_str(), &nMsgLen, (UCHAR*)tszMsgBuffer, tszPassBuffer); - APIHelp_HttpRequest_Custom(_T("POST"), tszUrlAddr, tszMsgBuffer, NULL, &ptszMsgBuffer, &nMsgLen); + APIClient_Http_Request(_T("POST"), tszUrlAddr, tszMsgBuffer, NULL, &ptszMsgBuffer, &nMsgLen); } else { - APIHelp_HttpRequest_Custom(_T("POST"), tszUrlAddr, st_JsonRoot.toStyledString().c_str(), NULL, &ptszMsgBuffer, &nMsgLen); + APIClient_Http_Request(_T("POST"), tszUrlAddr, st_JsonRoot.toStyledString().c_str(), NULL, &ptszMsgBuffer, &nMsgLen); } JSONCPP_STRING st_JsonError; Json::CharReaderBuilder st_ReaderBuilder; @@ -225,11 +225,11 @@ void CDialog_Serial::OnBnClickedButton2() nMsgLen = st_JsonRoot.toStyledString().length(); OPenSsl_XCrypto_Encoder(st_JsonRoot.toStyledString().c_str(), &nMsgLen, (UCHAR*)tszMsgBuffer, tszPassBuffer); - APIHelp_HttpRequest_Custom(_T("POST"), tszUrlAddr, tszMsgBuffer, NULL, &ptszMsgBuffer, &nMsgLen); + APIClient_Http_Request(_T("POST"), tszUrlAddr, tszMsgBuffer, NULL, &ptszMsgBuffer, &nMsgLen); } else { - APIHelp_HttpRequest_Custom(_T("POST"), tszUrlAddr, st_JsonRoot.toStyledString().c_str(), NULL, &ptszMsgBuffer, &nMsgLen); + APIClient_Http_Request(_T("POST"), tszUrlAddr, st_JsonRoot.toStyledString().c_str(), NULL, &ptszMsgBuffer, &nMsgLen); } st_JsonRoot.clear(); JSONCPP_STRING st_JsonError; @@ -324,11 +324,11 @@ void CDialog_Serial::OnBnClickedButton4() nMsgLen = st_JsonRoot.toStyledString().length(); OPenSsl_XCrypto_Encoder(st_JsonRoot.toStyledString().c_str(), &nMsgLen, (UCHAR*)tszMsgBuffer, tszPassBuffer); - APIHelp_HttpRequest_Custom(_T("POST"), tszUrlAddr, tszMsgBuffer, NULL, &ptszMsgBuffer, &nMsgLen); + APIClient_Http_Request(_T("POST"), tszUrlAddr, tszMsgBuffer, NULL, &ptszMsgBuffer, &nMsgLen); } else { - APIHelp_HttpRequest_Custom(_T("POST"), tszUrlAddr, st_JsonRoot.toStyledString().c_str(), NULL, &ptszMsgBuffer, &nMsgLen); + APIClient_Http_Request(_T("POST"), tszUrlAddr, st_JsonRoot.toStyledString().c_str(), NULL, &ptszMsgBuffer, &nMsgLen); } st_JsonRoot.clear(); JSONCPP_STRING st_JsonError; @@ -479,11 +479,11 @@ void CDialog_Serial::OnBnClickedButton6() nMsgLen = st_JsonRoot.toStyledString().length(); OPenSsl_XCrypto_Encoder(st_JsonRoot.toStyledString().c_str(), &nMsgLen, (UCHAR*)tszMsgBuffer, tszPassBuffer); - APIHelp_HttpRequest_Custom(_T("POST"), tszUrlAddr, tszMsgBuffer, NULL, &ptszMsgBuffer, &nMsgLen); + APIClient_Http_Request(_T("POST"), tszUrlAddr, tszMsgBuffer, NULL, &ptszMsgBuffer, &nMsgLen); } else { - APIHelp_HttpRequest_Custom(_T("POST"), tszUrlAddr, st_JsonRoot.toStyledString().c_str(), NULL, &ptszMsgBuffer, &nMsgLen); + APIClient_Http_Request(_T("POST"), tszUrlAddr, st_JsonRoot.toStyledString().c_str(), NULL, &ptszMsgBuffer, &nMsgLen); } st_JsonRoot.clear(); JSONCPP_STRING st_JsonError; diff --git a/XEngine_Source/XEngine_APPService/XEngine_AuthorizeApp/Authorize_Dialog/Dialog_Switch.cpp b/XEngine_Source/XEngine_APPService/XEngine_AuthorizeApp/Authorize_Dialog/Dialog_Switch.cpp index 96c30a3516ea0184de963be18b35ef68789e711c..9e6b82636ff7a86f1056c9802db41abd5197de7e 100644 --- a/XEngine_Source/XEngine_APPService/XEngine_AuthorizeApp/Authorize_Dialog/Dialog_Switch.cpp +++ b/XEngine_Source/XEngine_APPService/XEngine_AuthorizeApp/Authorize_Dialog/Dialog_Switch.cpp @@ -80,11 +80,11 @@ void CDialog_Switch::OnBnClickedButton1() nMsgLen = st_JsonRoot.toStyledString().length(); OPenSsl_XCrypto_Encoder(st_JsonRoot.toStyledString().c_str(), &nMsgLen, (UCHAR*)tszMsgBuffer, tszPassBuffer); - APIHelp_HttpRequest_Custom(_T("POST"), tszUrlAddr, tszMsgBuffer, NULL, &ptszMsgBuffer, &nMsgLen); + APIClient_Http_Request(_T("POST"), tszUrlAddr, tszMsgBuffer, NULL, &ptszMsgBuffer, &nMsgLen); } else { - APIHelp_HttpRequest_Custom(_T("POST"), tszUrlAddr, st_JsonRoot.toStyledString().c_str(), NULL, &ptszMsgBuffer, &nMsgLen); + APIClient_Http_Request(_T("POST"), tszUrlAddr, st_JsonRoot.toStyledString().c_str(), NULL, &ptszMsgBuffer, &nMsgLen); } st_JsonRoot.clear(); JSONCPP_STRING st_JsonError; @@ -259,11 +259,11 @@ void CDialog_Switch::OnBnClickedButton2() nMsgLen = st_JsonRoot.toStyledString().length(); OPenSsl_XCrypto_Encoder(st_JsonRoot.toStyledString().c_str(), &nMsgLen, (UCHAR*)tszMsgBuffer, tszPassBuffer); - APIHelp_HttpRequest_Custom(_T("POST"), tszUrlAddr, tszMsgBuffer, NULL, &ptszMsgBuffer, &nMsgLen); + APIClient_Http_Request(_T("POST"), tszUrlAddr, tszMsgBuffer, NULL, &ptszMsgBuffer, &nMsgLen); } else { - APIHelp_HttpRequest_Custom(_T("POST"), tszUrlAddr, st_JsonRoot.toStyledString().c_str(), NULL, &ptszMsgBuffer, &nMsgLen); + APIClient_Http_Request(_T("POST"), tszUrlAddr, st_JsonRoot.toStyledString().c_str(), NULL, &ptszMsgBuffer, &nMsgLen); } st_JsonRoot.clear(); JSONCPP_STRING st_JsonError; diff --git a/XEngine_Source/XEngine_APPService/XEngine_AuthorizeApp/Authorize_Dialog/Dialog_User.cpp b/XEngine_Source/XEngine_APPService/XEngine_AuthorizeApp/Authorize_Dialog/Dialog_User.cpp index e6bfa49ab848471d9ac9408fb39276a814650e09..824a807e8dc65e286d067ee5b7908ace87f5b5d8 100644 --- a/XEngine_Source/XEngine_APPService/XEngine_AuthorizeApp/Authorize_Dialog/Dialog_User.cpp +++ b/XEngine_Source/XEngine_APPService/XEngine_AuthorizeApp/Authorize_Dialog/Dialog_User.cpp @@ -41,6 +41,7 @@ BEGIN_MESSAGE_MAP(CDialog_User, CDialogEx) ON_BN_CLICKED(IDC_BUTTON4, &CDialog_User::OnBnClickedButton4) ON_BN_CLICKED(IDC_CHECK2, &CDialog_User::OnBnClickedCheck2) ON_BN_CLICKED(IDC_BUTTON5, &CDialog_User::OnBnClickedButton5) + ON_NOTIFY(NM_DBLCLK, IDC_LIST1, &CDialog_User::OnNMDblclkList1) END_MESSAGE_MAP() @@ -120,11 +121,11 @@ void CDialog_User::OnBnClickedButton1() nMsgLen = st_JsonRoot.toStyledString().length(); OPenSsl_XCrypto_Encoder(st_JsonRoot.toStyledString().c_str(), &nMsgLen, (UCHAR*)tszMsgBuffer, tszPassBuffer); - APIHelp_HttpRequest_Custom(_T("POST"), tszUrlAddr, tszMsgBuffer, NULL, &ptszMsgBuffer, &nMsgLen); + APIClient_Http_Request(_T("POST"), tszUrlAddr, tszMsgBuffer, NULL, &ptszMsgBuffer, &nMsgLen); } else { - APIHelp_HttpRequest_Custom(_T("POST"), tszUrlAddr, st_JsonRoot.toStyledString().c_str(), NULL, &ptszMsgBuffer, &nMsgLen); + APIClient_Http_Request(_T("POST"), tszUrlAddr, st_JsonRoot.toStyledString().c_str(), NULL, &ptszMsgBuffer, &nMsgLen); } JSONCPP_STRING st_JsonError; Json::CharReaderBuilder st_ReaderBuilder; @@ -229,11 +230,11 @@ void CDialog_User::OnBnClickedButton2() nMsgLen = st_JsonRoot.toStyledString().length(); OPenSsl_XCrypto_Encoder(st_JsonRoot.toStyledString().c_str(), &nMsgLen, (UCHAR*)tszMsgBuffer, tszPassBuffer); - APIHelp_HttpRequest_Custom(_T("POST"), tszUrlAddr, tszMsgBuffer, NULL, &ptszMsgBuffer, &nMsgLen); + APIClient_Http_Request(_T("POST"), tszUrlAddr, tszMsgBuffer, NULL, &ptszMsgBuffer, &nMsgLen); } else { - APIHelp_HttpRequest_Custom(_T("POST"), tszUrlAddr, st_JsonRoot.toStyledString().c_str(), NULL, &ptszMsgBuffer, &nMsgLen); + APIClient_Http_Request(_T("POST"), tszUrlAddr, st_JsonRoot.toStyledString().c_str(), NULL, &ptszMsgBuffer, &nMsgLen); } //查看返回值是否正确 st_JsonRoot.clear(); @@ -317,11 +318,11 @@ void CDialog_User::OnBnClickedButton3() nMsgLen = st_JsonRoot.toStyledString().length(); OPenSsl_XCrypto_Encoder(st_JsonRoot.toStyledString().c_str(), &nMsgLen, (UCHAR*)tszMsgBuffer, tszPassBuffer); - APIHelp_HttpRequest_Custom(_T("POST"), tszUrlAddr, tszMsgBuffer, NULL, &ptszMsgBuffer, &nMsgLen); + APIClient_Http_Request(_T("POST"), tszUrlAddr, tszMsgBuffer, NULL, &ptszMsgBuffer, &nMsgLen); } else { - APIHelp_HttpRequest_Custom(_T("POST"), tszUrlAddr, st_JsonRoot.toStyledString().c_str(), NULL, &ptszMsgBuffer, &nMsgLen); + APIClient_Http_Request(_T("POST"), tszUrlAddr, st_JsonRoot.toStyledString().c_str(), NULL, &ptszMsgBuffer, &nMsgLen); } //查看返回值是否正确 st_JsonRoot.clear(); @@ -432,3 +433,12 @@ void CDialog_User::OnBnClickedButton5() CDialog_Modify m_DlgModify; m_DlgModify.DoModal(); } + + +void CDialog_User::OnNMDblclkList1(NMHDR* pNMHDR, LRESULT* pResult) +{ + LPNMITEMACTIVATE pNMItemActivate = reinterpret_cast(pNMHDR); + // TODO: 在此添加控件通知处理程序代码 + OnBnClickedButton4(); + *pResult = 0; +} diff --git a/XEngine_Source/XEngine_APPService/XEngine_AuthorizeApp/Authorize_Dialog/Dialog_User.h b/XEngine_Source/XEngine_APPService/XEngine_AuthorizeApp/Authorize_Dialog/Dialog_User.h index 1750595692744ff1ceb6dffea7946f60acc35c0a..bbe39633e68a61692b9b4937403c316829151131 100644 --- a/XEngine_Source/XEngine_APPService/XEngine_AuthorizeApp/Authorize_Dialog/Dialog_User.h +++ b/XEngine_Source/XEngine_APPService/XEngine_AuthorizeApp/Authorize_Dialog/Dialog_User.h @@ -40,4 +40,5 @@ public: afx_msg void OnBnClickedButton5(); CEdit m_EditPosStart; CEdit m_EditPosEnd; + afx_msg void OnNMDblclkList1(NMHDR* pNMHDR, LRESULT* pResult); }; diff --git a/XEngine_Source/XEngine_APPService/XEngine_AuthorizeApp/XEngineAuthorizeApp.aps b/XEngine_Source/XEngine_APPService/XEngine_AuthorizeApp/XEngineAuthorizeApp.aps index 13b5bb6322e5de9c3fa1ef48a44fd59e55e5a94c..59cec6af1d3f78b0afd9f87df8df97fc077b8948 100644 Binary files a/XEngine_Source/XEngine_APPService/XEngine_AuthorizeApp/XEngineAuthorizeApp.aps and b/XEngine_Source/XEngine_APPService/XEngine_AuthorizeApp/XEngineAuthorizeApp.aps differ diff --git a/XEngine_Source/XEngine_APPService/XEngine_AuthorizeApp/XEngineAuthorizeApp.rc b/XEngine_Source/XEngine_APPService/XEngine_AuthorizeApp/XEngineAuthorizeApp.rc index 96ee716d879e06f95033ecfe95a4d99fd47c5f92..070d058892d902d115c895ec682007f415550db5 100644 Binary files a/XEngine_Source/XEngine_APPService/XEngine_AuthorizeApp/XEngineAuthorizeApp.rc and b/XEngine_Source/XEngine_APPService/XEngine_AuthorizeApp/XEngineAuthorizeApp.rc differ diff --git a/XEngine_Source/XEngine_APPService/XEngine_AuthorizeApp/pch.h b/XEngine_Source/XEngine_APPService/XEngine_AuthorizeApp/pch.h index 00025d1e0167f47fcade309e83407e26c916328e..bf5cd5aedd692c363dbf32c6e9b99b812790bb9a 100644 --- a/XEngine_Source/XEngine_APPService/XEngine_AuthorizeApp/pch.h +++ b/XEngine_Source/XEngine_APPService/XEngine_AuthorizeApp/pch.h @@ -20,8 +20,8 @@ using namespace std; #include #include #include -#include -#include +#include +#include #include #include #include "../../XAuth_Protocol.h" @@ -63,4 +63,4 @@ extern LPCSTR lpszStuType[2]; #pragma comment(lib,"XEngine_BaseLib/XEngine_BaseLib.lib") #pragma comment(lib,"XEngine_Core/XEngine_OPenSsl.lib") -#pragma comment(lib,"XEngine_NetHelp/NetHelp_APIHelp.lib") \ No newline at end of file +#pragma comment(lib,"XEngine_NetHelp/NetHelp_APIClient.lib") \ No newline at end of file diff --git a/XEngine_Source/XEngine_APPService/XEngine_AuthorizeApp/resource.h b/XEngine_Source/XEngine_APPService/XEngine_AuthorizeApp/resource.h index e41e37e3d48990669a436a0ff6351c5c5f85e126..f0fc68ebe767d9882242b7c60474000b45f66139 100644 --- a/XEngine_Source/XEngine_APPService/XEngine_AuthorizeApp/resource.h +++ b/XEngine_Source/XEngine_APPService/XEngine_AuthorizeApp/resource.h @@ -41,6 +41,7 @@ #define IDC_RADIO4 1018 #define IDC_STATIC_TIPS2 1018 #define IDC_RADIO5 1019 +#define IDC_DATETIMEPICKER1 1019 #define IDC_RADIO6 1020 #define IDC_RADIO7 1021 #define IDC_RADIO8 1022 @@ -53,7 +54,7 @@ #ifndef APSTUDIO_READONLY_SYMBOLS #define _APS_NEXT_RESOURCE_VALUE 142 #define _APS_NEXT_COMMAND_VALUE 32771 -#define _APS_NEXT_CONTROL_VALUE 1018 +#define _APS_NEXT_CONTROL_VALUE 1020 #define _APS_NEXT_SYMED_VALUE 101 #endif #endif diff --git a/XEngine_Source/XEngine_APPService/XEngine_AuthorizeService/AuthorizeHTTP_Get/AuthorizeHTTP_Token.cpp b/XEngine_Source/XEngine_APPService/XEngine_AuthorizeService/AuthorizeHTTP_Get/AuthorizeHTTP_Token.cpp index 141f1135be4e6596c2cc9dc057ab700889f53ef4..71f0ae67586a343c498a5e7130ad7ea151de5000 100644 --- a/XEngine_Source/XEngine_APPService/XEngine_AuthorizeService/AuthorizeHTTP_Get/AuthorizeHTTP_Token.cpp +++ b/XEngine_Source/XEngine_APPService/XEngine_AuthorizeService/AuthorizeHTTP_Get/AuthorizeHTTP_Token.cpp @@ -29,7 +29,7 @@ BOOL XEngine_AuthorizeHTTP_Token(LPCTSTR lpszClientAddr, TCHAR** pptszList, int memset(tszDeviceType, '\0', sizeof(tszDeviceType)); memset(&st_UserTable, '\0', sizeof(AUTHREG_USERTABLE)); - if (nListCount < 3) + if (nListCount < 4) { Protocol_Packet_HttpComm(tszSDBuffer, &nSDLen, 400, "request parament is incorrent"); XEngine_Client_TaskSend(lpszClientAddr, tszSDBuffer, nSDLen, XENGINE_AUTH_APP_NETTYPE_HTTP); @@ -54,7 +54,7 @@ BOOL XEngine_AuthorizeHTTP_Token(LPCTSTR lpszClientAddr, TCHAR** pptszList, int st_AuthProtocol.enDeviceType = (ENUM_PROTOCOLDEVICE_TYPE)_ttoi(tszDeviceType); Protocol_Packet_HttpUserPass(tszSDBuffer, &nSDLen, &st_AuthProtocol); - APIHelp_HttpRequest_Custom(_T("POST"), st_AuthConfig.st_XLogin.st_PassUrl.tszPassLogin, tszSDBuffer, &nHTTPCode, &ptszMsgBuffer, &nHTTPLen); + APIClient_Http_Request(_T("POST"), st_AuthConfig.st_XLogin.st_PassUrl.tszPassLogin, tszSDBuffer, &nHTTPCode, &ptszMsgBuffer, &nHTTPLen); if (200 != nHTTPCode) { Protocol_Packet_HttpComm(tszSDBuffer, &nSDLen, 404, "user not found"); @@ -213,7 +213,7 @@ BOOL XEngine_AuthorizeHTTP_Token(LPCTSTR lpszClientAddr, TCHAR** pptszList, int memset(tszSDBuffer, '\0', MAX_PATH); Protocol_Packet_HttpUserTime(tszSDBuffer, &nSDLen, &st_AuthTime); - APIHelp_HttpRequest_Custom(_T("POST"), st_AuthConfig.st_XLogin.st_PassUrl.tszPassLogout, tszSDBuffer); + APIClient_Http_Request(_T("POST"), st_AuthConfig.st_XLogin.st_PassUrl.tszPassLogout, tszSDBuffer); } Database_SQLite_UserLeave(&st_AuthTime); } diff --git a/XEngine_Source/XEngine_APPService/XEngine_AuthorizeService/AuthorizeHTTP_Post/AuthorizeHTTP_Banned.cpp b/XEngine_Source/XEngine_APPService/XEngine_AuthorizeService/AuthorizeHTTP_Post/AuthorizeHTTP_Banned.cpp index 21fc1d5ca14c184ff93b65419f041bd184ef4c69..723fab075eb3e3d89d14947e5a5baad7394fa68e 100644 --- a/XEngine_Source/XEngine_APPService/XEngine_AuthorizeService/AuthorizeHTTP_Post/AuthorizeHTTP_Banned.cpp +++ b/XEngine_Source/XEngine_APPService/XEngine_AuthorizeService/AuthorizeHTTP_Post/AuthorizeHTTP_Banned.cpp @@ -7,6 +7,7 @@ BOOL XEngine_AuthorizeHTTP_Banned(LPCTSTR lpszClientAddr, LPCTSTR lpszAPIName, L LPCTSTR lpszAPIInsert = _T("insert"); LPCTSTR lpszAPIDelete = _T("delete"); LPCTSTR lpszAPIList = _T("list"); + LPCTSTR lpszAPIModify = _T("modify"); memset(tszSDBuffer, '\0', sizeof(tszSDBuffer)); @@ -19,7 +20,7 @@ BOOL XEngine_AuthorizeHTTP_Banned(LPCTSTR lpszClientAddr, LPCTSTR lpszAPIName, L Database_SQLite_BannedInsert(&st_Banned); Protocol_Packet_HttpComm(tszSDBuffer, &nSDLen); XEngine_Client_TaskSend(lpszClientAddr, tszSDBuffer, nSDLen, XENGINE_AUTH_APP_NETTYPE_HTTP); - XLOG_PRINT(xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_INFO, _T("HTTP客户端:%s,插入禁用列表成功,禁用的用户:%s,禁用的IP地址:%s - %s"), lpszClientAddr, st_Banned.tszUserName, st_Banned.tszIPStart, st_Banned.tszIPEnd); + XLOG_PRINT(xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_INFO, _T("HTTP客户端:%s,插入禁用列表成功,禁用的用户:%s,禁用的IP地址:%s"), lpszClientAddr, st_Banned.tszUserName, st_Banned.tszIPAddr); } else if (0 == _tcsnicmp(lpszAPIDelete, lpszAPIName, _tcslen(lpszAPIDelete))) { @@ -30,7 +31,7 @@ BOOL XEngine_AuthorizeHTTP_Banned(LPCTSTR lpszClientAddr, LPCTSTR lpszAPIName, L Database_SQLite_BannedDelete(&st_Banned); Protocol_Packet_HttpComm(tszSDBuffer, &nSDLen); XEngine_Client_TaskSend(lpszClientAddr, tszSDBuffer, nSDLen, XENGINE_AUTH_APP_NETTYPE_HTTP); - XLOG_PRINT(xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_INFO, _T("HTTP客户端:%s,删除禁用列表成功,删除禁用的用户:%s,删除禁用的IP地址:%s - %s"), lpszClientAddr, st_Banned.tszUserName, st_Banned.tszIPStart, st_Banned.tszIPEnd); + XLOG_PRINT(xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_INFO, _T("HTTP客户端:%s,删除禁用列表成功,删除禁用的用户:%s,删除禁用的IP地址:%s"), lpszClientAddr, st_Banned.tszUserName, st_Banned.tszIPAddr); } else if (0 == _tcsnicmp(lpszAPIList, lpszAPIName, _tcslen(lpszAPIList))) { @@ -46,5 +47,16 @@ BOOL XEngine_AuthorizeHTTP_Banned(LPCTSTR lpszClientAddr, LPCTSTR lpszAPIName, L BaseLib_OperatorMemory_Free((XPPPMEM)&ppSt_BannedUser, nCountUser); XLOG_PRINT(xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_INFO, _T("HTTP客户端:%s,查询禁用列表成功,禁用的用户个数:%d,禁用的IP地址个数:%d"), lpszClientAddr, nCountUser, nCountAddr); } + else if (0 == _tcsnicmp(lpszAPIModify, lpszAPIName, _tcslen(lpszAPIModify))) + { + AUTHREG_BANNED st_Banned; + memset(&st_Banned, '\0', sizeof(AUTHREG_BANNED)); + + Protocol_Parse_HttpParseBanned(lpszMsgBuffer, nMsgLen, &st_Banned); + Database_SQLite_BannedUPDate(&st_Banned); + Protocol_Packet_HttpComm(tszSDBuffer, &nSDLen); + XEngine_Client_TaskSend(lpszClientAddr, tszSDBuffer, nSDLen, XENGINE_AUTH_APP_NETTYPE_HTTP); + XLOG_PRINT(xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_INFO, _T("HTTP客户端:%s,修改禁用列表成功,修改的用户:%s,修改的IP地址:%s"), lpszClientAddr, st_Banned.tszUserName, st_Banned.tszIPAddr); + } return TRUE; } \ No newline at end of file diff --git a/XEngine_Source/XEngine_APPService/XEngine_AuthorizeService/AuthorizeHTTP_Post/AuthorizeHTTP_CDKey.cpp b/XEngine_Source/XEngine_APPService/XEngine_AuthorizeService/AuthorizeHTTP_Post/AuthorizeHTTP_CDKey.cpp new file mode 100644 index 0000000000000000000000000000000000000000..8c651f14bb86ea6e4e6a265540b41c3f87a61a35 --- /dev/null +++ b/XEngine_Source/XEngine_APPService/XEngine_AuthorizeService/AuthorizeHTTP_Post/AuthorizeHTTP_CDKey.cpp @@ -0,0 +1,70 @@ +#include "../Authorize_Hdr.h" + +BOOL XEngine_AuthorizeHTTP_CDKey(LPCTSTR lpszClientAddr, LPCTSTR lpszAPIName, LPCTSTR lpszMsgBuffer, int nMsgLen, LPCTSTR lpszPass) +{ + int nSDLen = 4096; + int nRVLen = 4096; + TCHAR tszSDBuffer[4096]; + TCHAR tszRVBuffer[4096]; + LPCTSTR lpszAPICreate = _T("create"); + LPCTSTR lpszAPIAuth = _T("auth"); + + memset(tszSDBuffer, '\0', sizeof(tszSDBuffer)); + memset(tszRVBuffer, '\0', sizeof(tszRVBuffer)); + + if (0 == _tcsnicmp(lpszAPICreate, lpszAPIName, _tcslen(lpszAPICreate))) + { + XENGINE_AUTHORIZE_LOCAL st_Authorize; + memset(&st_Authorize, '\0', sizeof(XENGINE_AUTHORIZE_LOCAL)); + + Protocol_Parse_HttpParseCDKey(lpszMsgBuffer, nMsgLen, &st_Authorize); + if (!Authorize_Local_WriteMemory(tszRVBuffer, &nRVLen, &st_Authorize)) + { + Protocol_Packet_HttpComm(tszSDBuffer, &nSDLen, 406, "Not Acceptable,write key failed"); + XEngine_Client_TaskSend(lpszClientAddr, tszSDBuffer, nSDLen, XENGINE_AUTH_APP_NETTYPE_HTTP); + XLOG_PRINT(xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_WARN, _T("HTTP客户端:%s,请求创建CDKEY协议失败,服务器内部错误:%lX"), lpszClientAddr, Authorize_GetLastError()); + return FALSE; + } + XEngine_Client_TaskSend(lpszClientAddr, tszRVBuffer, nRVLen, XENGINE_AUTH_APP_NETTYPE_HTTP); + XLOG_PRINT(xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_WARN, _T("HTTP客户端:%s,请求创建CDKEY成功,APP名:%s,APP版本:%s"), lpszClientAddr, st_Authorize.st_AuthAppInfo.tszAppName, st_Authorize.st_AuthAppInfo.tszAppVer); + } + else if (0 == _tcsnicmp(lpszAPIAuth, lpszAPIName, _tcslen(lpszAPIAuth))) + { + XENGINE_AUTHORIZE_LOCAL st_Authorize; + memset(&st_Authorize, '\0', sizeof(XENGINE_AUTHORIZE_LOCAL)); + + Authorize_Local_ReadMemory(lpszMsgBuffer, nMsgLen, &st_Authorize); + //授权 + if (ENUM_HELPCOMPONENTS_AUTHORIZE_SERIAL_TYPE_CUSTOM == st_Authorize.st_AuthRegInfo.enSerialType) + { + XENGINE_LIBTIMER st_LibTime; + memset(&st_LibTime, '\0', sizeof(XENGINE_LIBTIMER)); + + BaseLib_OperatorTime_StrToTime(st_Authorize.st_AuthRegInfo.tszLeftTime, &st_LibTime); + Authorize_Local_BuildKeyTime(&st_Authorize, 0, &st_LibTime); + } + else + { + Authorize_Local_BuildKeyTime(&st_Authorize, _ttoi64(st_Authorize.st_AuthRegInfo.tszLeftTime)); + } + Authorize_Local_WriteMemory(tszRVBuffer, &nRVLen, &st_Authorize); + //加密 + if (NULL == lpszPass) + { + XEngine_Client_TaskSend(lpszClientAddr, tszRVBuffer, nRVLen, XENGINE_AUTH_APP_NETTYPE_HTTP); + } + else + { + OPenSsl_XCrypto_Encoder(tszRVBuffer, &nRVLen, (UCHAR*)tszSDBuffer, lpszPass); + XEngine_Client_TaskSend(lpszClientAddr, tszSDBuffer, nRVLen, XENGINE_AUTH_APP_NETTYPE_HTTP); + } + XLOG_PRINT(xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_WARN, _T("HTTP客户端:%s,请求授权CDKEY成功,APP名:%s,APP版本:%s,授权期限:%s"), lpszClientAddr, st_Authorize.st_AuthAppInfo.tszAppName, st_Authorize.st_AuthAppInfo.tszAppVer, st_Authorize.st_AuthRegInfo.tszLeftTime); + } + else + { + Protocol_Packet_HttpComm(tszSDBuffer, &nSDLen, 404, "Not support protocol"); + XEngine_Client_TaskSend(lpszClientAddr, tszSDBuffer, nSDLen, XENGINE_AUTH_APP_NETTYPE_HTTP); + XLOG_PRINT(xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_WARN, _T("HTTP客户端:%s,请求了一条未知的子协议:%s"), lpszClientAddr, lpszAPIName); + } + return TRUE; +} \ No newline at end of file diff --git a/XEngine_Source/XEngine_APPService/XEngine_AuthorizeService/AuthorizeHTTP_Post/AuthorizeHTTP_CDKey.h b/XEngine_Source/XEngine_APPService/XEngine_AuthorizeService/AuthorizeHTTP_Post/AuthorizeHTTP_CDKey.h new file mode 100644 index 0000000000000000000000000000000000000000..3b46cd2ea60ad8f942c7cd9a3ed30f1984384f35 --- /dev/null +++ b/XEngine_Source/XEngine_APPService/XEngine_AuthorizeService/AuthorizeHTTP_Post/AuthorizeHTTP_CDKey.h @@ -0,0 +1,3 @@ +#pragma once + +BOOL XEngine_AuthorizeHTTP_CDKey(LPCTSTR lpszClientAddr, LPCTSTR lpszAPIName, LPCTSTR lpszMsgBuffer, int nMsgLen, LPCTSTR lpszPass = NULL); \ No newline at end of file diff --git a/XEngine_Source/XEngine_APPService/XEngine_AuthorizeService/Authorize_Hdr.h b/XEngine_Source/XEngine_APPService/XEngine_AuthorizeService/Authorize_Hdr.h index 470a8af239a376c7594a162402d914a88355e042..f29c1dd9d178f37d81e1521966531c3f00975c84 100644 --- a/XEngine_Source/XEngine_APPService/XEngine_AuthorizeService/Authorize_Hdr.h +++ b/XEngine_Source/XEngine_APPService/XEngine_AuthorizeService/Authorize_Hdr.h @@ -38,8 +38,8 @@ using namespace std; #include #include #include -#include -#include +#include +#include #include "../../XAuth_Protocol.h" #include "../../AuthorizeModule_Configure/Config_Define.h" #include "../../AuthorizeModule_Configure/Config_Error.h" @@ -82,6 +82,7 @@ extern XENGINE_FUNCTIONSWITCH st_FunSwitch; #include "AuthorizeHTTP_Post/AuthorizeHTTP_Pass.h" #include "AuthorizeHTTP_Post/AuthorizeHTTP_Switch.h" #include "AuthorizeHTTP_Post/AuthorizeHTTP_Banned.h" +#include "AuthorizeHTTP_Post/AuthorizeHTTP_CDKey.h" #include "AuthorizeHTTP_Get/AuthorizeHTTP_Token.h" #ifdef _WINDOWS @@ -120,5 +121,5 @@ extern XENGINE_FUNCTIONSWITCH st_FunSwitch; #pragma comment(lib,"XEngine_HelpComponents/HelpComponents_Authorize.lib") #pragma comment(lib,"XEngine_RfcComponents/RfcComponents_WSProtocol.lib") #pragma comment(lib,"XEngine_RfcComponents/RfcComponents_HttpServer.lib") -#pragma comment(lib,"XEngine_NetHelp/NetHelp_APIHelp.lib") +#pragma comment(lib,"XEngine_NetHelp/NetHelp_APIClient.lib") #endif \ No newline at end of file diff --git a/XEngine_Source/XEngine_APPService/XEngine_AuthorizeService/Authorize_HttpTask.cpp b/XEngine_Source/XEngine_APPService/XEngine_AuthorizeService/Authorize_HttpTask.cpp index ff46ecb7204bd9ac74b1f8ba3575890473559099..d1d9d831a5d70f20945ff07b742c42d7dff209bf 100644 --- a/XEngine_Source/XEngine_APPService/XEngine_AuthorizeService/Authorize_HttpTask.cpp +++ b/XEngine_Source/XEngine_APPService/XEngine_AuthorizeService/Authorize_HttpTask.cpp @@ -60,8 +60,8 @@ BOOL XEngine_Client_HttpTask(LPCTSTR lpszClientAddr, LPCTSTR lpszMsgBuffer, int AUTHREG_BANNED st_Banned; memset(&st_Banned, '\0', sizeof(AUTHREG_BANNED)); - _tcscpy(st_Banned.tszIPStart, lpszClientAddr); - BaseLib_OperatorIPAddr_SegAddr(st_Banned.tszIPStart); + _tcscpy(st_Banned.tszIPAddr, lpszClientAddr); + BaseLib_OperatorIPAddr_SegAddr(st_Banned.tszIPAddr); //是否在黑名单 if (Database_SQLite_BannedExist(&st_Banned)) { @@ -83,6 +83,7 @@ BOOL XEngine_Client_HttpTask(LPCTSTR lpszClientAddr, LPCTSTR lpszMsgBuffer, int LPCTSTR lpszAPIVerPass = _T("pass"); LPCTSTR lpszAPIVerSwitch = _T("switch"); LPCTSTR lpszAPIVerBanned = _T("banned"); + LPCTSTR lpszAPIVerCDKey = _T("cdkey"); memset(tszAPIType, '\0', sizeof(tszAPIType)); memset(tszAPIVer, '\0', sizeof(tszAPIVer)); @@ -193,6 +194,28 @@ BOOL XEngine_Client_HttpTask(LPCTSTR lpszClientAddr, LPCTSTR lpszMsgBuffer, int } XEngine_AuthorizeHTTP_Banned(lpszClientAddr, tszAPIName, lpszMsgBuffer, nMsgLen); } + else if (0 == _tcsnicmp(lpszAPIVerCDKey, tszAPIVer, _tcslen(lpszAPIVerCDKey))) + { + int nListCount = 0; + TCHAR** pptszList; + RfcComponents_HttpHelp_GetParament(pSt_HTTPParament->tszHttpUri, &pptszList, &nListCount); + if (nListCount > 0) + { + TCHAR tszKeyBuffer[64]; + TCHAR tszValueBuffer[64]; + + memset(tszKeyBuffer, '\0', sizeof(tszKeyBuffer)); + memset(tszValueBuffer, '\0', sizeof(tszValueBuffer)); + + BaseLib_OperatorString_GetKeyValue(pptszList[0], "=", tszKeyBuffer, tszValueBuffer); + XEngine_AuthorizeHTTP_CDKey(lpszClientAddr, tszAPIName, lpszMsgBuffer, nMsgLen, tszValueBuffer); + } + else + { + XEngine_AuthorizeHTTP_CDKey(lpszClientAddr, tszAPIName, lpszMsgBuffer, nMsgLen); + } + BaseLib_OperatorMemory_Free((XPPPMEM)&pptszList, nListCount); + } } else if (0 == _tcsnicmp(lpszMethodGet, pSt_HTTPParament->tszHttpMethod, _tcslen(lpszMethodGet))) { @@ -208,7 +231,7 @@ BOOL XEngine_Client_HttpTask(LPCTSTR lpszClientAddr, LPCTSTR lpszMsgBuffer, int Protocol_Packet_HttpComm(tszSDBuffer, &nSDLen, 400, "request is failed"); XEngine_Client_TaskSend(lpszClientAddr, tszSDBuffer, nSDLen, XENGINE_AUTH_APP_NETTYPE_HTTP); BaseLib_OperatorMemory_Free((XPPPMEM)&pptszList, nListCount); - XLOG_PRINT(xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_INFO, _T("HTTP客户端:%s,发送的URL请求参数不正确:%s"), lpszClientAddr, pSt_HTTPParament->tszHttpUri); + XLOG_PRINT(xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_ERROR, _T("HTTP客户端:%s,发送的URL请求参数不正确:%s"), lpszClientAddr, pSt_HTTPParament->tszHttpUri); return FALSE; } XEngine_AuthorizeHTTP_Token(lpszClientAddr, pptszList, nListCount); diff --git a/XEngine_Source/XEngine_APPService/XEngine_AuthorizeService/Authorize_Net.cpp b/XEngine_Source/XEngine_APPService/XEngine_AuthorizeService/Authorize_Net.cpp index 0f875a997993a18d172ad1d3d66303529658250c..20d59e200a0d38bc420a1c52b72f5fd5f9b9caa4 100644 --- a/XEngine_Source/XEngine_APPService/XEngine_AuthorizeService/Authorize_Net.cpp +++ b/XEngine_Source/XEngine_APPService/XEngine_AuthorizeService/Authorize_Net.cpp @@ -107,7 +107,7 @@ BOOL XEngine_CloseClient(LPCTSTR lpszClientAddr) memset(tszSDBuffer, '\0', MAX_PATH); Protocol_Packet_HttpUserTime(tszSDBuffer, &nSDLen, &st_AuthTime); - APIHelp_HttpRequest_Custom(_T("POST"), st_AuthConfig.st_XLogin.st_PassUrl.tszPassLogout, tszSDBuffer); + APIClient_Http_Request(_T("POST"), st_AuthConfig.st_XLogin.st_PassUrl.tszPassLogout, tszSDBuffer); } else { diff --git a/XEngine_Source/XEngine_APPService/XEngine_AuthorizeService/Authorize_TCPTask.cpp b/XEngine_Source/XEngine_APPService/XEngine_AuthorizeService/Authorize_TCPTask.cpp index dae045dd283be413356c00d490deda16e94b6caf..51f36b1343f3cd173857475ea4debf9e7aeb223d 100644 --- a/XEngine_Source/XEngine_APPService/XEngine_AuthorizeService/Authorize_TCPTask.cpp +++ b/XEngine_Source/XEngine_APPService/XEngine_AuthorizeService/Authorize_TCPTask.cpp @@ -58,8 +58,8 @@ BOOL XEngine_Client_TCPTask(LPCTSTR lpszClientAddr, LPCTSTR lpszMsgBuffer, int n AUTHREG_BANNED st_Banned; memset(&st_Banned, '\0', sizeof(AUTHREG_BANNED)); - _tcscpy(st_Banned.tszIPStart, lpszClientAddr); - BaseLib_OperatorIPAddr_SegAddr(st_Banned.tszIPStart); + _tcscpy(st_Banned.tszIPAddr, lpszClientAddr); + BaseLib_OperatorIPAddr_SegAddr(st_Banned.tszIPAddr); //是否在黑名单 if (Database_SQLite_BannedExist(&st_Banned)) { @@ -105,7 +105,7 @@ BOOL XEngine_Client_TCPTask(LPCTSTR lpszClientAddr, LPCTSTR lpszMsgBuffer, int n int nHTTPLen = 0; TCHAR* ptszMsgBuffer = NULL; Protocol_Packet_HttpUserPass(tszSDBuffer, &nSDLen, &st_AuthProtocol); - APIHelp_HttpRequest_Custom(_T("POST"), st_AuthConfig.st_XLogin.st_PassUrl.tszPassLogin, tszSDBuffer, &nHTTPCode, &ptszMsgBuffer, &nHTTPLen); + APIClient_Http_Request(_T("POST"), st_AuthConfig.st_XLogin.st_PassUrl.tszPassLogin, tszSDBuffer, &nHTTPCode, &ptszMsgBuffer, &nHTTPLen); if (200 != nHTTPCode) { pSt_ProtocolHdr->wReserve = 251; diff --git a/XEngine_Source/XEngine_APPService/XEngine_AuthorizeService/Authorize_Task.cpp b/XEngine_Source/XEngine_APPService/XEngine_AuthorizeService/Authorize_Task.cpp index e424883678d68fedb1db050075aef168b5a6b0fd..61fd8b69f98e0f781f78abc5b86e633bc06d879b 100644 --- a/XEngine_Source/XEngine_APPService/XEngine_AuthorizeService/Authorize_Task.cpp +++ b/XEngine_Source/XEngine_APPService/XEngine_AuthorizeService/Authorize_Task.cpp @@ -31,7 +31,7 @@ void __stdcall XEngine_TaskEvent_Client(LPCSTR lpszUserAddr, LPCSTR lpszUserName memset(tszMsgBuffer, '\0', sizeof(tszMsgBuffer)); Protocol_Packet_HttpUserTime(tszMsgBuffer, &nMsgLen, &st_AuthTime); - APIHelp_HttpRequest_Custom(_T("POST"), st_AuthConfig.st_XLogin.st_PassUrl.tszPassTimeout, tszMsgBuffer); + APIClient_Http_Request(_T("POST"), st_AuthConfig.st_XLogin.st_PassUrl.tszPassTimeout, tszMsgBuffer); } if (XENGINE_AUTH_APP_NETTYPE_HTTP != nNetType) { @@ -76,7 +76,7 @@ void __stdcall XEngine_TaskEvent_Token(XNETHANDLE xhToken, LPVOID lParam) memset(tszSDBuffer, '\0', MAX_PATH); Protocol_Packet_HttpUserTime(tszSDBuffer, &nSDLen, &st_AuthTime); - APIHelp_HttpRequest_Custom(_T("POST"), st_AuthConfig.st_XLogin.st_PassUrl.tszPassLogout, tszSDBuffer); + APIClient_Http_Request(_T("POST"), st_AuthConfig.st_XLogin.st_PassUrl.tszPassLogout, tszSDBuffer); } Database_SQLite_UserLeave(&st_AuthTime); } diff --git a/XEngine_Source/XEngine_APPService/XEngine_AuthorizeService/Makefile b/XEngine_Source/XEngine_APPService/XEngine_AuthorizeService/Makefile index b79e54675c9d2e6bf0353cfb36ee323ffe2a8a86..249db4fa114bfb16f5938307dd260ff36d0dd059 100644 --- a/XEngine_Source/XEngine_APPService/XEngine_AuthorizeService/Makefile +++ b/XEngine_Source/XEngine_APPService/XEngine_AuthorizeService/Makefile @@ -5,12 +5,12 @@ RELEASE = 0 UNICODE = 0 LOADBIN = -L /usr/local/lib/XEngine_Release/XEngine_BaseLib -L /usr/local/lib/XEngine_Release/XEngine_Core -L /usr/local/lib/XEngine_Release/XEngine_HelpComponents -L /usr/local/lib/XEngine_Release/XEngine_RfcComponents -L /usr/local/lib/XEngine_Release/XEngine_NetHelp -L /usr/local/lib/XEngine_Release/XEngine_SystemSdk \ -L ../../AuthorizeModule_Session -L ../../AuthorizeModule_Database -L ../../AuthorizeModule_Protocol -L ../../AuthorizeModule_Configure -L ../../XEngine_ThirdPart/jsoncpp -LIB = -lXEngine_BaseLib -lXEngine_Algorithm -lXEngine_Core -lXEngine_ManagePool -lXEngine_OPenSsl -lHelpComponents_Packets -lHelpComponents_DataBase -lHelpComponents_XLog -lHelpComponents_Authorize -lRfcComponents_WSProtocol -lRfcComponents_HttpServer -lNetHelp_APIHelp -lXEngine_ProcFile -lXEngine_SystemApi \ +LIB = -lXEngine_BaseLib -lXEngine_Algorithm -lXEngine_Core -lXEngine_ManagePool -lXEngine_OPenSsl -lHelpComponents_Packets -lHelpComponents_DataBase -lHelpComponents_XLog -lHelpComponents_Authorize -lRfcComponents_WSProtocol -lRfcComponents_HttpServer -lNetHelp_APIClient -lXEngine_ProcFile -lXEngine_SystemApi \ -lAuthorizeModule_Session -lAuthorizeModule_Database -lAuthorizeModule_Protocol -lAuthorizeModule_Configure -ljsoncpp LIBEX = -ldl -lpthread LOADSO = -Wl,-rpath=./,--disable-new-dtags LIBINCLUDE = Authorize_Config.o Authorize_Net.o Authorize_Task.o Authorize_TCPTask.o Authorize_WSTask.o Authorize_HttpTask.o XEngine_AuthorizeService.o \ - AuthorizeHTTP_Client.o AuthorizeHTTP_Serial.o AuthorizeHTTP_User.o AuthorizeHTTP_Pass.o AuthorizeHTTP_Switch.o AuthorizeHTTP_Banned.o \ + AuthorizeHTTP_Client.o AuthorizeHTTP_Serial.o AuthorizeHTTP_User.o AuthorizeHTTP_Pass.o AuthorizeHTTP_Switch.o AuthorizeHTTP_Banned.o AuthorizeHTTP_CDKey.o\ AuthorizeHTTP_Token.o ifeq ($(OS),Windows_NT) @@ -67,6 +67,8 @@ AuthorizeHTTP_Switch.o:./AuthorizeHTTP_Post/AuthorizeHTTP_Switch.cpp $(CC) $(DEBUG) $(FLAGS) $(UNICODE) ./AuthorizeHTTP_Post/AuthorizeHTTP_Switch.cpp AuthorizeHTTP_Banned.o:./AuthorizeHTTP_Post/AuthorizeHTTP_Banned.cpp $(CC) $(DEBUG) $(FLAGS) $(UNICODE) ./AuthorizeHTTP_Post/AuthorizeHTTP_Banned.cpp +AuthorizeHTTP_CDKey.o:./AuthorizeHTTP_Post/AuthorizeHTTP_CDKey.cpp + $(CC) $(DEBUG) $(FLAGS) $(UNICODE) ./AuthorizeHTTP_Post/AuthorizeHTTP_CDKey.cpp AuthorizeHTTP_Token.o:./AuthorizeHTTP_Get/AuthorizeHTTP_Token.cpp $(CC) $(DEBUG) $(FLAGS) $(UNICODE) ./AuthorizeHTTP_Get/AuthorizeHTTP_Token.cpp diff --git a/XEngine_Source/XEngine_APPService/XEngine_AuthorizeService/XEngine_AuthorizeService.vcxproj b/XEngine_Source/XEngine_APPService/XEngine_AuthorizeService/XEngine_AuthorizeService.vcxproj index 6ddc6b9fe74b7a849a1872d187032c8723628cff..05288f50eca36578c05bde1bc7784be763bdda53 100644 --- a/XEngine_Source/XEngine_APPService/XEngine_AuthorizeService/XEngine_AuthorizeService.vcxproj +++ b/XEngine_Source/XEngine_APPService/XEngine_AuthorizeService/XEngine_AuthorizeService.vcxproj @@ -152,6 +152,7 @@ + @@ -168,6 +169,7 @@ + diff --git a/XEngine_Source/XEngine_APPService/XEngine_AuthorizeService/XEngine_AuthorizeService.vcxproj.filters b/XEngine_Source/XEngine_APPService/XEngine_AuthorizeService/XEngine_AuthorizeService.vcxproj.filters index 5fec005c71304150ec63e9242cb1f956fa8b8ff1..3f3fbff005ec0f0460a296550decf3695c9b5c51 100644 --- a/XEngine_Source/XEngine_APPService/XEngine_AuthorizeService/XEngine_AuthorizeService.vcxproj.filters +++ b/XEngine_Source/XEngine_APPService/XEngine_AuthorizeService/XEngine_AuthorizeService.vcxproj.filters @@ -69,6 +69,9 @@ 源文件\AuthorizeHTTP_Post + + 源文件\AuthorizeHTTP_Post + @@ -113,5 +116,8 @@ 头文件\AuthorizeHTTP_Post + + 头文件\AuthorizeHTTP_Post + \ No newline at end of file