예제 #1
0
NAMESPACE_END

static int Run(int argc, char** argv)
{
	Proxy_VP3::CString strProxy(__FUNCTION__);
	cout<<strProxy->c_str()<<endl;
	cout<<*strProxy<<endl;

	Proxy_SR1::CString csSR1(__FUNCTION__);
	Proxy_SR1::CString csSR2 = csSR1;
	csSR2[1] = '0';

	return 0;
}
예제 #2
0
void CMainFrame::OnTimer(UINT nIDEvent)
{
	CBCGPFrameWnd::OnTimer(nIDEvent); //这个放前面

	if (nIDEvent == 1001)
	{
		//初始化实名系统
		if (!theApp.GetRealName()->InitRealName())
		{
			theApp.IBAMsgBox(_T("初始化实名认证失败"));
			CBCGPFrameWnd::OnClose();

		}
		else
		{
			SetTimer(1000, 1000 * 10, NULL); //10秒一次

			// 2011/05/05-gxx: 开启获取滚动文字
			m_wndFastLane.StartThread();
		}
		KillTimer(1001);
	}
	else if(nIDEvent == 1000)
	{
		if (!theApp.GetRealName()->CheckRealName()) //检查实名是否正常
		{
			theApp.GetRealName()->UnInitRealName();

			CBCGPFrameWnd::OnClose();
		}
	}
	else if(nIDEvent == 1005)
	{
		// 主收银台才做这样的判断
		BOOL bAuditProxyRunning = TRUE;
		HANDLE hMutex = ::OpenMutex(MUTEX_ALL_ACCESS, FALSE, _T("_SUNLIKEAUDITPROXY_MUTEX_"));
		if (hMutex != NULL)
		{
			CloseHandle(hMutex);
			CString strProxy(theApp.GetWorkPath());
			strProxy.Append(_T("\\IBABin\\SunlikeAuditProxy.exe"));

			CL2Process SunlikeAuditProxy;
			SunlikeAuditProxy.Attach(strProxy);
			if (!SunlikeAuditProxy.IsRunning())
			{
				bAuditProxyRunning = FALSE;
			}
		}
		else
		{
			bAuditProxyRunning = FALSE;
		}
		if (bAuditProxyRunning == FALSE)
		{
			CNetBarConfig::GetInstance()->SetAllowOpenUser(FALSE);
		}
		else
		{
			CNetBarConfig::GetInstance()->SetAllowOpenUser(TRUE);
		}
	}
	else if(nIDEvent == 1006)
	{
#ifdef DEBUG
		if (GetTickCount() - CIBAGlobal::s_dwStartUpTickcount >= 60*1000)
#else
		if (GetTickCount() - CIBAGlobal::s_dwStartUpTickcount >= 24*3600*1000)
#endif
		
		{
			CCashRegisterLoginMethod CashRegisterLogin;
			BOOL bRet = FALSE;

			CashRegisterLogin.SetCashRegisterId(CIBAConfig::GetInstance()->GetCashRegisterID());
			CashRegisterLogin.SetCashRegisterVersion(CIBALog::GetInstance()->GetAppVer());
			CashRegisterLogin.SetCashRegisterType(1);//普通模式,需要验证,无本地数据库
			CashRegisterLogin.SetUserId(theApp.GetCurCashier()->GetName());
			CashRegisterLogin.SetPassword(theApp.GetCurCashier()->GetPassword());

			time_t tm = time(NULL);
			CString strOrg;
			strOrg.Format(_T("%ld"), tm);

			CIBALog::GetInstance()->WriteFormat(_T("时间戳:%d"), tm);
			CIBALog::GetInstance()->WriteFormat(_T("%s"), theApp.GetCurCashier()->GetPassword());

			CIBALog::GetInstance()->WriteFormat(_T("fileHash:%s"), CIBALog::GetInstance()->GetFileHash());

			CString strTmp;
			CEncrypt::CalcMD5(theApp.GetCurCashier()->GetPassword(), strTmp);

			CIBALog::GetInstance()->WriteFormat(_T("%s"), strTmp);

			strOrg += CIBALog::GetInstance()->GetFileHash();
			strOrg += strTmp.Left(16);
			strOrg += strTmp.Left(16);
			CString strRes;
			CEncrypt::CalcMD5(strOrg, strRes);

			CashRegisterLogin.SetTimeChuo(tm);
			CashRegisterLogin.SetCheckCode(strRes);

			bRet = CashRegisterLogin.Execute();

			if (!bRet) //连接中心失败
			{
				return ;
			}

			if (CashRegisterLogin.GetStatusCode() == 0) //执行成功
			{
				//载入中心配置的控制参数字串
				CNetBarConfig::GetInstance()->PraseControlOption(CashRegisterLogin.GetControlOption());
			}
			else
			{
				return;
			}


			if (CNetBarConfig::GetInstance()->GetForceQuitParam() == 1)
			{
				CString thisVer = CIBALog::GetInstance()->GetAppVer();
				thisVer.Remove(_T('.'));
				CString strVer = CNetBarConfig::GetInstance()->GetForceQuitVersion();
				if (thisVer.Compare(strVer) < 0)
				{
					// 低于中心的版本
					KillTimer(nIDEvent);

					theApp.IBAMsgBox(IDS_IBA_RESTART_TIP);
					theApp.AutoRestart();
				}
			}
		}
	}
	else if(nIDEvent == 1007)
	{
		// 查询fileList地址并存储到数据库表
		CGetSystemConfigMethod getSystemConfigMethod;
		getSystemConfigMethod.SetStringField(_T("versionManageHost"));
		getSystemConfigMethod.SetNetbarId(CNetBarConfig::GetInstance()->GetNetBarId());
		getSystemConfigMethod.Execute();

		if(0 == getSystemConfigMethod.GetStatusCode())
		{
			CString strFieldValue = getSystemConfigMethod.GetStringFieldValue();
			UINT Value1 = getSystemConfigMethod.GetValue1();
			UINT Value2 = getSystemConfigMethod.GetValue2();
			CNetBarConfig::GetInstance()->SetSystemConfig(_T("versionManageHost"), 
				strFieldValue, Value1, Value2);
		}

		KillTimer(nIDEvent);
	}
}