|
|
@@ -2,6 +2,7 @@
|
|
|
#define RVC_MOD_COMM_ENTITY_SETTINGS_HPP_
|
|
|
|
|
|
#include "SpBase.h"
|
|
|
+#include "fileutil.h"
|
|
|
|
|
|
namespace SP
|
|
|
{
|
|
|
@@ -73,7 +74,44 @@ static inline bool IsUsingSubBranchServerConfig(CEntityBase* pEntity)
|
|
|
return (enable == 1);
|
|
|
}
|
|
|
|
|
|
+/*!
|
|
|
+ * @brief 先从集中配置中读取信息,如果没有,再从本地cfg实体配置文件读取信息
|
|
|
+ * section 使用实体名称,从 GetFunction()->GetEntityName中获取
|
|
|
+ * @param[in] retStrValue 不为空,则说明读的时字符串,retDwValue 不为空说明读取的是数字,不能都为空,也不能都不为空
|
|
|
+ * @param[out]
|
|
|
+ * @return :
|
|
|
+ */
|
|
|
+static inline ErrorCodeEnum ReadConfigFromCenterAfterCfg(
|
|
|
+ CEntityBase* pEntity, LPCTSTR lpcszKey, CSimpleStringA* retStrValue, int* retValue)
|
|
|
+{
|
|
|
+ ErrorCodeEnum result(Error_Succeed);
|
|
|
+ if ((lpcszKey == NULL || strlen(lpcszKey) == 0)
|
|
|
+ || (retStrValue == NULL && retValue == NULL)
|
|
|
+ || (retStrValue != NULL && retValue != NULL)
|
|
|
+ || pEntity == NULL) {
|
|
|
|
|
|
+ return Error_Param;
|
|
|
+ }
|
|
|
+
|
|
|
+ CSmartPointer<IConfigInfo> pCenConfig;
|
|
|
+ result = pEntity->GetFunction()->OpenConfig(Config_CenterSetting, pCenConfig);
|
|
|
+ if (retStrValue != NULL) {
|
|
|
+ result = pCenConfig->ReadConfigValue(pEntity->GetEntityName(), lpcszKey, *retStrValue);
|
|
|
+ if (retStrValue->IsNullOrEmpty()) {
|
|
|
+ CSmartPointer<IConfigInfo> pCfgConfig;
|
|
|
+ result = pEntity->GetFunction()->OpenConfig(Config_Software, pCfgConfig);
|
|
|
+ result = pCfgConfig->ReadConfigValue(pEntity->GetEntityName(), lpcszKey, *retStrValue);
|
|
|
+ }
|
|
|
+ } else if(retValue != NULL) {
|
|
|
+ result = pCenConfig->ReadConfigValueInt(pEntity->GetEntityName(), lpcszKey, *retValue);
|
|
|
+ if (*retValue == 0) {
|
|
|
+ CSmartPointer<IConfigInfo> pCfgConfig;
|
|
|
+ result = pEntity->GetFunction()->OpenConfig(Config_Software, pCfgConfig);
|
|
|
+ result = pCfgConfig->ReadConfigValueInt(pEntity->GetEntityName(), lpcszKey, *retValue);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return result;
|
|
|
+}
|
|
|
|
|
|
|
|
|
} //namespace Settings
|