Skip to content

Commit 15f7fee

Browse files
committed
fixed:XEngine_APPHelp_RangeFile function not length return ture
modify:pathkey to buckkey
1 parent 9fdd000 commit 15f7fee

File tree

12 files changed

+46
-26
lines changed

12 files changed

+46
-26
lines changed

XEngine_Source/StorageModule_Protocol/Protocol_Packet/Protocol_StoragePacket.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ BOOL CProtocol_StoragePacket::Protocol_StoragePacket_QueryFile(TCHAR* ptszMsgBuf
7777
{
7878
Json::Value st_JsonObject;
7979

80-
st_JsonObject["tszPathKey"] = (*pppSt_DBFile)[i]->tszPathKey;
80+
st_JsonObject["tszBuckKey"] = (*pppSt_DBFile)[i]->tszBuckKey;
8181
st_JsonObject["tszFilePath"] = (*pppSt_DBFile)[i]->st_ProtocolFile.tszFilePath;
8282
st_JsonObject["tszFileName"] = (*pppSt_DBFile)[i]->st_ProtocolFile.tszFileName;
8383
st_JsonObject["tszFileUser"] = (*pppSt_DBFile)[i]->st_ProtocolFile.tszFileUser;

XEngine_Source/StorageModule_Protocol/Protocol_Parse/Protocol_StorageParse.cpp

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -115,9 +115,9 @@ BOOL CProtocol_StorageParse::Protocol_StorageParse_QueryFile(LPCTSTR lpszMsgBuff
115115
}
116116
if (NULL != ptszPathKey)
117117
{
118-
if (!st_JsonRoot["tszPathKey"].isNull())
118+
if (!st_JsonRoot["lpszBuckKey"].isNull())
119119
{
120-
_tcscpy(ptszPathKey, st_JsonRoot["tszPathKey"].asCString());
120+
_tcscpy(ptszPathKey, st_JsonRoot["lpszBuckKey"].asCString());
121121
}
122122
}
123123
return TRUE;
@@ -184,10 +184,6 @@ BOOL CProtocol_StorageParse::Protocol_StorageParse_ReportFile(LPCTSTR lpszMsgBuf
184184
(*pppSt_DBFile)[i]->st_ProtocolFile.nFileSize = st_JsonArray[i]["nFileSize"].asInt64();
185185
}
186186

187-
if (!st_JsonArray[i]["tszPathKey"].isNull())
188-
{
189-
_tcscpy((*pppSt_DBFile)[i]->tszPathKey, st_JsonArray[i]["tszPathKey"].asCString());
190-
}
191187
if (!st_JsonArray[i]["tszFileName"].isNull())
192188
{
193189
_tcscpy((*pppSt_DBFile)[i]->st_ProtocolFile.tszFileName, st_JsonArray[i]["tszFileName"].asCString());

XEngine_Source/XEngine_StorageApp/StorageApp_UPLoader.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ BOOL XEngine_Task_HttpUPLoader(LPCTSTR lpszClientAddr, LPCTSTR lpszMsgBuffer, in
193193
BOOL bRet = TRUE;
194194
if (0 != st_ServiceCfg.st_XSql.nSQLType)
195195
{
196-
_tcscpy(st_ProtocolFile.tszPathKey, st_StorageBucket.tszBuckKey);
196+
_tcscpy(st_ProtocolFile.tszBuckKey, st_StorageBucket.tszBuckKey);
197197
if (1 == st_ServiceCfg.st_XSql.nSQLType)
198198
{
199199
bRet = XStorage_MySql_FileInsert(&st_ProtocolFile);

XEngine_Source/XEngine_StorageApp/Storage_APPHelp/Storage_APPHelp.cpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,14 @@ BOOL XEngine_APPHelp_RangeFile(LPCTSTR lpszClientAddr, int* pInt_SPos, int* pInt
166166
}
167167
else
168168
{
169-
RfcComponents_HttpHelp_GetField(&pptszListHdr, nHdrCount, lpszLengthStr, tszFieldStr);
169+
if (STORAGE_NETTYPE_HTTPDOWNLOAD == nSDType)
170+
{
171+
return FALSE;
172+
}
173+
if (!RfcComponents_HttpHelp_GetField(&pptszListHdr, nHdrCount, lpszLengthStr, tszFieldStr))
174+
{
175+
return FALSE;
176+
}
170177
*pInt_Count = _ttoi64(tszFieldStr);
171178
XLOG_PRINT(xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_INFO, _T("%s:%s,请求内容是新的数据,大小:%lld"), lpszClientType, lpszClientAddr, *pInt_Count);
172179
}

XEngine_Source/XEngine_StorageApp/Storage_APPTask/Storage_TaskManage.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,19 +175,21 @@ BOOL XEngine_Task_Manage(LPCTSTR lpszAPIName, LPCTSTR lpszClientAddr, LPCTSTR lp
175175
int nMsgLen = 10240;
176176
TCHAR tszFileName[MAX_PATH];
177177
TCHAR tszFileHash[MAX_PATH];
178+
TCHAR tszBucketKey[128];
178179
TCHAR tszTimeStart[128];
179180
TCHAR tszTimeEnd[128];
180181
TCHAR tszMsgBuffer[10240];
181182

182183
memset(tszFileName, '\0', MAX_PATH);
183184
memset(tszFileHash, '\0', MAX_PATH);
185+
memset(tszBucketKey, '\0', sizeof(tszBucketKey));
184186
memset(tszTimeStart, '\0', sizeof(tszTimeStart));
185187
memset(tszTimeEnd, '\0', sizeof(tszTimeEnd));
186188
memset(tszMsgBuffer, '\0', sizeof(tszMsgBuffer));
187189

188190
int nListCount = 0;
189191
XSTORAGECORE_DBFILE** ppSt_ListFile;
190-
Protocol_StorageParse_QueryFile(lpszMsgBuffer, tszTimeStart, tszTimeEnd, tszFileHash);
192+
Protocol_StorageParse_QueryFile(lpszMsgBuffer, tszTimeStart, tszTimeEnd, tszBucketKey, tszFileName, tszFileHash);
191193

192194
if (0 == st_ServiceCfg.st_XSql.nSQLType)
193195
{

XEngine_Source/XEngine_StorageApp/Storage_APPTask/Storage_TaskPass.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,22 +20,24 @@ BOOL XEngine_Task_Pass(LPCTSTR lpszAPIName, LPCTSTR lpszClientAddr, LPCTSTR lpsz
2020
memset(tszClientAddr, '\0', sizeof(tszClientAddr));
2121
memset(&st_DBFile, '\0', sizeof(XSTORAGECORE_DBFILE));
2222

23-
Protocol_StorageParse_ProxyNotify(lpszMsgBuffer, nMsgLen, tszClientAddr, st_DBFile.st_ProtocolFile.tszFileName, st_DBFile.st_ProtocolFile.tszFileHash, &st_DBFile.st_ProtocolFile.nFileSize);
23+
Protocol_StorageParse_ProxyNotify(lpszMsgBuffer, nMsgLen, tszClientAddr, st_DBFile.tszBuckKey, st_DBFile.st_ProtocolFile.tszFileName, st_DBFile.st_ProtocolFile.tszFileHash, &st_DBFile.st_ProtocolFile.nFileSize);
2424
XEngine_Net_SendMsg(lpszClientAddr, tszSDBuffer, nSDLen, STORAGE_NETTYPE_HTTPCENTER);
25-
XLOG_PRINT(xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_INFO, _T("业务客户端:%s,请求的上传文件通知协议成功,文件名:%s,大小:%d"), lpszClientAddr, st_DBFile.st_ProtocolFile.tszFileName, st_DBFile.st_ProtocolFile.nFileSize);
25+
XLOG_PRINT(xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_INFO, _T("业务客户端:%s,请求的上传文件通知协议成功,Bucket:%s,文件名:%s,大小:%d"), lpszClientAddr, st_DBFile.tszBuckKey, st_DBFile.st_ProtocolFile.tszFileName, st_DBFile.st_ProtocolFile.nFileSize);
2626
}
2727
else if (0 == _tcsnicmp(XENGINE_STORAGE_APP_METHOD_DLFILE, lpszAPIName, _tcslen(XENGINE_STORAGE_APP_METHOD_DLFILE)))
2828
{
2929
__int64x nFileSize = 0;
30+
TCHAR tszPathKey[MAX_PATH];
3031
TCHAR tszFileName[MAX_PATH];
3132
TCHAR tszFileHash[MAX_PATH];
3233
TCHAR tszClientAddr[128];
3334

35+
memset(tszPathKey, '\0', MAX_PATH);
3436
memset(tszFileName, '\0', MAX_PATH);
3537
memset(tszFileHash, '\0', MAX_PATH);
3638
memset(tszClientAddr, '\0', sizeof(tszClientAddr));
3739

38-
Protocol_StorageParse_ProxyNotify(lpszMsgBuffer, nMsgLen, tszClientAddr, tszFileName, tszFileHash, &nFileSize);
40+
Protocol_StorageParse_ProxyNotify(lpszMsgBuffer, nMsgLen, tszClientAddr, tszPathKey, tszFileName, tszFileHash, &nFileSize);
3941

4042
RfcComponents_HttpServer_SendMsgEx(xhCenterHttp, tszSDBuffer, &nSDLen, &st_HDRParam);
4143
XEngine_Net_SendMsg(lpszClientAddr, tszSDBuffer, nSDLen, STORAGE_NETTYPE_HTTPCENTER);

XEngine_Source/XEngine_StorageComponents/XStorage_SQLPacket/SQLPacket_Define.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
typedef struct tag_XStorageCore_DBFILE
1717
{
1818
XENGINE_PROTOCOL_FILE st_ProtocolFile;
19-
CHAR tszPathKey[MAX_PATH]; //路径的关键字
19+
CHAR tszBuckKey[MAX_PATH]; //路径的关键字
2020
CHAR tszTableName[64]; //日期表名称,插入:表示自定义插入日期表,获取:表示导出这个文件所属日期表
2121
}XSTORAGECORE_DBFILE, *LPXSTORAGECORE_DBFILE;
2222
typedef struct tag_XStorageCore_UserInfo

XEngine_Source/XEngine_StorageComponents/XStorage_SQLPacket/XStorage_MySql/XStorage_MySql.cpp

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ BOOL CXStorage_MySql::XStorage_MySql_FileInsert(XSTORAGECORE_DBFILE *pSt_DBFile)
154154
_stprintf_s(tszTableName, _T("%04d%02d"), st_LibTimer.wYear, st_LibTimer.wMonth);
155155
}
156156
//插入语句
157-
_stprintf_s(tszSQLStatement, _T("INSERT INTO `%s` (PathKey,FilePath,FileName,FileHash,FileUser,FileSize,FileTime) VALUES('%s','%s','%s','%s','%s',%lld,now())"), tszTableName, pSt_DBFile->tszPathKey, pSt_DBFile->st_ProtocolFile.tszFilePath, pSt_DBFile->st_ProtocolFile.tszFileName, pSt_DBFile->st_ProtocolFile.tszFileHash, pSt_DBFile->st_ProtocolFile.tszFileUser, pSt_DBFile->st_ProtocolFile.nFileSize);
157+
_stprintf_s(tszSQLStatement, _T("INSERT INTO `%s` (BuckKey,FilePath,FileName,FileHash,FileUser,FileSize,FileTime) VALUES('%s','%s','%s','%s','%s',%lld,now())"), tszTableName, pSt_DBFile->tszBuckKey, pSt_DBFile->st_ProtocolFile.tszFilePath, pSt_DBFile->st_ProtocolFile.tszFileName, pSt_DBFile->st_ProtocolFile.tszFileHash, pSt_DBFile->st_ProtocolFile.tszFileUser, pSt_DBFile->st_ProtocolFile.nFileSize);
158158
if (!DataBase_MySQL_Execute(xhDBSQL, tszSQLStatement))
159159
{
160160
XStorage_IsErrorOccur = TRUE;
@@ -258,7 +258,7 @@ BOOL CXStorage_MySql::XStorage_MySql_FileDelete(LPCTSTR lpszFile, LPCTSTR lpszHa
258258
意思:是否成功
259259
备注:返回假可能没有查找到,这条记录不存在.参数lpszFile和lpszHash不能全为空
260260
*********************************************************************/
261-
BOOL CXStorage_MySql::XStorage_MySql_FileQuery(XSTORAGECORE_DBFILE*** pppSt_ListFile, int* pInt_ListCount, LPCTSTR lpszTimeStart /* = NULL */, LPCTSTR lpszTimeEnd /* = NULL */, LPCTSTR lpszFile /* = NULL */, LPCTSTR lpszHash /* = NULL */)
261+
BOOL CXStorage_MySql::XStorage_MySql_FileQuery(XSTORAGECORE_DBFILE*** pppSt_ListFile, int* pInt_ListCount, LPCTSTR lpszTimeStart /* = NULL */, LPCTSTR lpszTimeEnd /* = NULL */, LPCTSTR lpszBuckKey /* = NULL */, LPCTSTR lpszFile /* = NULL */, LPCTSTR lpszHash /* = NULL */)
262262
{
263263
XStorage_IsErrorOccur = FALSE;
264264

@@ -308,7 +308,6 @@ BOOL CXStorage_MySql::XStorage_MySql_FileQuery(XSTORAGECORE_DBFILE*** pppSt_List
308308
__int64u dwLineResult = 0;
309309
__int64u dwFieldResult = 0;
310310
XNETHANDLE xhResult;
311-
312311
memset(tszSQLStatement, '\0', sizeof(tszSQLStatement));
313312
//判断查询方式
314313
if (NULL != lpszFile)
@@ -355,7 +354,7 @@ BOOL CXStorage_MySql::XStorage_MySql_FileQuery(XSTORAGECORE_DBFILE*** pppSt_List
355354

356355
if (NULL != pptszFileResult[1])
357356
{
358-
_tcscpy(st_DBFile.tszPathKey, pptszFileResult[1]);
357+
_tcscpy(st_DBFile.tszBuckKey, pptszFileResult[1]);
359358
}
360359
if (NULL != pptszFileResult[2])
361360
{
@@ -464,7 +463,7 @@ BOOL CXStorage_MySql::XStorage_MySql_FileQueryForTable(XSTORAGECORE_DBFILE*** pp
464463

465464
if (NULL != pptszFileResult[1])
466465
{
467-
_tcscpy((*pppSt_ListFile)[i]->tszPathKey, pptszFileResult[1]);
466+
_tcscpy((*pppSt_ListFile)[i]->tszBuckKey, pptszFileResult[1]);
468467
}
469468
if (NULL != pptszFileResult[2])
470469
{
@@ -594,7 +593,7 @@ BOOL CXStorage_MySql::XStorage_MySql_FileQueryForHash(XSTORAGECORE_DBFILE* pSt_F
594593

595594
if (NULL != pptszFileResult[1])
596595
{
597-
_tcscpy(pSt_FileInfo->tszPathKey, pptszFileResult[1]);
596+
_tcscpy(pSt_FileInfo->tszBuckKey, pptszFileResult[1]);
598597
}
599598
if (NULL != pptszFileResult[2])
600599
{
@@ -675,7 +674,7 @@ BOOL CXStorage_MySql::XStorage_MySql_CreateTable()
675674

676675
_stprintf_s(tszSQLQuery, _T("CREATE TABLE IF NOT EXISTS `%s` ("
677676
"`ID` int NOT NULL AUTO_INCREMENT COMMENT 'ID序号',"
678-
"`PathKey` varchar(260) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '路径KEY',"
677+
"`BuckKey` varchar(260) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '路径KEY',"
679678
"`FilePath` varchar(260) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '文件路径',"
680679
"`FileName` varchar(260) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '文件名称',"
681680
"`FileHash` varchar(260) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '文件HASH',"

XEngine_Source/XEngine_StorageComponents/XStorage_SQLPacket/XStorage_MySql/XStorage_MySql.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ class CXStorage_MySql
2121
BOOL XStorage_MySql_Destory();
2222
BOOL XStorage_MySql_FileInsert(XSTORAGECORE_DBFILE *pSt_DBManage);
2323
BOOL XStorage_MySql_FileDelete(LPCTSTR lpszFile = NULL, LPCTSTR lpszHash = NULL);
24-
BOOL XStorage_MySql_FileQuery(XSTORAGECORE_DBFILE*** pppSt_ListFile, int* pInt_ListCount, LPCTSTR lpszTimeStart = NULL, LPCTSTR lpszTimeEnd = NULL, LPCTSTR lpszFile = NULL, LPCTSTR lpszHash = NULL);
24+
BOOL XStorage_MySql_FileQuery(XSTORAGECORE_DBFILE*** pppSt_ListFile, int* pInt_ListCount, LPCTSTR lpszTimeStart = NULL, LPCTSTR lpszTimeEnd = NULL, LPCTSTR lpszBuckKey = NULL, LPCTSTR lpszFile = NULL, LPCTSTR lpszHash = NULL);
2525
BOOL XStorage_MySql_FileQueryForTable(XSTORAGECORE_DBFILE*** pppSt_ListFile, int* pInt_ListCount, LPCTSTR lpszTableName);
2626
BOOL XStorage_MySql_FileQueryForHash(XSTORAGECORE_DBFILE* pSt_FileInfo, LPCTSTR lpszFileHash, LPCTSTR lpszUser = NULL, LPCTSTR lpszTimeStart = NULL, LPCTSTR lpszTimeEnd = NULL);
2727
protected:

XEngine_Source/XEngine_StorageComponents/XStorage_SQLPacket/XStorage_SQLPacket.vcxproj

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,7 @@
171171
<ClInclude Include="SQLPacket_Define.h" />
172172
<ClInclude Include="SQLPacket_Error.h" />
173173
<ClInclude Include="XStorage_MySql\XStorage_MySql.h" />
174+
<ClInclude Include="XStorage_SQLHelp\XStorage_SQLHelp.h" />
174175
<ClInclude Include="XStorage_SQLite\XStorage_SQLite.h" />
175176
</ItemGroup>
176177
<ItemGroup>
@@ -182,6 +183,7 @@
182183
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Create</PrecompiledHeader>
183184
</ClCompile>
184185
<ClCompile Include="XStorage_MySql\XStorage_MySql.cpp" />
186+
<ClCompile Include="XStorage_SQLHelp\XStorage_SQLHelp.cpp" />
185187
<ClCompile Include="XStorage_SQLite\XStorage_SQLite.cpp" />
186188
</ItemGroup>
187189
<ItemGroup>

0 commit comments

Comments
 (0)