Skip to content

Commit b4571eb

Browse files
committed
modify:merge qr configure to main configure
1 parent 18349cc commit b4571eb

File tree

11 files changed

+23
-130
lines changed

11 files changed

+23
-130
lines changed

XEngine_Source/XEngine.sln

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,10 @@ EndProject
9191
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "XEngine_APIModulePhone", "XEngine_DBDepend\XEngine_PhoneData\Source\C\XEngine_APIModulePhone\XEngine_APIModulePhone.vcxproj", "{A13B72E7-FC40-4A27-81C3-26DF3C8F4C0A}"
9292
EndProject
9393
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "XEngine_APIServiceApp", "XEngine_ServiceApp\XEngine_APIServiceApp\XEngine_APIServiceApp.vcxproj", "{096BEF37-4AF6-490D-868B-6306D3E251E7}"
94+
ProjectSection(ProjectDependencies) = postProject
95+
{F1736B3F-03A2-4FC7-B045-A12BA8D724FB} = {F1736B3F-03A2-4FC7-B045-A12BA8D724FB}
96+
{F54F152C-594F-4465-A44E-2DB915B39760} = {F54F152C-594F-4465-A44E-2DB915B39760}
97+
EndProjectSection
9498
EndProject
9599
Global
96100
GlobalSection(SolutionConfigurationPlatforms) = preSolution

XEngine_Source/XEngine_ModuleConfigure/ModuleConfig_Define.h

Lines changed: 8 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,14 @@ typedef struct
7171
}st_XPlugin;
7272
struct
7373
{
74-
XCHAR tszConfigQRCode[MAX_PATH]; //二维码配置地址
74+
//二维码模型库
75+
struct
76+
{
77+
XCHAR tszModelDetect[MAX_PATH];
78+
XCHAR tszModelSr[MAX_PATH];
79+
XCHAR tszProtoDetect[MAX_PATH];
80+
XCHAR tszProtoSr[MAX_PATH];
81+
}st_ConfigQRCodec;
7582
XCHAR tszConfigDeamon[MAX_PATH]; //守护进程配置文件
7683
XCHAR tszConfigHTTPMime[MAX_PATH]; //HTTPMINE配置文件
7784
XCHAR tszConfigHTTPCode[MAX_PATH]; //HTTP状态配置文件
@@ -120,14 +127,6 @@ typedef struct
120127
list<string>* pStl_ListVer;
121128
}st_XVer;
122129
}XENGINE_SERVICECONFIG;
123-
//二维码模型库
124-
typedef struct
125-
{
126-
XCHAR tszModelDetect[MAX_PATH];
127-
XCHAR tszModelSr[MAX_PATH];
128-
XCHAR tszProtoDetect[MAX_PATH];
129-
XCHAR tszProtoSr[MAX_PATH];
130-
}XENGINE_QRCODECONFIG;
131130
//插件
132131
typedef struct
133132
{
@@ -214,25 +213,6 @@ extern "C" bool ModuleConfigure_Json_File(LPCXSTR lpszConfigFile, XENGINE_SERVIC
214213
*********************************************************************/
215214
extern "C" bool ModuleConfigure_Json_VersionFile(LPCXSTR lpszConfigFile, XENGINE_SERVICECONFIG* pSt_ServerConfig);
216215
/********************************************************************
217-
函数名称:ModuleConfigure_Json_QRCodeFile
218-
函数功能:读取JSON配置文件
219-
参数.一:lpszConfigFile
220-
In/Out:In
221-
类型:常量字符指针
222-
可空:N
223-
意思:输入要读取的配置文件
224-
参数.二:pSt_QRCodeConfig
225-
In/Out:Out
226-
类型:数据结构指针
227-
可空:N
228-
意思:输出二维码配置信息
229-
返回值
230-
类型:逻辑型
231-
意思:是否成功
232-
备注:
233-
*********************************************************************/
234-
extern "C" bool ModuleConfigure_Json_QRCodeFile(LPCXSTR lpszConfigFile, XENGINE_QRCODECONFIG* pSt_QRCodeConfig);
235-
/********************************************************************
236216
函数名称:ModuleConfigure_Json_PluginFile
237217
函数功能:读取JSON配置文件
238218
参数.一:lpszConfigFile

XEngine_Source/XEngine_ModuleConfigure/ModuleConfigure_Json/ModuleConfigure_Json.cpp

Lines changed: 6 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,12 @@ bool CModuleConfigure_Json::ModuleConfigure_Json_File(LPCXSTR lpszConfigFile, XE
172172
return false;
173173
}
174174
Json::Value st_JsonXConfig = st_JsonRoot["XConfig"];
175-
_tcsxcpy(pSt_ServerConfig->st_XConfig.tszConfigQRCode, st_JsonXConfig["tszConfigQRCode"].asCString());
175+
176+
_tcsxcpy(pSt_ServerConfig->st_XConfig.st_ConfigQRCodec.tszModelDetect, st_JsonXConfig["st_ConfigQRCode"]["tszModelDetect"].asCString());
177+
_tcsxcpy(pSt_ServerConfig->st_XConfig.st_ConfigQRCodec.tszModelSr, st_JsonXConfig["st_ConfigQRCode"]["tszModelSr"].asCString());
178+
_tcsxcpy(pSt_ServerConfig->st_XConfig.st_ConfigQRCodec.tszProtoDetect, st_JsonXConfig["st_ConfigQRCode"]["tszProtoDetect"].asCString());
179+
_tcsxcpy(pSt_ServerConfig->st_XConfig.st_ConfigQRCodec.tszProtoSr, st_JsonXConfig["st_ConfigQRCode"]["tszProtoSr"].asCString());
180+
176181
_tcsxcpy(pSt_ServerConfig->st_XConfig.tszConfigDeamon, st_JsonXConfig["tszConfigDeamon"].asCString());
177182
_tcsxcpy(pSt_ServerConfig->st_XConfig.tszConfigHTTPMime, st_JsonXConfig["tszConfigHTTPMime"].asCString());
178183
_tcsxcpy(pSt_ServerConfig->st_XConfig.tszConfigHTTPCode, st_JsonXConfig["tszConfigHTTPCode"].asCString());
@@ -318,71 +323,6 @@ bool CModuleConfigure_Json::ModuleConfigure_Json_VersionFile(LPCXSTR lpszConfigF
318323
return true;
319324
}
320325
/********************************************************************
321-
函数名称:ModuleConfigure_Json_QRCodeFile
322-
函数功能:读取JSON配置文件
323-
参数.一:lpszConfigFile
324-
In/Out:In
325-
类型:常量字符指针
326-
可空:N
327-
意思:输入要读取的配置文件
328-
参数.二:pSt_QRCodeConfig
329-
In/Out:Out
330-
类型:数据结构指针
331-
可空:N
332-
意思:输出二维码配置信息
333-
返回值
334-
类型:逻辑型
335-
意思:是否成功
336-
备注:
337-
*********************************************************************/
338-
bool CModuleConfigure_Json::ModuleConfigure_Json_QRCodeFile(LPCXSTR lpszConfigFile, XENGINE_QRCODECONFIG* pSt_QRCodeConfig)
339-
{
340-
Config_IsErrorOccur = false;
341-
342-
if ((NULL == lpszConfigFile) || (NULL == pSt_QRCodeConfig))
343-
{
344-
Config_IsErrorOccur = true;
345-
Config_dwErrorCode = ERROR_MODULE_CONFIGURE_JSON_PARAMENT;
346-
return false;
347-
}
348-
Json::Value st_JsonRoot;
349-
JSONCPP_STRING st_JsonError;
350-
Json::CharReaderBuilder st_JsonBuilder;
351-
//读取配置文件所有内容到缓冲区
352-
FILE* pSt_File = _xtfopen(lpszConfigFile, _X("rb"));
353-
if (NULL == pSt_File)
354-
{
355-
Config_IsErrorOccur = true;
356-
Config_dwErrorCode = ERROR_MODULE_CONFIGURE_JSON_OPENFILE;
357-
return false;
358-
}
359-
size_t nCount = 0;
360-
XCHAR tszMsgBuffer[4096];
361-
while (1)
362-
{
363-
size_t nRet = fread(tszMsgBuffer + nCount, 1, 2048, pSt_File);
364-
if (nRet <= 0)
365-
{
366-
break;
367-
}
368-
nCount += nRet;
369-
}
370-
fclose(pSt_File);
371-
//开始解析配置文件
372-
std::unique_ptr<Json::CharReader> const pSt_JsonReader(st_JsonBuilder.newCharReader());
373-
if (!pSt_JsonReader->parse(tszMsgBuffer, tszMsgBuffer + nCount, &st_JsonRoot, &st_JsonError))
374-
{
375-
Config_IsErrorOccur = true;
376-
Config_dwErrorCode = ERROR_MODULE_CONFIGURE_JSON_PARSE;
377-
return false;
378-
}
379-
_tcsxcpy(pSt_QRCodeConfig->tszModelDetect, st_JsonRoot["tszModelDetect"].asCString());
380-
_tcsxcpy(pSt_QRCodeConfig->tszModelSr, st_JsonRoot["tszModelSr"].asCString());
381-
_tcsxcpy(pSt_QRCodeConfig->tszProtoDetect, st_JsonRoot["tszProtoDetect"].asCString());
382-
_tcsxcpy(pSt_QRCodeConfig->tszProtoSr, st_JsonRoot["tszProtoSr"].asCString());
383-
return true;
384-
}
385-
/********************************************************************
386326
函数名称:ModuleConfigure_Json_PluginFile
387327
函数功能:读取JSON配置文件
388328
参数.一:lpszConfigFile

XEngine_Source/XEngine_ModuleConfigure/ModuleConfigure_Json/ModuleConfigure_Json.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ class CModuleConfigure_Json
1919
public:
2020
bool ModuleConfigure_Json_File(LPCXSTR lpszConfigFile, XENGINE_SERVICECONFIG* pSt_ServerConfig);
2121
bool ModuleConfigure_Json_VersionFile(LPCXSTR lpszConfigFile, XENGINE_SERVICECONFIG* pSt_ServerConfig);
22-
bool ModuleConfigure_Json_QRCodeFile(LPCXSTR lpszConfigFile, XENGINE_QRCODECONFIG* pSt_QRCodeConfig);
2322
bool ModuleConfigure_Json_PluginFile(LPCXSTR lpszConfigFile, XENGINE_PLUGINCONFIG* pSt_PluginConfig);
2423
bool ModuleConfigure_Json_DeamonList(LPCXSTR lpszConfigFile, XENGINE_DEAMONAPPLIST* pSt_AppConfig);
2524
protected:

XEngine_Source/XEngine_ModuleConfigure/XEngine_ModuleConfigure.def

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,5 @@ EXPORTS
55

66
ModuleConfigure_Json_File
77
ModuleConfigure_Json_VersionFile
8-
ModuleConfigure_Json_QRCodeFile
98
ModuleConfigure_Json_PluginFile
109
ModuleConfigure_Json_DeamonList

XEngine_Source/XEngine_ModuleConfigure/pch.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,6 @@ extern "C" bool ModuleConfigure_Json_VersionFile(LPCXSTR lpszConfigFile, XENGINE
3737
{
3838
return m_ConfigJson.ModuleConfigure_Json_VersionFile(lpszConfigFile, pSt_ServerConfig);
3939
}
40-
extern "C" bool ModuleConfigure_Json_QRCodeFile(LPCXSTR lpszConfigFile, XENGINE_QRCODECONFIG * pSt_QRCodeConfig)
41-
{
42-
return m_ConfigJson.ModuleConfigure_Json_QRCodeFile(lpszConfigFile, pSt_QRCodeConfig);
43-
}
4440
extern "C" bool ModuleConfigure_Json_PluginFile(LPCXSTR lpszConfigFile, XENGINE_PLUGINCONFIG * pSt_PluginConfig)
4541
{
4642
return m_ConfigJson.ModuleConfigure_Json_PluginFile(lpszConfigFile, pSt_PluginConfig);

XEngine_Source/XEngine_ServiceApp/XEngine_HttpApp/XEngine_Configure.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,10 @@ bool XEngine_Configure_Parament(int argc, char** argv)
6060
st_ServiceConfig.st_XReload.bReload = true;
6161
st_ServiceConfig.st_XReload.byCode = _ttxoi(argv[++i]);
6262
}
63+
else if (0 == _tcsxcmp("-db", argv[i]))
64+
{
65+
st_ServiceConfig.st_XSql.bEnable = _ttxoi(argv[++i]);
66+
}
6367
else if (0 == _tcsxcmp("-t", argv[i]))
6468
{
6569
bIsTest = true;

XEngine_Source/XEngine_ServiceApp/XEngine_HttpApp/XEngine_Hdr.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,6 @@ extern XHANDLE xhHTTPPool;
139139
extern unique_ptr<thread> pSTDThread_Deamon;
140140
//配置文件
141141
extern XENGINE_SERVICECONFIG st_ServiceConfig;
142-
extern XENGINE_QRCODECONFIG st_QRCodeConfig;
143142
extern XENGINE_PLUGINCONFIG st_PluginLibConfig;
144143
extern XENGINE_PLUGINCONFIG st_PluginLuaConfig;
145144
extern XENGINE_DEAMONAPPLIST st_DeamonAppConfig;

XEngine_Source/XEngine_ServiceApp/XEngine_HttpApp/XEngine_HttpApp.cpp

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ XHANDLE xhHTTPPool = NULL;
2323
unique_ptr<thread> pSTDThread_Deamon = NULL;
2424
//配置文件
2525
XENGINE_SERVICECONFIG st_ServiceConfig;
26-
XENGINE_QRCODECONFIG st_QRCodeConfig;
2726
XENGINE_PLUGINCONFIG st_PluginLibConfig;
2827
XENGINE_PLUGINCONFIG st_PluginLuaConfig;
2928
XENGINE_DEAMONAPPLIST st_DeamonAppConfig;
@@ -148,7 +147,6 @@ int main(int argc, char** argv)
148147

149148
memset(&st_XLogConfig, '\0', sizeof(HELPCOMPONENTS_XLOG_CONFIGURE));
150149
memset(&st_ServiceConfig, '\0', sizeof(XENGINE_SERVICECONFIG));
151-
memset(&st_QRCodeConfig, '\0', sizeof(XENGINE_QRCODECONFIG));
152150
memset(&st_PluginLibConfig, '\0', sizeof(XENGINE_PLUGINCONFIG));
153151
memset(&st_PluginLuaConfig, '\0', sizeof(XENGINE_PLUGINCONFIG));
154152

@@ -217,17 +215,6 @@ int main(int argc, char** argv)
217215
#endif
218216
}
219217

220-
#if (1 == _XENGINE_BUILD_SWITCH_QRDECODEC)
221-
if (!ModuleConfigure_Json_QRCodeFile(st_ServiceConfig.st_XConfig.tszConfigQRCode, &st_QRCodeConfig))
222-
{
223-
XLOG_PRINT(xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_ERROR, _X("启动服务中,初始化二维码配置文件失败,错误:%lX"), ModuleConfigure_GetLastError());
224-
goto XENGINE_SERVICEAPP_EXIT;
225-
}
226-
XLOG_PRINT(xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_INFO, _X("启动服务中,初始化二维码配置文件:%s 成功"), st_ServiceConfig.st_XConfig.tszConfigQRCode);
227-
#else
228-
XLOG_PRINT(xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_WARN, _X("启动服务中,初始化二维码配置文件:%s 失败,因为QR编译脚本被关闭"), st_ServiceConfig.st_XConfig.tszConfigQRCode);
229-
#endif
230-
231218
if (st_ServiceConfig.st_XImageText.bEnable)
232219
{
233220
if (!ModuleHelp_ImageGet_TextInit(st_ServiceConfig.st_XImageText.tszImagePath, st_ServiceConfig.st_XImageText.tszImageLanguage))

XEngine_Source/XEngine_ServiceApp/XEngine_HttpApp/XEngine_TaskGet/TaskGet_Reload.cpp

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -93,21 +93,6 @@ bool HTTPTask_TaskGet_Reload(LPCXSTR lpszClientAddr, LPCXSTR lpszOPCode)
9393
XEngine_Network_Send(lpszClientAddr, tszMsgBuffer, nMsgLen);
9494
XLOG_PRINT(xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_INFO, _X("HTTP客户端:%s,请求重载插件成功,Lib插件:%d 个,Lua插件:%d 个"), lpszClientAddr, st_PluginLibConfig.pStl_ListPlugin->size(), st_PluginLuaConfig.pStl_ListPlugin->size());
9595
}
96-
else if (2 == _ttxoi(lpszOPCode))
97-
{
98-
memset(&st_QRCodeConfig, '\0', sizeof(XENGINE_QRCODECONFIG));
99-
if (!ModuleConfigure_Json_QRCodeFile(st_ServiceConfig.st_XConfig.tszConfigQRCode, &st_QRCodeConfig))
100-
{
101-
st_HDRParam.nHttpCode = 500;
102-
HttpProtocol_Server_SendMsgEx(xhHTTPPacket, tszMsgBuffer, &nMsgLen, &st_HDRParam);
103-
XEngine_Network_Send(lpszClientAddr, tszMsgBuffer, nMsgLen);
104-
XLOG_PRINT(xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_ERROR, _X("HTTP客户端:%s,请求重载二维码配置文件失败,错误:%lX"), lpszClientAddr, ModuleConfigure_GetLastError());
105-
return false;
106-
}
107-
HttpProtocol_Server_SendMsgEx(xhHTTPPacket, tszMsgBuffer, &nMsgLen, &st_HDRParam);
108-
XEngine_Network_Send(lpszClientAddr, tszMsgBuffer, nMsgLen);
109-
XLOG_PRINT(xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_INFO, _X("HTTP客户端:%s,请求重载二维码配置文件:%s 成功"), lpszClientAddr, st_ServiceConfig.st_XConfig.tszConfigQRCode);
110-
}
11196
else if (3 == _ttxoi(lpszOPCode))
11297
{
11398
st_DeamonAppConfig.stl_ListDeamonApp.clear();

0 commit comments

Comments
 (0)