Skip to content

Commit bf428d3

Browse files
committed
added:user online time of count
1 parent 7dc2e98 commit bf428d3

9 files changed

Lines changed: 159 additions & 8 deletions

File tree

‎XEngine_Source/AuthorizeModule_Database/AuthorizeModule_Database.def‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ EXPORTS
1414
DBModule_SQLite_UserSet
1515
DBModule_SQLite_UserList
1616
DBModule_SQLite_UserLogin
17+
DBModule_SQLite_UserTime
1718
DBModule_SQLite_QueryLogin
1819

1920
DBModule_SQLite_SerialInsert
@@ -49,6 +50,7 @@ EXPORTS
4950
DBModule_MySQL_UserSet
5051
DBModule_MySQL_UserList
5152
DBModule_MySQL_UserLogin
53+
DBModule_MySQL_UserTime
5254
DBModule_MySQL_QueryLogin
5355

5456
DBModule_MySQL_SerialInsert

‎XEngine_Source/AuthorizeModule_Database/DBModule_MySQL/DBModule_MySQL.cpp‎

Lines changed: 52 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ bool CDBModule_MySQL::DBModule_MySQL_UserRegister(AUTHREG_USERTABLE* pSt_UserInf
123123
SQLPacket_dwErrorCode = ERROR_AUTHORIZE_MODULE_DATABASE_EXIST;
124124
return false;
125125
}
126-
_xstprintf(tszSQLStatement, _X("INSERT INTO `Authorize_User`(UserName, Password, LeftTime, EmailAddr, HardCode, CardSerialType, PhoneNumber, IDCard, nUserLevel, CreateTime) values('%s','%s','%s','%s','%s','%d',%lld,%lld,%d,NOW())"), pSt_UserInfo->st_UserInfo.tszUserName, pSt_UserInfo->st_UserInfo.tszUserPass, pSt_UserInfo->tszLeftTime, pSt_UserInfo->st_UserInfo.tszEMailAddr, pSt_UserInfo->tszHardCode, pSt_UserInfo->enSerialType, pSt_UserInfo->st_UserInfo.nPhoneNumber, pSt_UserInfo->st_UserInfo.nIDNumber, pSt_UserInfo->st_UserInfo.nUserLevel);
126+
_xstprintf(tszSQLStatement, _X("INSERT INTO `Authorize_User`(UserName, Password, LeftTime, EmailAddr, HardCode, CardSerialType, PhoneNumber, IDCard, nUserLevel, CountTime, CreateTime) values('%s','%s','%s','%s','%s','%d',%lld,%lld,%d,0,NOW())"), pSt_UserInfo->st_UserInfo.tszUserName, pSt_UserInfo->st_UserInfo.tszUserPass, pSt_UserInfo->tszLeftTime, pSt_UserInfo->st_UserInfo.tszEMailAddr, pSt_UserInfo->tszHardCode, pSt_UserInfo->enSerialType, pSt_UserInfo->st_UserInfo.nPhoneNumber, pSt_UserInfo->st_UserInfo.nIDNumber, pSt_UserInfo->st_UserInfo.nUserLevel);
127127
if (!DataBase_MySQL_Execute(xhData, tszSQLStatement))
128128
{
129129
SQLPacket_IsErrorOccur = true;
@@ -202,14 +202,18 @@ bool CDBModule_MySQL::DBModule_MySQL_UserQuery(LPCXSTR lpszUserName, AUTHREG_USE
202202
{
203203
_tcsxcpy(pSt_UserInfo->st_UserInfo.tszUserName, pptszResult[nFliedValue]);
204204
}
205-
206205
//密码
207206
nFliedValue++;
208207
if (NULL != pptszResult[nFliedValue])
209208
{
210209
_tcsxcpy(pSt_UserInfo->st_UserInfo.tszUserPass, pptszResult[nFliedValue]);
211210
}
212-
211+
//TOKEN
212+
nFliedValue++;
213+
if (NULL != pptszResult[nFliedValue])
214+
{
215+
pSt_UserInfo->st_UserInfo.xhToken = _ttxoll(pptszResult[nFliedValue]);
216+
}
213217
//过期时间
214218
nFliedValue++;
215219
if (NULL != pptszResult[nFliedValue])
@@ -258,7 +262,12 @@ bool CDBModule_MySQL::DBModule_MySQL_UserQuery(LPCXSTR lpszUserName, AUTHREG_USE
258262
{
259263
pSt_UserInfo->st_UserInfo.nUserLevel = _ttxoi(pptszResult[nFliedValue]);
260264
}
261-
265+
//总时间
266+
nFliedValue++;
267+
if (NULL != pptszResult[nFliedValue])
268+
{
269+
pSt_UserInfo->nTimeCount = _ttxoll(pptszResult[nFliedValue]);
270+
}
262271
//登录日期
263272
nFliedValue++;
264273
if (NULL != pptszResult[nFliedValue] && _tcsxlen(pptszResult[nFliedValue]) > 0)
@@ -468,7 +477,7 @@ bool CDBModule_MySQL::DBModule_MySQL_UserSet(AUTHREG_USERTABLE* pSt_UserTable)
468477
XCHAR tszSQLStatement[1024]; //SQL语句
469478
memset(tszSQLStatement, '\0', 1024);
470479

471-
_xstprintf(tszSQLStatement, _X("UPDATE `Authorize_User` SET Password = '%s',LeftTime = '%s',EmailAddr = '%s',HardCode = '%s',CardSerialType = '%d',PhoneNumber = '%lld',IDCard = '%lld',nUserLevel = '%d',UPTime = NOW(),CreateTime = '%s' WHERE UserName = '%s'"), pSt_UserTable->st_UserInfo.tszUserPass, pSt_UserTable->tszLeftTime, pSt_UserTable->st_UserInfo.tszEMailAddr, pSt_UserTable->tszHardCode, pSt_UserTable->enSerialType, pSt_UserTable->st_UserInfo.nPhoneNumber, pSt_UserTable->st_UserInfo.nIDNumber, pSt_UserTable->st_UserInfo.nUserLevel/*, pSt_UserTable->st_UserInfo.tszLoginTime*/, pSt_UserTable->st_UserInfo.tszCreateTime, pSt_UserTable->st_UserInfo.tszUserName);
480+
_xstprintf(tszSQLStatement, _X("UPDATE `Authorize_User` SET Password = '%s',Token = '%lld',LeftTime = '%s',EmailAddr = '%s',HardCode = '%s',CardSerialType = '%d',PhoneNumber = '%lld',IDCard = '%lld',nUserLevel = '%d',CountTime = '%lld',CreateTime = '%s' WHERE UserName = '%s'"), pSt_UserTable->st_UserInfo.tszUserPass, pSt_UserTable->st_UserInfo.xhToken, pSt_UserTable->tszLeftTime, pSt_UserTable->st_UserInfo.tszEMailAddr, pSt_UserTable->tszHardCode, pSt_UserTable->enSerialType, pSt_UserTable->st_UserInfo.nPhoneNumber, pSt_UserTable->st_UserInfo.nIDNumber, pSt_UserTable->st_UserInfo.nUserLevel, pSt_UserTable->nTimeCount, pSt_UserTable->st_UserInfo.tszCreateTime, pSt_UserTable->st_UserInfo.tszUserName);
472481

473482
//更新用户剩余时间
474483
if (!DataBase_MySQL_Execute(xhData, tszSQLStatement))
@@ -548,6 +557,9 @@ bool CDBModule_MySQL::DBModule_MySQL_UserList(AUTHREG_USERTABLE*** pppSt_UserInf
548557
//密码
549558
nFliedValue++;
550559
_tcsxcpy((*pppSt_UserInfo)[i]->st_UserInfo.tszUserPass, ppszResult[nFliedValue]);
560+
//TOKEN
561+
nFliedValue++;
562+
(*pppSt_UserInfo)[i]->st_UserInfo.xhToken = _ttxoll(ppszResult[nFliedValue]);
551563
//过期时间
552564
nFliedValue++;
553565
_tcsxcpy((*pppSt_UserInfo)[i]->tszLeftTime, ppszResult[nFliedValue]);
@@ -569,6 +581,9 @@ bool CDBModule_MySQL::DBModule_MySQL_UserList(AUTHREG_USERTABLE*** pppSt_UserInf
569581
//用户级别 -1表示封禁
570582
nFliedValue++;
571583
(*pppSt_UserInfo)[i]->st_UserInfo.nUserLevel = _ttxoi(ppszResult[nFliedValue]);
584+
//总时间
585+
nFliedValue++;
586+
(*pppSt_UserInfo)[i]->nTimeCount = _ttxoll(ppszResult[nFliedValue]);
572587
//登录日期
573588
nFliedValue++;
574589
if (NULL != ppszResult[nFliedValue] && _tcsxlen(ppszResult[nFliedValue]) > 0)
@@ -620,6 +635,38 @@ bool CDBModule_MySQL::DBModule_MySQL_UserLogin(LPCXSTR lpszUserName, LPCXSTR lps
620635
return true;
621636
}
622637
/********************************************************************
638+
函数名称:DBModule_MySQL_UserTime
639+
函数功能:增加用户在线时间
640+
参数.一:lpszUserName
641+
In/Out:In
642+
类型:常量字符指针
643+
可空:N
644+
意思:用户名
645+
参数.二:nTime
646+
In/Out:In
647+
类型:整数型
648+
可空:N
649+
意思:增加的时间
650+
返回值
651+
类型:逻辑型
652+
意思:是否成功
653+
备注:
654+
*********************************************************************/
655+
bool CDBModule_MySQL::DBModule_MySQL_UserTime(LPCXSTR lpszUserName, __int64x nTime)
656+
{
657+
SQLPacket_IsErrorOccur = false;
658+
XCHAR tszSQLStatement[1024] = {};
659+
_xstprintf(tszSQLStatement, _X("UPDATE Authorize_Login SET CountTime = CountTime + %lld WHERE UserName = '%s'"), nTime, lpszUserName);
660+
661+
if (!DataBase_MySQL_Execute(xhData, tszSQLStatement))
662+
{
663+
SQLPacket_IsErrorOccur = true;
664+
SQLPacket_dwErrorCode = ERROR_AUTHORIZE_MODULE_DATABASE_ISFAILED;
665+
return false;
666+
}
667+
return true;
668+
}
669+
/********************************************************************
623670
函数名称:DBModule_MySQL_QueryLogin
624671
函数功能:用户登录记录查询
625672
参数.一:lpszUserName

‎XEngine_Source/AuthorizeModule_Database/DBModule_MySQL/DBModule_MySQL.h‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ class CDBModule_MySQL
3131
bool DBModule_MySQL_UserSet(AUTHREG_USERTABLE* pSt_UserTable); //设置用户信息
3232
bool DBModule_MySQL_UserList(AUTHREG_USERTABLE*** pppSt_UserInfo, int* pInt_ListCount, int nPosStart, int nPosEnd); //获取用户列表
3333
bool DBModule_MySQL_UserLogin(LPCXSTR lpszUserName, LPCXSTR lpszUserAddr);
34+
bool DBModule_MySQL_UserTime(LPCXSTR lpszUserName, __int64x nTime);
3435
bool DBModule_MySQL_QueryLogin(LPCXSTR lpszUserName, LPCXSTR lpszUserAddr);
3536
public:
3637
bool DBModule_MySQL_SerialInsert(AUTHREG_SERIALTABLE* pSt_SerialTable); //插入序列卡

‎XEngine_Source/AuthorizeModule_Database/DBModule_SQLite/DBModule_SQLite.cpp‎

Lines changed: 46 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ bool CDBModule_SQLite::DBModule_SQLite_UserRegister(AUTHREG_USERTABLE* pSt_UserI
126126
SQLPacket_dwErrorCode = ERROR_AUTHORIZE_MODULE_DATABASE_EXIST;
127127
return false;
128128
}
129-
_xstprintf(tszSQLStatement, _X("INSERT INTO Authorize_User(UserName, Password, LeftTime, EmailAddr, HardCode, CardSerialType, PhoneNumber, IDCard, nUserLevel, CreateTime) values('%s','%s','%s','%s','%s','%d',%lld,%lld,%d,datetime('now', 'localtime'))"), pSt_UserInfo->st_UserInfo.tszUserName, pSt_UserInfo->st_UserInfo.tszUserPass, pSt_UserInfo->tszLeftTime, pSt_UserInfo->st_UserInfo.tszEMailAddr, pSt_UserInfo->tszHardCode, pSt_UserInfo->enSerialType, pSt_UserInfo->st_UserInfo.nPhoneNumber, pSt_UserInfo->st_UserInfo.nIDNumber, pSt_UserInfo->st_UserInfo.nUserLevel);
129+
_xstprintf(tszSQLStatement, _X("INSERT INTO Authorize_User(UserName, Password, LeftTime, EmailAddr, HardCode, CardSerialType, PhoneNumber, IDCard, nUserLevel, CountTime, CreateTime) values('%s','%s','%s','%s','%s','%d',%lld,%lld,%d,0,datetime('now', 'localtime'))"), pSt_UserInfo->st_UserInfo.tszUserName, pSt_UserInfo->st_UserInfo.tszUserPass, pSt_UserInfo->tszLeftTime, pSt_UserInfo->st_UserInfo.tszEMailAddr, pSt_UserInfo->tszHardCode, pSt_UserInfo->enSerialType, pSt_UserInfo->st_UserInfo.nPhoneNumber, pSt_UserInfo->st_UserInfo.nIDNumber, pSt_UserInfo->st_UserInfo.nUserLevel);
130130
if (!DataBase_SQLite_Exec(xhData, tszSQLStatement))
131131
{
132132
SQLPacket_IsErrorOccur = true;
@@ -201,6 +201,9 @@ bool CDBModule_SQLite::DBModule_SQLite_UserQuery(LPCXSTR lpszUserName, AUTHREG_U
201201
//密码
202202
nFliedValue++;
203203
_tcsxcpy(pSt_UserInfo->st_UserInfo.tszUserPass, ppszResult[nFliedValue]);
204+
//TOKEN
205+
nFliedValue++;
206+
pSt_UserInfo->st_UserInfo.xhToken = _ttxoll(ppszResult[nFliedValue]);
204207
//过期时间
205208
nFliedValue++;
206209
_tcsxcpy(pSt_UserInfo->tszLeftTime, ppszResult[nFliedValue]);
@@ -222,6 +225,9 @@ bool CDBModule_SQLite::DBModule_SQLite_UserQuery(LPCXSTR lpszUserName, AUTHREG_U
222225
//用户级别 -1表示封禁
223226
nFliedValue++;
224227
pSt_UserInfo->st_UserInfo.nUserLevel = _ttxoi(ppszResult[nFliedValue]);
228+
//总共时间
229+
nFliedValue++;
230+
pSt_UserInfo->nTimeCount = _ttxoll(ppszResult[nFliedValue]);
225231
//登录日期
226232
nFliedValue++;
227233
if (NULL != ppszResult[nFliedValue] && _tcsxlen(ppszResult[nFliedValue]) > 0)
@@ -427,7 +433,7 @@ bool CDBModule_SQLite::DBModule_SQLite_UserSet(AUTHREG_USERTABLE* pSt_UserTable)
427433
XCHAR tszSQLStatement[1024]; //SQL语句
428434
memset(tszSQLStatement, '\0', 1024);
429435

430-
_xstprintf(tszSQLStatement, _X("UPDATE Authorize_User SET Password = '%s',LeftTime = '%s',EmailAddr = '%s',HardCode = '%s',CardSerialType = '%d',PhoneNumber = '%lld',IDCard = '%lld',nUserLevel = '%d',UPTime = '%s',CreateTime = '%s' WHERE UserName = '%s'"), pSt_UserTable->st_UserInfo.tszUserPass, pSt_UserTable->tszLeftTime, pSt_UserTable->st_UserInfo.tszEMailAddr, pSt_UserTable->tszHardCode, pSt_UserTable->enSerialType, pSt_UserTable->st_UserInfo.nPhoneNumber, pSt_UserTable->st_UserInfo.nIDNumber, pSt_UserTable->st_UserInfo.nUserLevel, pSt_UserTable->st_UserInfo.tszLoginTime, pSt_UserTable->st_UserInfo.tszCreateTime, pSt_UserTable->st_UserInfo.tszUserName);
436+
_xstprintf(tszSQLStatement, _X("UPDATE Authorize_User SET Password = '%s',Token = '%lld',LeftTime = '%s',EmailAddr = '%s',HardCode = '%s',CardSerialType = '%d',PhoneNumber = '%lld',IDCard = '%lld',nUserLevel = '%d',CountTime = '%lld',CreateTime = '%s' WHERE UserName = '%s'"), pSt_UserTable->st_UserInfo.tszUserPass, pSt_UserTable->st_UserInfo.xhToken, pSt_UserTable->tszLeftTime, pSt_UserTable->st_UserInfo.tszEMailAddr, pSt_UserTable->tszHardCode, pSt_UserTable->enSerialType, pSt_UserTable->st_UserInfo.nPhoneNumber, pSt_UserTable->st_UserInfo.nIDNumber, pSt_UserTable->st_UserInfo.nUserLevel, pSt_UserTable->nTimeCount, pSt_UserTable->st_UserInfo.tszCreateTime, pSt_UserTable->st_UserInfo.tszUserName);
431437
//更新用户剩余时间
432438
if (!DataBase_SQLite_Exec(xhData, tszSQLStatement))
433439
{
@@ -500,6 +506,9 @@ bool CDBModule_SQLite::DBModule_SQLite_UserList(AUTHREG_USERTABLE*** pppSt_UserI
500506
//密码
501507
nFliedValue++;
502508
_tcsxcpy((*pppSt_UserInfo)[i]->st_UserInfo.tszUserPass, ppszResult[nFliedValue]);
509+
//TOKEN
510+
nFliedValue++;
511+
(*pppSt_UserInfo)[i]->st_UserInfo.xhToken = _ttxoll(ppszResult[nFliedValue]);
503512
//过期时间
504513
nFliedValue++;
505514
_tcsxcpy((*pppSt_UserInfo)[i]->tszLeftTime, ppszResult[nFliedValue]);
@@ -521,6 +530,9 @@ bool CDBModule_SQLite::DBModule_SQLite_UserList(AUTHREG_USERTABLE*** pppSt_UserI
521530
//用户级别 -1表示封禁
522531
nFliedValue++;
523532
(*pppSt_UserInfo)[i]->st_UserInfo.nUserLevel = _ttxoi(ppszResult[nFliedValue]);
533+
//总共时间
534+
nFliedValue++;
535+
(*pppSt_UserInfo)[i]->nTimeCount = _ttxoll(ppszResult[nFliedValue]);
524536
//登录日期
525537
nFliedValue++;
526538
if (NULL != ppszResult[nFliedValue] && _tcsxlen(ppszResult[nFliedValue]) > 0)
@@ -571,6 +583,38 @@ bool CDBModule_SQLite::DBModule_SQLite_UserLogin(LPCXSTR lpszUserName, LPCXSTR l
571583
return true;
572584
}
573585
/********************************************************************
586+
函数名称:DBModule_SQLite_UserTime
587+
函数功能:增加用户在线时间
588+
参数.一:lpszUserName
589+
In/Out:In
590+
类型:常量字符指针
591+
可空:N
592+
意思:用户名
593+
参数.二:nTime
594+
In/Out:In
595+
类型:整数型
596+
可空:N
597+
意思:增加的时间
598+
返回值
599+
类型:逻辑型
600+
意思:是否成功
601+
备注:
602+
*********************************************************************/
603+
bool CDBModule_SQLite::DBModule_SQLite_UserTime(LPCXSTR lpszUserName, __int64x nTime)
604+
{
605+
SQLPacket_IsErrorOccur = false;
606+
607+
XCHAR tszSQLStatement[1024] = {};
608+
_xstprintf(tszSQLStatement, _X("UPDATE Authorize_Login SET CountTime = CountTime + %lld WHERE UserName = '%s'"), nTime, lpszUserName);
609+
if (!DataBase_SQLite_Exec(xhData, tszSQLStatement))
610+
{
611+
SQLPacket_IsErrorOccur = true;
612+
SQLPacket_dwErrorCode = ERROR_AUTHORIZE_MODULE_DATABASE_INSERT;
613+
return false;
614+
}
615+
return true;
616+
}
617+
/********************************************************************
574618
函数名称:DBModule_SQLite_QueryLogin
575619
函数功能:用户登录记录查询
576620
参数.一:lpszUserName

‎XEngine_Source/AuthorizeModule_Database/DBModule_SQLite/DBModule_SQLite.h‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ class CDBModule_SQLite
3131
bool DBModule_SQLite_UserSet(AUTHREG_USERTABLE* pSt_UserTable);
3232
bool DBModule_SQLite_UserList(AUTHREG_USERTABLE*** pppSt_UserInfo, int* pInt_ListCount, int nPosStart, int nPosEnd);
3333
bool DBModule_SQLite_UserLogin(LPCXSTR lpszUserName, LPCXSTR lpszUserAddr);
34+
bool DBModule_SQLite_UserTime(LPCXSTR lpszUserName, __int64x nTime);
3435
bool DBModule_SQLite_QueryLogin(LPCXSTR lpszUserName, LPCXSTR lpszUserAddr);
3536
public:
3637
bool DBModule_SQLite_SerialInsert(AUTHREG_SERIALTABLE* pSt_SerialTable); //插入序列卡

‎XEngine_Source/AuthorizeModule_Database/Database_Define.h‎

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,25 @@ extern "C" bool DBModule_SQLite_UserList(AUTHREG_USERTABLE*** pppSt_UserInfo, in
193193
*********************************************************************/
194194
extern "C" bool DBModule_SQLite_UserLogin(LPCXSTR lpszUserName, LPCXSTR lpszUserAddr);
195195
/********************************************************************
196+
函数名称:DBModule_SQLite_UserTime
197+
函数功能:增加用户在线时间
198+
参数.一:lpszUserName
199+
In/Out:In
200+
类型:常量字符指针
201+
可空:N
202+
意思:用户名
203+
参数.二:nTime
204+
In/Out:In
205+
类型:整数型
206+
可空:N
207+
意思:增加的时间
208+
返回值
209+
类型:逻辑型
210+
意思:是否成功
211+
备注:
212+
*********************************************************************/
213+
extern "C" bool DBModule_SQLite_UserTime(LPCXSTR lpszUserName, __int64x nTime);
214+
/********************************************************************
196215
函数名称:DBModule_SQLite_QueryLogin
197216
函数功能:用户登录记录查询
198217
参数.一:lpszUserName
@@ -1032,6 +1051,25 @@ extern "C" bool DBModule_MySQL_AnnouncementList(AUTHREG_ANNOUNCEMENT*** ppppSt_A
10321051
*********************************************************************/
10331052
extern "C" bool DBModule_MySQL_UserLogin(LPCXSTR lpszUserName, LPCXSTR lpszUserAddr);
10341053
/********************************************************************
1054+
函数名称:DBModule_MySQL_UserTime
1055+
函数功能:增加用户在线时间
1056+
参数.一:lpszUserName
1057+
In/Out:In
1058+
类型:常量字符指针
1059+
可空:N
1060+
意思:用户名
1061+
参数.二:nTime
1062+
In/Out:In
1063+
类型:整数型
1064+
可空:N
1065+
意思:增加的时间
1066+
返回值
1067+
类型:逻辑型
1068+
意思:是否成功
1069+
备注:
1070+
*********************************************************************/
1071+
extern "C" bool DBModule_MySQL_UserTime(LPCXSTR lpszUserName, __int64x nTime);
1072+
/********************************************************************
10351073
函数名称:DBModule_MySQL_QueryLogin
10361074
函数功能:用户登录记录查询
10371075
参数.一:lpszUserName

‎XEngine_Source/AuthorizeModule_Database/pch.cpp‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,10 @@ extern "C" bool DBModule_SQLite_UserLogin(LPCXSTR lpszUserName, LPCXSTR lpszUser
7171
{
7272
return m_DBSQLite.DBModule_SQLite_UserLogin(lpszUserName, lpszUserAddr);
7373
}
74+
extern "C" bool DBModule_SQLite_UserTime(LPCXSTR lpszUserName, __int64x nTime)
75+
{
76+
return m_DBSQLite.DBModule_SQLite_UserTime(lpszUserName, nTime);
77+
}
7478
extern "C" bool DBModule_SQLite_QueryLogin(LPCXSTR lpszUserName, LPCXSTR lpszUserAddr)
7579
{
7680
return m_DBSQLite.DBModule_SQLite_QueryLogin(lpszUserName, lpszUserAddr);
@@ -262,6 +266,10 @@ extern "C" bool DBModule_MySQL_UserLogin(LPCXSTR lpszUserName, LPCXSTR lpszUserA
262266
{
263267
return m_DBMySQL.DBModule_MySQL_UserLogin(lpszUserName, lpszUserAddr);
264268
}
269+
extern "C" bool DBModule_MySQL_UserTime(LPCXSTR lpszUserName, __int64x nTime)
270+
{
271+
return m_DBMySQL.DBModule_MySQL_UserTime(lpszUserName, nTime);
272+
}
265273
extern "C" bool DBModule_MySQL_QueryLogin(LPCXSTR lpszUserName, LPCXSTR lpszUserAddr)
266274
{
267275
return m_DBMySQL.DBModule_MySQL_QueryLogin(lpszUserName, lpszUserAddr);

‎XEngine_Source/XAuth_Protocol.h‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,8 @@ typedef struct tag_AuthReg_UserTable
8181
XCHAR tszADDInfo[2048]; //附加信息
8282
XCHAR tszLeftTime[64]; //剩余日期
8383
XCHAR tszHardCode[32]; //硬件码
84-
ENUM_VERIFICATION_MODULE_SERIAL_TYPE enSerialType; //充值卡类型
84+
__int64u nTimeCount; //在线时间
85+
ENUM_VERIFICATION_MODULE_SERIAL_TYPE enSerialType; //充值卡类型
8586
ENUM_PROTOCOLDEVICE_TYPE enDeviceType; //设备类型
8687
}AUTHREG_USERTABLE, * LPAUTHREG_USERTABLE;
8788
//注册序列号表

‎XEngine_Source/XEngine_APPService/XEngine_AuthorizeService/Authorize_Net.cpp‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,15 @@ bool XEngine_CloseClient(LPCXSTR lpszClientAddr, int nLeaveType)
161161
_tcsxcpy(st_AuthTime.tszLeftTime, st_NETClient.tszLeftTime);
162162
_tcsxcpy(st_AuthTime.tszUserAddr, st_NETClient.tszClientAddr);
163163

164+
if (0 == st_AuthConfig.st_XSql.nDBType)
165+
{
166+
DBModule_SQLite_UserTime(st_NETClient.st_UserTable.st_UserInfo.tszUserName, st_NETClient.nOnlineTime);
167+
}
168+
else
169+
{
170+
DBModule_MySQL_UserTime(st_NETClient.st_UserTable.st_UserInfo.tszUserName, st_NETClient.nOnlineTime);
171+
}
172+
164173
if (st_AuthConfig.st_XLogin.bPassAuth)
165174
{
166175
int nSDLen = 0;

0 commit comments

Comments
 (0)