Skip to content

Commit 0f8afb6

Browse files
committed
modify:server handle cdkey serial field and set serial field
1 parent d5dcb67 commit 0f8afb6

File tree

3 files changed

+74
-21
lines changed

3 files changed

+74
-21
lines changed

XEngine_Source/AuthorizeModule_Protocol/AuthorizeModule_Protocol.vcxproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@
7272
<PropertyGroup Label="UserMacros" />
7373
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
7474
<LinkIncremental>true</LinkIncremental>
75-
<IncludePath>$(XEngine_Include);../XEngine_Depend/XEngine_Module/jsoncpp;$(IncludePath)</IncludePath>
75+
<IncludePath>$(XEngine_Include);../XEngine_Depend/XEngine_Module/jsoncpp;..\AuthorizeModule_Protocol;$(IncludePath)</IncludePath>
7676
<LibraryPath>$(XEngine_Lib32);$(LibraryPath)</LibraryPath>
7777
</PropertyGroup>
7878
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">

XEngine_Source/AuthorizeModule_Protocol/Protocol_Parse/Protocol_Parse.cpp

Lines changed: 49 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1104,26 +1104,6 @@ bool CProtocol_Parse::Protocol_Parse_HttpParseCDKey(LPCXSTR lpszMsgBuffer, int n
11041104
}
11051105
//注册信息
11061106
Json::Value st_JsonREGInfo = st_JsonRoot["st_AuthRegInfo"];
1107-
if (!st_JsonREGInfo["nHasTime"].isNull())
1108-
{
1109-
pSt_Authorize->st_AuthRegInfo.nHasTime = (ENUM_AUTHORIZE_MODULE_CDKEY_TYPE)st_JsonREGInfo["nHasTime"].asInt();
1110-
}
1111-
if (!st_JsonREGInfo["enSerialType"].isNull())
1112-
{
1113-
pSt_Authorize->st_AuthRegInfo.enSerialType = (ENUM_AUTHORIZE_MODULE_SERIAL_TYPE)st_JsonREGInfo["enSerialType"].asInt();
1114-
}
1115-
if (!st_JsonREGInfo["enRegType"].isNull())
1116-
{
1117-
pSt_Authorize->st_AuthRegInfo.enRegType = (ENUM_AUTHORIZE_MODULE_CDKEY_TYPE)st_JsonREGInfo["enRegType"].asInt();
1118-
}
1119-
if (!st_JsonREGInfo["enHWType"].isNull())
1120-
{
1121-
pSt_Authorize->st_AuthRegInfo.enHWType = (ENUM_AUTHORIZE_MODULE_HW_TYPE)st_JsonREGInfo["enHWType"].asInt();
1122-
}
1123-
if (!st_JsonREGInfo["enVModeType"].isNull())
1124-
{
1125-
pSt_Authorize->st_AuthRegInfo.enVModeType = (ENUM_AUTHORIZE_MODULE_VERMODE_TYPE)st_JsonREGInfo["enVModeType"].asInt();
1126-
}
11271107
if (!st_JsonREGInfo["tszHardware"].isNull())
11281108
{
11291109
_tcsxcpy(pSt_Authorize->st_AuthRegInfo.tszHardware, st_JsonREGInfo["tszHardware"].asCString());
@@ -1148,6 +1128,55 @@ bool CProtocol_Parse::Protocol_Parse_HttpParseCDKey(LPCXSTR lpszMsgBuffer, int n
11481128
{
11491129
_tcsxcpy(pSt_Authorize->st_AuthRegInfo.tszExpiryTime, st_JsonREGInfo["tszExpiryTime"].asCString());
11501130
}
1131+
if (!st_JsonREGInfo["nHasTime"].isNull())
1132+
{
1133+
pSt_Authorize->st_AuthRegInfo.nHasTime = st_JsonREGInfo["nHasTime"].asInt();
1134+
}
1135+
if (!st_JsonREGInfo["enSerialType"].isNull())
1136+
{
1137+
pSt_Authorize->st_AuthRegInfo.enSerialType = (ENUM_AUTHORIZE_MODULE_SERIAL_TYPE)st_JsonREGInfo["enSerialType"].asInt();
1138+
}
1139+
if (!st_JsonREGInfo["enRegType"].isNull())
1140+
{
1141+
pSt_Authorize->st_AuthRegInfo.enRegType = (ENUM_AUTHORIZE_MODULE_CDKEY_TYPE)st_JsonREGInfo["enRegType"].asInt();
1142+
}
1143+
if (!st_JsonREGInfo["enHWType"].isNull())
1144+
{
1145+
pSt_Authorize->st_AuthRegInfo.enHWType = (ENUM_AUTHORIZE_MODULE_HW_TYPE)st_JsonREGInfo["enHWType"].asInt();
1146+
}
1147+
if (!st_JsonREGInfo["enVModeType"].isNull())
1148+
{
1149+
pSt_Authorize->st_AuthRegInfo.enVModeType = (ENUM_AUTHORIZE_MODULE_VERMODE_TYPE)st_JsonREGInfo["enVModeType"].asInt();
1150+
}
1151+
//临时序列号
1152+
Json::Value st_JsonSerialInfo = st_JsonRoot["st_AuthSerial"];
1153+
if (!st_JsonSerialInfo.isNull())
1154+
{
1155+
if (!st_JsonSerialInfo["tszTimeSerial"].isNull())
1156+
{
1157+
_tcsxcpy(pSt_Authorize->st_AuthSerial.st_TimeLimit.tszTimeSerial, st_JsonSerialInfo["tszTimeSerial"].asCString());
1158+
}
1159+
if (!st_JsonSerialInfo["nTimeCount"].isNull())
1160+
{
1161+
pSt_Authorize->st_AuthSerial.st_TimeLimit.nTimeCount = st_JsonSerialInfo["nTimeCount"].asInt();
1162+
}
1163+
if (!st_JsonSerialInfo["tszTimeSerial"].isNull())
1164+
{
1165+
_tcsxcpy(pSt_Authorize->st_AuthSerial.st_DataLimit.tszDataSerial, st_JsonSerialInfo["tszTimeSerial"].asCString());
1166+
}
1167+
if (!st_JsonSerialInfo["tszDataTime"].isNull())
1168+
{
1169+
_tcsxcpy(pSt_Authorize->st_AuthSerial.st_DataLimit.tszDataTime, st_JsonSerialInfo["tszDataTime"].asCString());
1170+
}
1171+
if (!st_JsonSerialInfo["bTimeAdd"].isNull())
1172+
{
1173+
pSt_Authorize->st_AuthSerial.st_DataLimit.bTimeAdd = st_JsonSerialInfo["bTimeAdd"].asBool();
1174+
}
1175+
if (!st_JsonSerialInfo["tszUNLimitSerial"].isNull())
1176+
{
1177+
_tcsxcpy(pSt_Authorize->st_AuthSerial.st_UNLimit.tszUNLimitSerial, st_JsonSerialInfo["tszUNLimitSerial"].asCString());
1178+
}
1179+
}
11511180
//CDKEY用户信息
11521181
Json::Value st_JsonUserInfo = st_JsonRoot["st_AuthUserInfo"];
11531182
if (!st_JsonUserInfo["tszUserName"].isNull())

XEngine_Source/XEngine_APPService/XEngine_AuthorizeService/AuthorizeHTTP_Post/AuthorizeHTTP_CDKey.cpp

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,30 @@ bool XEngine_AuthorizeHTTP_CDKey(LPCXSTR lpszClientAddr, LPCXSTR lpszAPIName, LP
2626
memset(&st_Authorize, '\0', sizeof(XENGINE_AUTHORIZE_LOCAL));
2727

2828
Protocol_Parse_HttpParseCDKey(lpszMsgBuffer, nMsgLen, &st_Authorize);
29+
30+
if (_tcsxlen(st_Authorize.st_AuthSerial.st_TimeLimit.tszTimeSerial) <= 0)
31+
{
32+
int nSerialCount = 3;
33+
XCHAR** pptszSerialList;
34+
Authorize_Serial_Create(&pptszSerialList, _X("XAUTH"), nSerialCount, 9);
35+
36+
st_Authorize.st_AuthSerial.st_TimeLimit.nTimeCount = 9999;
37+
_tcsxcpy(st_Authorize.st_AuthSerial.st_TimeLimit.tszTimeSerial, pptszSerialList[0]);
38+
39+
st_Authorize.st_AuthSerial.st_DataLimit.bTimeAdd = false;
40+
_tcsxcpy(st_Authorize.st_AuthSerial.st_DataLimit.tszDataSerial, pptszSerialList[1]);
41+
XCHAR tszTimeStr[128] = {};
42+
XENGINE_LIBTIMER st_LibTime = {};
43+
BaseLib_OperatorTime_GetSysTime(&st_LibTime);
44+
st_LibTime.wYear += 1; //一年后过期
45+
BaseLib_OperatorTime_TimeToStr(tszTimeStr, NULL, true, &st_LibTime);
46+
47+
_tcsxcpy(st_Authorize.st_AuthSerial.st_DataLimit.tszDataTime, tszTimeStr);
48+
49+
_tcsxcpy(st_Authorize.st_AuthSerial.st_UNLimit.tszUNLimitSerial, pptszSerialList[2]);
50+
BaseLib_OperatorMemory_Free((XPPPMEM)&pptszSerialList, nSerialCount);
51+
}
52+
2953
if (!Authorize_CDKey_WriteMemory(tszRVBuffer, &nRVLen, &st_Authorize))
3054
{
3155
Protocol_Packet_HttpComm(tszSDBuffer, &nSDLen, 406, "Not Acceptable,write key failed");

0 commit comments

Comments
 (0)