瀏覽代碼

#IQBX #comment upload 编译成功

80374374 1 年之前
父節點
當前提交
62ca4a32da
共有 4 個文件被更改,包括 63 次插入96 次删除
  1. 5 6
      Module/mod_upload/CMakeLists.txt
  2. 1 1
      Module/mod_upload/UploadFSM.cpp
  3. 2 4
      Module/mod_upload/UploadFSM.h
  4. 55 85
      Module/mod_upload/upload.cpp

+ 5 - 6
Module/mod_upload/CMakeLists.txt

@@ -15,8 +15,6 @@ set(${MODULE_PREFIX}_SRCS
 	UploadFSM.h
 	XZip.cpp
 	XZip.h
-	XZipZilb.cpp
-	XZipZilb.h
 	)
 else()
 set(${MODULE_PREFIX}_SRCS
@@ -38,14 +36,13 @@ endif(WIN32)
 set(MOD_VERSION_STRING "1.0.1-dev4")
 add_module_libraries(${MODULE_PREFIX} ${MODULE_NAME} ${MOD_VERSION_STRING})
 #附加包含的目录
-
-
-
+message(STATUS "CONAN_INCLUDE_DIRS_ZLIB ${CONAN_INCLUDE_DIRS_ZLIB}")
 target_include_directories(${MODULE_NAME} PRIVATE
 	${RVC_FRAMEWORK_INCLUDES_DIR}
 	${CONAN_INCLUDE_DIRS_ZLIB}
 	${CONAN_RVCFRAMEWORK_ROOT}/include
 	${CONAN_INCLUDE_DIRS_JSONCPP}
+	${OTHER_LIB_PLATFORM_BASE_DIR}/libfilecryption
 )
 
 # 添加实体需要依赖的其他共享库(包括系统库):连接器包含的包
@@ -55,7 +52,9 @@ target_link_directories(${MODULE_NAME} PRIVATE
 target_link_directories(${MODULE_NAME} PRIVATE ${CONAN_LIB_DIRS_JSONCPP})
 
 set(${MODULE_PREFIX}_LIBS ${MODULE_BASE_ALL_LIBS} ${CONAN_PKG_LIBS_ZLIB})
-
+if(MSVC)
+	set(${MODULE_PREFIX}_LIBS ${${MODULE_PREFIX}_LIBS} libfilecryption)
+endif(MSVC)
 target_link_libraries(${MODULE_NAME} ${${MODULE_PREFIX}_LIBS})  
 
 deploy_module(${MODULE_PREFIX} ${MODULE_NAME})

+ 1 - 1
Module/mod_upload/UploadFSM.cpp

@@ -8,7 +8,7 @@
 #include <cstdlib>
 #include <ctime> 
 #include "EventCode.h"
-#include "..\..\other\libfilecryption\filecryption.h"
+#include "filecryption.h"
 
 #else
 #include <thread>

+ 2 - 4
Module/mod_upload/UploadFSM.h

@@ -5,18 +5,16 @@
 #include "SpFSM.h"
 #include "SpSecureClient.h"
 
-
 #include "upload.h"
 #include <list>
 #include "IHttpFunc.h"
 #ifdef RVC_OS_WIN
-#include "json.h"
 #include <io.h>
-#else 
+#endif
 #include "SpUtility.h"
 #include "json/json.h"
 #include <map>
-#endif
+
 
 #define USER_EVT_JMP_DISABLE	EVT_USER+1
 #define USER_EVT_JMP_ENABLE		EVT_USER+2

+ 55 - 85
Module/mod_upload/upload.cpp

@@ -2,7 +2,6 @@
 #include "SpBase.h"
 #include "SpIni.h"
 #include "upload.h"
-
 #include <memutil.h>
 #include <fileutil.h>
 #include <array.h>
@@ -73,110 +72,82 @@ using namespace std;
 //	return Error;
 //}
 
-//static upload_dir_t *upload_dir_load(IEntityFunction *pEntityFunc, IConfigInfo *pConfig, const char *dir, int default_silent_time, int default_limitation)
+//static upload_dir_t *upload_dir_load(IEntityFunction *pEntityFunc, const char *dir, int default_silent_time, int default_limitation)
 //{
 //	upload_dir_t *updir = ZALLOC_T(upload_dir_t);
 //	if (updir) 
 //	{
-//		char tmp[MAX_PATH];
 //		CSimpleStringA str;
-//		ErrorCodeEnum Error = pConfig->ReadConfigValue(dir, "Path", str);
-//		if (Error == Error_Succeed) 
-//		{
+//
+//		std::map<std::string, std::string> macroPath;
+//		macroPath["SysLog"] = "$(SysLog)"; //TODO
+//		macroPath["InterLog"] = "$(InterLog)"; //TODO
+//		macroPath["Photo"] = "$(UploadPhoto)";
+//		macroPath["Video"] = "$(UploadVideo)";
+//		macroPath["SilverlightDebug"] = "$(slv)"; //TODO
+//		macroPath["Debug"] = "$(dbg)";
+//
+//		std::map<std::string, bool> macroZip;
+//		macroZip["SysLog"] = true;
+//		macroZip["InterLog"] = true;
+//		macroZip["Photo"] = false;
+//		macroZip["Video"] = false;
+//		macroZip["SilverlightDebug"] = true;
+//		macroZip["Debug"] = true;
+//
+//		ErrorCodeEnum Error = Error_Succeed;
+//		if (macroPath.find(dir) == macroPath.end()) {
+//			return updir;
+//		}
+//		str = macroPath[dir].c_str();
+//
+//		INIT_LIST_HEAD(&updir->candidate_list);
+//		CSimpleStringA strRealPath;
+//		Error = expand_dir(pEntityFunc, (LPCSTR)str, strRealPath);
+//		if (Error == Error_Succeed) {
 //			INIT_LIST_HEAD(&updir->candidate_list);
-//			CSimpleStringA strRealPath;
-//			Error = expand_dir(pEntityFunc, (LPCSTR)str, strRealPath);
-//			if (Error == Error_Succeed) 
-//			{
-//				INIT_LIST_HEAD(&updir->candidate_list);
-//				updir->name = _strdup(dir);
-//				updir->path = _strdup(strRealPath);
-//				pConfig->ReadConfigValue(dir, "MovePath", str);
-//				if (str.GetLength() > 0) 
-//				{
-//					updir->flags |= UPLOAD_FLAG_MOVEPATH;
-//					Error = expand_dir(pEntityFunc, str, strRealPath);
-//					if (Error != Error_Succeed) 
-//					{
-//						return NULL;
-//					}
-//					updir->movepath = _strdup(strRealPath);
-//				} else {
-//					pConfig->ReadConfigValue(dir, "AutoDelete", str);
-//					if (_stricmp(str, "true") == 0) 
-//					{
-//						updir->flags |= UPLOAD_FLAG_AUTODELETE;
-//					}
-//				}
-//				pConfig->ReadConfigValue(dir, "Zip", str);
+//			updir->name = _strdup(dir);
+//			updir->path = _strdup(strRealPath);
 //
-//				if (_stricmp(str, "true") == 0) 
-//				{
-//					updir->flags |= UPLOAD_FLAG_ZIP;
-//				}
-//				pConfig->ReadConfigValueInt(dir, "SilentTime", updir->silent_time);
-//				if (updir->silent_time == 0) 
-//				{
-//					updir->silent_time = default_silent_time;
+//			if (strcmp(dir, "Video") == 0) {
+//				str = "$(LocalVideo)";
+//				updir->flags |= UPLOAD_FLAG_MOVEPATH;
+//				Error = expand_dir(pEntityFunc, str, strRealPath);
+//				if (Error != Error_Succeed) {
+//					return NULL;
 //				}
-//				pConfig->ReadConfigValueInt(dir, "Limitation", updir->child_count_limitation);
-//				if (updir->child_count_limitation == 0) 
-//				{
-//					updir->child_count_limitation = default_limitation;
-//				}
-//				updir->fileCount=0;//初始化设置为0
-//				updir->fileLenSum=0;//初始化设置为0
+//				updir->movepath = _strdup(strRealPath);
+//			} else {
+//				updir->flags |= UPLOAD_FLAG_AUTODELETE;
+//			}
+//			if (macroZip.find(dir) != macroZip.end() && macroZip[dir]) {
+//				updir->flags |= UPLOAD_FLAG_ZIP;
 //			}
+//			if (strcmp("SilverlightDebug", dir) == 0 || strcmp("Debug", dir) == 0) {
+//				updir->silent_time = 86400;
+//			} else {
+//				updir->silent_time = 900;
+//			}
+//			updir->child_count_limitation = default_limitation;
+//			updir->fileCount = 0;//初始化设置为0
+//			updir->fileLenSum = 0;//初始化设置为0
 //		}
 //	}
 //	return updir;
 //}
 
 //初始化要上传的文件夹配置
-//int upload_create(struct list_head *list, IEntityFunction *pEntityFunc, IConfigInfo *pConfig, CSimpleStringA &checkDir)
+//int upload_create(struct list_head *list, IEntityFunction *pEntityFunc, CSimpleStringA &checkDir)
 //{
 //	assert(list_empty(list));
-//	assert(pConfig);
-//	ErrorCodeEnum Error;
 //	char type_str[1024];
 //	char *p, *c;
-//	int default_silent_time = 0;
-//	int default_limitation = 0;
-//
-//	{
-//		CSimpleStringA str;
-//		Error = pConfig->ReadConfigValue("Main", "Type", str);
-//		if (Error == Error_Succeed) 
-//		{
-//			strcpy(type_str, (LPCSTR)str);
-//		} 
-//		else 
-//		{
-//			return Error;
-//		}
-//		//添加lwt,读入日结时需要检查的文件类型参数
-//		/**交易受限功能代码废弃
-//		Error = pConfig->ReadConfigValue("Main", "CheckType", str);
-//		if (Error == Error_Succeed) 
-//		{
-//			checkDir = str;
-//		} 
-//		else 
-//		{
-//			return Error;
-//		}
-//		*/
-//		pConfig->ReadConfigValueInt("Main", "SilentTime", default_silent_time);//间隔时间
-//		pConfig->ReadConfigValueInt("Main", "Limitation", default_limitation);//最大文件数
-//		if (default_limitation == 0) 
-//		{
-//			default_limitation = INT_MAX;
-//		}
-//	}
+//	int default_silent_time = 3600;
+//	int default_limitation = 256;
+//	strcpy(type_str, "SysLog,InterLog,Photo,Video,SilverlightDebug,Debug");
 //	p = strtok_s(type_str, ", ", &c);
-//	
 //	while (p) {
-//		upload_dir_t *dir = upload_dir_load(pEntityFunc, pConfig, p, default_silent_time, default_limitation);
+//		upload_dir_t *dir = upload_dir_load(pEntityFunc, p, default_silent_time, default_limitation);
 //		if (!dir) 
 //		{
 //			return Error_Unexpect;
@@ -185,7 +156,6 @@ using namespace std;
 //		list_add_tail(&dir->entry, list);
 //		p = strtok_s(NULL, ", ", &c);
 //	}
-//
 //	return 0;
 //}