|
@@ -11,6 +11,7 @@
|
|
|
#include "SpUtility.h"
|
|
|
#include "comm.h"
|
|
|
#include "PinPad_client_g.h"
|
|
|
+#include <codecvt>
|
|
|
using namespace PinPad;
|
|
|
|
|
|
#ifdef RVC_OS_WIN
|
|
@@ -152,6 +153,19 @@ struct TimeSynTask : ITaskSp
|
|
|
SP::Module::Restful::FulfillRequestJsonBody(&config, timeSyncReq);
|
|
|
RestfulClient client = RestfulClient::getInstance();
|
|
|
|
|
|
+ if (m_fsm->containsChinese(m_fsm->GetmAccessAuthHost().GetData()))
|
|
|
+ {
|
|
|
+ result.statusCode = 6;
|
|
|
+ m_fsm->AuthLogWarn(result, m_fsm->GetmAccessAuthHost().GetData(), "获取会话密钥");
|
|
|
+ DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM)("TimeSynTask Connect Failed.");
|
|
|
+
|
|
|
+ FSMEvent* pEvent = new FSMEvent(CAccessAuthFSM::Event_ReqTokenCancel);
|
|
|
+ pEvent->param1 = AccessAuthorization_UserErrorCode_ACS_FAIL;
|
|
|
+ m_fsm->PostEventFIFO(pEvent);
|
|
|
+
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
std::string test;
|
|
|
test = config.GetRequestUri();
|
|
|
|
|
@@ -238,6 +252,18 @@ struct UpdateWKTask : ITaskSp
|
|
|
}
|
|
|
CSystemStaticInfo si;
|
|
|
m_fsm->GetEntityBase()->GetFunction()->GetSystemStaticInfo(si);
|
|
|
+
|
|
|
+ if (m_fsm->containsChinese(m_fsm->GetmAccessAuthHost().GetData()))
|
|
|
+ {
|
|
|
+ m_fsm->doWarnMsg(ERROR_ACCESSAUTH_CONNECT_ACS,
|
|
|
+ GetOutPutStr("%s", "连接总行ACS准入服务失败(UpdateWKTask).").c_str(), true);
|
|
|
+ DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM).setResultCode("RTA5212")("UpdateWKTask Connect Failed.");
|
|
|
+
|
|
|
+ FSMEvent* pEvent = new FSMEvent(CAccessAuthFSM::Event_ReqTokenCancel);
|
|
|
+ m_fsm->PostEventFIFO(pEvent);
|
|
|
+
|
|
|
+ return;
|
|
|
+ }
|
|
|
|
|
|
struct UpdateWKReq
|
|
|
{
|
|
@@ -413,6 +439,18 @@ struct GetTokenTask : ITaskSp
|
|
|
HttpClientRequestConfig config(HttpRequestMethod::POST, m_fsm->GetmAccessAuthHost().GetData(), &SpGetToken);
|
|
|
config.SetChildUri("/api/v3/access");
|
|
|
|
|
|
+ if (m_fsm->containsChinese(m_fsm->GetmAccessAuthHost().GetData()))
|
|
|
+ {
|
|
|
+ result.statusCode = 6;
|
|
|
+ m_fsm->AuthLogWarn(result, m_fsm->GetmAccessAuthHost().GetData(), "获取准入token");
|
|
|
+ DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM)("GetTokenTask Connect Failed.");
|
|
|
+
|
|
|
+ FSMEvent* pEvent = new FSMEvent(CAccessAuthFSM::Event_ReqTokenFail);
|
|
|
+ m_fsm->PostEventFIFO(pEvent);
|
|
|
+
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
getTokenReqJson.installVersion = getTokenReq.installVersion;
|
|
|
getTokenReqJson.terminalCharacter = getTokenReq.terminalCharacter;
|
|
|
getTokenReqJson.terminalNo = getTokenReq.terminalNo;
|
|
@@ -507,6 +545,50 @@ struct InitDeviceTask :public ITaskSp
|
|
|
};
|
|
|
|
|
|
|
|
|
+#ifdef RVC_OS_LINUX
|
|
|
+bool isChineseChar(const char* p) {
|
|
|
+ if (*p >= 0x80) { // ASCII字符的最高位是0,非ASCII字符的最高位是1
|
|
|
+ char firstByte = *p;
|
|
|
+ if ((firstByte & 0xE0) == 0xE0) { // 3字节的UTF-8字符
|
|
|
+ return (*++p >= 0x80) && (*++p >= 0x80) && // 第二、三个字节都是10xxxxxx
|
|
|
+ ((firstByte & 0xFE) != 0xFE) && // 排除0xFE00~0xFEFF的特殊区域
|
|
|
+ ((*(unsigned char*)p - 0x80) <= 0xBF);
|
|
|
+ }
|
|
|
+ else if ((firstByte & 0xC0) == 0xC0) { // 2字节的UTF-8字符
|
|
|
+ return (*++p >= 0x80) && // 第二个字节是10xxxxxx
|
|
|
+ ((firstByte & 0xFE) != 0xFE);
|
|
|
+ }
|
|
|
+}
|
|
|
+ return false;
|
|
|
+}
|
|
|
+
|
|
|
+bool CAccessAuthFSM::containsChinese(const std::string& str) {
|
|
|
+ for (size_t i = 0; i < str.size(); i++) {
|
|
|
+ if (isChineseChar(str.c_str() + i)) {
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return false;
|
|
|
+}
|
|
|
+#else
|
|
|
+bool CAccessAuthFSM::containsChinese(const std::string& str) {
|
|
|
+ int len = MultiByteToWideChar(CP_ACP, 0, str.c_str(), -1, NULL, 0);
|
|
|
+ wchar_t* wideStr = new wchar_t[len];
|
|
|
+ MultiByteToWideChar(CP_ACP, 0, str.c_str(), -1, wideStr, len);
|
|
|
+
|
|
|
+ for (int i = 0; i < len; i++) {
|
|
|
+ if (wideStr[i] >= 0x4E00 && wideStr[i] <= 0x9FFF) {
|
|
|
+ delete[] wideStr;
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ delete[] wideStr;
|
|
|
+ return false;
|
|
|
+}
|
|
|
+#endif // RVC_OS_WIN
|
|
|
+
|
|
|
+
|
|
|
void CAccessAuthFSM::doWarnMsg(int errReason, std::string errMsg, bool bNeedEvent, string varMsg)
|
|
|
{
|
|
|
#ifdef RVC_OS_WIN
|