소스 검색

存在内存泄漏,暂时未找到原因。

Jeff 6 년 전
부모
커밋
063d1c2e5f

+ 2 - 2
source/hook/WeChats/WeChats.vcxproj

@@ -82,7 +82,7 @@
       <SubSystem>Windows</SubSystem>
       <TargetMachine>MachineX86</TargetMachine>
       <AdditionalLibraryDirectories>..\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
-      <AdditionalDependencies>libprotobufd.lib;libprotobuf-lited.lib;libprotocd.lib;%(AdditionalDependencies)</AdditionalDependencies>
+      <AdditionalDependencies>libprotobufd.lib;%(AdditionalDependencies)</AdditionalDependencies>
     </Link>
   </ItemDefinitionGroup>
   <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
@@ -116,7 +116,7 @@
       <EnableCOMDATFolding>true</EnableCOMDATFolding>
       <TargetMachine>MachineX86</TargetMachine>
       <AdditionalLibraryDirectories>..\lib</AdditionalLibraryDirectories>
-      <AdditionalDependencies>libprotobuf.lib;libprotobuf-lite.lib;libprotoc.lib</AdditionalDependencies>
+      <AdditionalDependencies>libprotobuf.lib;</AdditionalDependencies>
     </Link>
   </ItemDefinitionGroup>
   <ItemGroup>

+ 9 - 28
source/hook/WxAdoInterface/IWxAdoInterface.h

@@ -50,35 +50,16 @@ public:
 		IN CONST INT &nMaxConn = 5) = 0;
 	virtual void ReleasePool() = 0;
 	virtual BOOL ExecuteSQL( IN LPCTSTR lpExcuteSQL, IN CONST DWORD &dwTimeOut = 30000 ) = 0;
-	virtual BOOL IsUserExist( IN LPCTSTR lpPhone, IN LPCTSTR lpPassword, OUT LPVOID lpOutUserInfo,IN CONST DWORD &dwTimeOut = 3000 ) = 0;
-	virtual INT QueryUserDetail(IN LPCTSTR lpStudioID, IN LPVOID lpUserDetail, IN CONST DWORD& dwTimeOut = 3000 ) = 0;
-	virtual INT QueryUserDetail( IN LPCTSTR lpStudioID, IN LPCTSTR lpAccount, IN LPCTSTR lpPassword, OUT LPVOID lpOutUserInfo,IN CONST DWORD &dwTimeOut = 3000 ) = 0;
-	virtual INT QueryDepartmentInfo( IN LPCTSTR lpStudioID, OUT LPVOID lpOutDepartmentInfo, IN CONST DWORD& dwTimeOut = 3000 ) = 0;
-	virtual INT QueryStaffInfo(IN LPCTSTR lpStudioID, OUT LPVOID lpOutStaffInfo, IN CONST DWORD& dwTimeOut = 3000 ) = 0;
-	virtual INT QueryUserInfo(IN LPCTSTR lpStudioID, OUT LPVOID lpOutUserInfo, IN CONST DWORD& dwTimeOut = 3000 ) = 0;
-	virtual INT QueryProductType(IN LPCTSTR lpStudioID, OUT LPVOID lpOutProductType, IN CONST DWORD& dwTimeOut = 3000 ) = 0;
-	virtual INT QueryProductInfo(IN LPCTSTR lpStudioID, OUT LPVOID lpOutProductInfo, IN CONST DWORD& dwTimeOut = 3000 ) = 0;
-	virtual INT QuerySceneryInfo(IN LPCTSTR lpStudioID, OUT LPVOID lpOutSceneryInfo, IN CONST DWORD& dwTimeOut = 3000 ) = 0;
-	virtual INT QueryPackageType(IN LPCTSTR lpStudioID, OUT LPVOID lpOutPackageType, IN CONST DWORD& dwTimeOut = 3000 ) = 0;
-	virtual INT QueryPackageInfo(IN LPCTSTR lpStudioID, OUT LPVOID lpOutPackageInfo, IN CONST DWORD& dwTimeOut = 3000 ) = 0;
-	virtual INT QueryPackageItems(IN LPCTSTR lpStudioID, OUT LPVOID lpOutPackageItems, IN CONST DWORD& dwTimeOut = 3000 ) = 0;
-	virtual INT QueryPackageItemsView(IN LPCTSTR lpStudioID, OUT LPVOID lpOutPackageItems, IN CONST DWORD& dwTimeOut = 3000) = 0;
-	virtual INT QueryPackageItemsDetail(IN LPCTSTR lpStudioID, IN LPCTSTR lpPackageSN, OUT LPVOID lpOutPackageItems, IN CONST DWORD& dwTimeOut = 3000) = 0;
-	virtual INT QueryCustomerType(IN LPCTSTR lpStudioID, OUT LPVOID lpOutCustomerFrom, IN CONST DWORD& dwTimeOut = 3000 ) = 0;
-	virtual INT QueryCustomerInfo(IN LPCTSTR lpStudioID, OUT LPVOID lpOutCustomerInfo, IN LPCTSTR lpFilter, IN CONST DWORD& dwTimeOut = 3000) = 0;
-	virtual INT QueryOrderType(IN LPCTSTR lpStudioID, OUT LPVOID lpOutOrderType, IN CONST DWORD& dwTimeOut = 3000 ) = 0;
-	virtual INT QueryOrderInfo(IN LPCTSTR lpStudioID, OUT LPVOID lpOutOrderInfo, IN LPCTSTR lpFilter, IN CONST DWORD& dwTimeOut = 3000 ) = 0;
-	virtual INT QueryOrderScenery(IN LPCTSTR lpStudioID, OUT LPVOID lpOutOrderScenery, IN LPCTSTR lpFilter, IN CONST DWORD& dwTimeOut = 3000) = 0;
-	virtual INT QueryOrderPackageItems(IN LPCTSTR lpStudioID, OUT LPVOID lpOutOrderPackageItems, IN LPCTSTR lpFilter, IN CONST DWORD& dwTimeOut = 3000) = 0;
-	virtual INT QuerySysConfig(IN LPCTSTR lpStudioID, OUT LPVOID lpOutSysConfig, IN CONST DWORD& dwTimeOut = 3000 ) = 0;
-	virtual INT QueryLog(IN LPCTSTR lpStudioID, OUT LPVOID lpOutLog, IN CONST DWORD& dwTimeOut = 3000 ) = 0;
-	virtual INT QueryStudioInfo(IN LPCTSTR lpStudioID, OUT LPVOID lpOutStudioInfo, IN CONST DWORD& dwTimeOut = 3000 ) = 0;
-	virtual INT SupQueryStudioInfo(OUT LPVOID lpOutStudioInfo, IN CONST DWORD& dwTimeOut = 3000) = 0;
-	virtual INT QueryMaxOrderId(IN LPCTSTR lpStudioID, IN CONST DWORD& dwTimeOut = 3000) = 0;
-	virtual INT QueryMaxPrintId(IN LPCTSTR lpStudioID, IN CONST DWORD& dwTimeOut = 3000) = 0;
+
+	virtual BOOL IsUserExist( IN LPCTSTR lpPhone, IN LPCTSTR lpPassword, OUT LPVOID lpOutValue,IN CONST DWORD &dwTimeOut = 3000 ) = 0;
+	virtual INT QueryUserDetail(IN LPCTSTR lpPhone, IN LPVOID lpOutValue, IN CONST DWORD& dwTimeOut = 3000 ) = 0;
+	
 	//////////////////////////////////////////////////////////////////////////
-	virtual BOOL InsertStudioInfo(IN LPVOID lpStudioInfo, IN CONST DWORD& dwTimeOut = 3000 ) = 0;
-	virtual BOOL UpdateStudioInfo(IN LPVOID lpStudioInfo, IN CONST DWORD& dwTimeOut = 3000) = 0;
+	virtual BOOL AddCustomer(IN LPVOID lpCustomerInfo, IN CONST DWORD& dwTimeOut = 3000 ) = 0;
+	virtual BOOL AddType(IN LPVOID lpStudioInfo, IN CONST DWORD& dwTimeOut = 3000) = 0;
+	virtual BOOL AddReply(IN LPVOID lpStudioInfo, IN CONST DWORD& dwTimeOut = 3000) = 0;
+
+	virtual BOOL UpdateCustomer(IN LPVOID lpCustomerInfo, IN CONST DWORD& dwTimeOut = 3000) = 0;
 };
 
 #endif

+ 204 - 553
source/hook/WxAdoInterface/WxAdoImpl.cpp

@@ -1,9 +1,12 @@
 #include "StdAfx.h"
 #include "WxAdoImpl.h"
-#include "Global.h"
 #include "WxAdoPool.h"
 #include "table.pb.h"
 
+#ifdef _DEBUG
+#define new DEBUG_NEW
+#endif
+
 #define GETDBPTR(dwTimeOut) \
 pAdoObj pObj = NULL;\
 CAdoConnGuard tagConnGuard(pObj, dwTimeOut);\
@@ -20,12 +23,14 @@ enum UserLogInStatus
 CWxAdoImpl* CWxAdoImpl::m_pInstance = NULL;
 CWxAdoImpl::CWxAdoImpl(void):m_nRef(0),m_nObjRef(0)
 {
-	//::CoInitialize(NULL);//初始化COM环境
+	// 全局uid,64位整型,转字符长度17位;
+	m_uniqueid.setWorkerId(10);
+	m_uniqueid.setDatacenterId(20);
 }
 
 CWxAdoImpl::~CWxAdoImpl(void)
 {
-	//::CoUninitialize();
+
 }
 
 ULONG CWxAdoImpl::AddRef()
@@ -307,7 +312,7 @@ BOOL CWxAdoImpl::ExecuteSQL( IN LPCTSTR lpExcuteSQL, IN CONST DWORD &dwTimeOut /
 		_bstr_t bstrSource(e.Source());
 		_bstr_t bstrDescription(e.Description());
 		SolveDBError(e.Error(), pObj);
-		WxAdoGlobal::WriteTextLog(_T("SQL出错:%08lx,%s,%s,%s"), e.Error(), e.ErrorMessage(), (TCHAR*)bstrSource, (TCHAR*)bstrDescription);
+		WriteTextLog(_T("SQL出错:%08lx,%s,%s,%s"), e.Error(), e.ErrorMessage(), (TCHAR*)bstrSource, (TCHAR*)bstrDescription);
 		return FALSE;
 	}
 
@@ -329,9 +334,10 @@ BOOL CWxAdoImpl::ExecuteSQL( IN LPCTSTR lpExcuteSQL, IN CONST DWORD &dwTimeOut /
 /*  日期:;
 /*  内容:;
 /************************************************************************/
-BOOL CWxAdoImpl::IsUserExist( IN LPCTSTR lpPhone, IN LPCTSTR lpPassword, OUT LPVOID lpOutUserInfo,IN CONST DWORD &dwTimeOut /* = 3000 */ )
+BOOL CWxAdoImpl::IsUserExist( IN LPCTSTR lpPhone, IN LPCTSTR lpPassword, OUT LPVOID lpOutValue,IN CONST DWORD &dwTimeOut /* = 3000 */ )
 {
 	GETDBPTR(dwTimeOut);
+#if 0
 	try
 	{
 		if ( lpPhone == NULL || lpPassword == NULL || pObj == NULL)
@@ -342,7 +348,7 @@ BOOL CWxAdoImpl::IsUserExist( IN LPCTSTR lpPhone, IN LPCTSTR lpPassword, OUT LPV
 		pObj->pCommand->CommandText = _bstr_t(strSql);
 		// 执行SQL语句,返回记录集
 		_RecordsetPtr rst = pObj->pCommand->Execute(NULL, NULL, adCmdText);
-		tb_customer &customer = *(tb_customer*)lpOutUserInfo;
+		tb_customer &customer = *(tb_customer*)lpOutValue;
 		if(!rst->adoEOF)
 		{
 			customer.set_customer_id(_bstr_t(rst->GetCollect(_T("csr_id")).bstrVal));
@@ -369,580 +375,225 @@ BOOL CWxAdoImpl::IsUserExist( IN LPCTSTR lpPhone, IN LPCTSTR lpPassword, OUT LPV
 		_bstr_t bstrSource(e.Source());
 		_bstr_t bstrDescription(e.Description());
 		SolveDBError(e.Error(), pObj);
-		WxAdoGlobal::WriteTextLog(_T("SQL出错:%08lx,%s,%s,%s"), e.Error(), e.ErrorMessage(), (TCHAR*)bstrSource, (TCHAR*)bstrDescription);
+		WriteTextLog(_T("SQL出错:%08lx,%s,%s,%s"), e.Error(), e.ErrorMessage(), (TCHAR*)bstrSource, (TCHAR*)bstrDescription);
+		return FALSE;
+	}
+#else // 参数化查询;
+	try
+	{
+		if (lpPhone == NULL || lpPassword == NULL || pObj == NULL)
+			return FALSE;
+
+		_ParameterPtr QueryParam;
+		QueryParam.CreateInstance(__uuidof(Parameter));
+		QueryParam = pObj->pCommand->CreateParameter(_bstr_t(_T("csr_phone")), adBSTR, adParamInput, _tclen(lpPhone), lpPhone);
+		pObj->pCommand->Parameters->Append(QueryParam);
+		pObj->pCommand->CommandText = _bstr_t(_T("select csr_id,csr_name,csr_phone,csr_gender,csr_password,csr_old_phone,csr_vcode,vcode_expiry_time,enable from customer where csr_phone = ?"));
+
+		// 执行SQL语句,返回记录集
+		_RecordsetPtr rst = pObj->pCommand->Execute(NULL, NULL, adCmdText);
+		tb_customer &customer = *(tb_customer*)lpOutValue;
+		if (!rst->adoEOF)
+		{
+			customer.set_customer_id(_bstr_t(rst->GetCollect(_T("csr_id")).bstrVal));
+			customer.set_customer_name(_bstr_t(rst->GetCollect(_T("csr_name")).bstrVal));
+			customer.set_customer_gender(rst->GetCollect(_T("csr_gender")).boolVal == VARIANT_TRUE ? TRUE : FALSE);
+			customer.set_customer_password(_bstr_t(rst->GetCollect(_T("csr_password")).bstrVal));
+			customer.set_customer_phone(_bstr_t(rst->GetCollect(_T("csr_phone")).bstrVal));
+			customer.set_customer_old_phone(_bstr_t(rst->GetCollect(_T("csr_old_phone")).bstrVal));
+			customer.set_customer_vcode(_bstr_t(rst->GetCollect(_T("csr_vcode")).bstrVal));
+			_variant_t var = rst->GetCollect(_T("vcode_expiry_time"));
+			if (var.vt == VT_EMPTY || var.vt == VT_NULL)
+				customer.set_customer_vcode_expiry_time(_T(""));
+			else
+			{
+				COleDateTime dt(var);
+				customer.set_customer_vcode_expiry_time(dt.Format(_T("%Y-%m-%d %H:%M:%S")));
+			}
+			customer.set_customer_enable(rst->GetCollect(_T("enable")).boolVal == VARIANT_TRUE ? TRUE : FALSE);
+		}
+		rst->Close();
+		pObj->pCommand->Parameters->Release();
+	}
+	catch (_com_error &e)
+	{
+		_bstr_t bstrSource(e.Source());
+		_bstr_t bstrDescription(e.Description());
+		SolveDBError(e.Error(), pObj);
+		WriteTextLog(_T("SQL出错:%08lx,%s,%s,%s"), e.Error(), e.ErrorMessage(), (TCHAR*)bstrSource, (TCHAR*)bstrDescription);
 		return FALSE;
 	}
+#endif
 
 	return TRUE;
 }
 
-INT CWxAdoImpl::QueryUserDetail(IN LPCTSTR lpStudioID, IN LPVOID lpUserDetail, IN CONST DWORD & dwTimeOut)
+INT CWxAdoImpl::QueryUserDetail(IN LPCTSTR lpPhone, IN LPVOID lpOutValue, IN const DWORD & dwTimeOut)
 {
-	
-	return 0;
-}
+	GETDBPTR(dwTimeOut);
+#if 0
+	try
+	{
+		if (lpPhone == NULL || pObj == NULL)
+			return FALSE;
 
-/************************************************************************/
-/*  函数:[9/25/2016 IT];
-/*  描述:;
-/*  参数:;
-/*  	[IN] :;
-/*  	[OUT] :;
-/*  	[IN/OUT] :;
-/*  返回:void;
-/*  注意:;
-/*  示例:;
-/*
-/*  修改:;
-/*  日期:;
-/*  内容:;
-/************************************************************************/
-INT CWxAdoImpl::QueryUserDetail( IN LPCTSTR lpStudioID, IN LPCTSTR lpAccount, IN LPCTSTR lpPassword, OUT LPVOID lpOutUserInfo,IN CONST DWORD &dwTimeOut /* = 3000 */ )
-{
-	
+		CString strSql = _T("");
+		strSql.Format(_T("select csr_id,csr_name,csr_phone,csr_gender,csr_password,csr_old_phone,csr_vcode,vcode_expiry_time,enable from customer where csr_phone = %s"), lpPhone);//用于是否转相片;
+		pObj->pCommand->CommandText = _bstr_t(strSql);
+		// 执行SQL语句,返回记录集
+		_RecordsetPtr rst = pObj->pCommand->Execute(NULL, NULL, adCmdText);
+		tb_customer &customer = *(tb_customer*)lpOutValue;
+		if (!rst->adoEOF)
+		{
+			customer.set_customer_id(_bstr_t(rst->GetCollect(_T("csr_id")).bstrVal));
+			customer.set_customer_name(_bstr_t(rst->GetCollect(_T("csr_name")).bstrVal));
+			customer.set_customer_gender(rst->GetCollect(_T("csr_gender")).boolVal == VARIANT_TRUE ? TRUE : FALSE);
+			customer.set_customer_password(_bstr_t(rst->GetCollect(_T("csr_password")).bstrVal));
+			customer.set_customer_phone(_bstr_t(rst->GetCollect(_T("csr_phone")).bstrVal));
+			customer.set_customer_old_phone(_bstr_t(rst->GetCollect(_T("csr_old_phone")).bstrVal));
+			customer.set_customer_vcode(_bstr_t(rst->GetCollect(_T("csr_vcode")).bstrVal));
+			_variant_t var = rst->GetCollect(_T("vcode_expiry_time"));
+			if (var.vt == VT_EMPTY || var.vt == VT_NULL)
+				customer.set_customer_vcode_expiry_time(_T(""));
+			else
+			{
+				COleDateTime dt(var);
+				customer.set_customer_vcode_expiry_time(dt.Format(_T("%Y-%m-%d %H:%M:%S")));
+			}
+			customer.set_customer_enable(rst->GetCollect(_T("enable")).boolVal == VARIANT_TRUE ? TRUE : FALSE);
+		}
+		rst->Close();
+	}
+	catch (_com_error &e)
+	{
+		_bstr_t bstrSource(e.Source());
+		_bstr_t bstrDescription(e.Description());
+		SolveDBError(e.Error(), pObj);
+		WriteTextLog(_T("SQL出错:%08lx,%s,%s,%s"), e.Error(), e.ErrorMessage(), (TCHAR*)bstrSource, (TCHAR*)bstrDescription);
+		return FALSE;
+	}
+#else // 参数化查询;
+	try
+	{
+		if (lpPhone == NULL || pObj == NULL)
+			return FALSE;
 
-	return USER_NULL;
-}
+		_ParameterPtr QueryParam;
+		QueryParam.CreateInstance(__uuidof(Parameter));
+		QueryParam = pObj->pCommand->CreateParameter(_bstr_t(_T("csr_phone")), adBSTR, adParamInput, _tclen(lpPhone), lpPhone);
+		pObj->pCommand->Parameters->Append(QueryParam);
+		pObj->pCommand->CommandText = _bstr_t(_T("select csr_id,csr_name,csr_phone,csr_gender,csr_password,csr_old_phone,csr_vcode,vcode_expiry_time,enable from customer where csr_phone = ?"));
 
-/************************************************************************/
-/*  函数:[9/25/2016 IT];
-/*  描述:;
-/*  参数:;
-/*  	[IN] :;
-/*  	[OUT] :;
-/*  	[IN/OUT] :;
-/*  返回:void;
-/*  注意:;
-/*  示例:;
-/*
-/*  修改:;
-/*  日期:;
-/*  内容:;
-/************************************************************************/
-INT CWxAdoImpl::QueryDepartmentInfo( IN LPCTSTR lpStudioID, OUT LPVOID lpOutDepartmentInfo, IN CONST DWORD& dwTimeOut /* = 3000 */ )
-{
-	
-	return 0;
-}
+		// 执行SQL语句,返回记录集
+		_RecordsetPtr rst = pObj->pCommand->Execute(NULL, NULL, adCmdText);
+		tb_customer &customer = *(tb_customer*)lpOutValue;
+		if (!rst->adoEOF)
+		{
+			customer.set_customer_id(_bstr_t(rst->GetCollect(_T("csr_id")).bstrVal));
+			customer.set_customer_name(_bstr_t(rst->GetCollect(_T("csr_name")).bstrVal));
+			customer.set_customer_gender(rst->GetCollect(_T("csr_gender")).boolVal == VARIANT_TRUE ? TRUE : FALSE);
+			customer.set_customer_password(_bstr_t(rst->GetCollect(_T("csr_password")).bstrVal));
+			customer.set_customer_phone(_bstr_t(rst->GetCollect(_T("csr_phone")).bstrVal));
+			customer.set_customer_old_phone(_bstr_t(rst->GetCollect(_T("csr_old_phone")).bstrVal));
+			customer.set_customer_vcode(_bstr_t(rst->GetCollect(_T("csr_vcode")).bstrVal));
+			_variant_t var = rst->GetCollect(_T("vcode_expiry_time"));
+			if (var.vt == VT_EMPTY || var.vt == VT_NULL)
+				customer.set_customer_vcode_expiry_time(_T(""));
+			else
+			{
+				COleDateTime dt(var);
+				customer.set_customer_vcode_expiry_time(dt.Format(_T("%Y-%m-%d %H:%M:%S")));
+			}
+			customer.set_customer_enable(rst->GetCollect(_T("enable")).boolVal == VARIANT_TRUE ? TRUE : FALSE);
+		}
+		rst->Close();
+		pObj->pCommand->Parameters->Release();
+	}
+	catch (_com_error &e)
+	{
+		_bstr_t bstrSource(e.Source());
+		_bstr_t bstrDescription(e.Description());
+		SolveDBError(e.Error(), pObj);
+		WriteTextLog(_T("SQL出错:%08lx,%s,%s,%s"), e.Error(), e.ErrorMessage(), (TCHAR*)bstrSource, (TCHAR*)bstrDescription);
+		return FALSE;
+	}
+#endif
 
-/************************************************************************/
-/*  函数:[9/25/2016 IT];
-/*  描述:;
-/*  参数:;
-/*  	[IN] :;
-/*  	[OUT] :;
-/*  	[IN/OUT] :;
-/*  返回:void;
-/*  注意:;
-/*  示例:;
-/*
-/*  修改:;
-/*  日期:;
-/*  内容:;
-/************************************************************************/
-INT CWxAdoImpl::QueryStaffInfo(IN LPCTSTR lpStudioID, OUT LPVOID lpOutStaffInfo, IN CONST DWORD& dwTimeOut /* = 3000 */ )
-{
-	
-	return 0;
+	return TRUE;
 }
 
-/************************************************************************/
-/*  函数:[9/28/2016 IT];
-/*  描述:;
-/*  参数:;
-/*  	[IN] :;
-/*  	[OUT] :;
-/*  	[IN/OUT] :;
-/*  返回:void;
-/*  注意:;
-/*  示例:;
-/*
-/*  修改:;
-/*  日期:;
-/*  内容:;
-/************************************************************************/
-INT CWxAdoImpl::QueryUserInfo(IN LPCTSTR lpStudioID, OUT LPVOID lpOutUserInfo, IN CONST DWORD& dwTimeOut /* = 3000 */ )
+BOOL CWxAdoImpl::AddCustomer(IN LPVOID lpCustomerInfo, IN const DWORD & dwTimeOut)
 {
-	
+	if (lpCustomerInfo == NULL)
+		return FALSE;
 
-	return 0;
-}
+	GETDBPTR(dwTimeOut);
+	tb_customer &customer = *(tb_customer*)lpCustomerInfo;
+	try
+	{
+#if 1
+		CString strSql = _T("");
+		strSql.Format(_T("INSERT INTO customer(csr_id,csr_name,csr_phone,csr_gender,csr_password,csr_old_phone,csr_vcode,vcode_expiry_time,enable) "
+			"VALUES('%s','%s','%s',%d,'%s','%s','%s','%s',%d) "),
+			//customer.customer_id().c_str(),
+			//[&]()->TCHAR* {
+			//	// 如果存在, 或者异常,新建spid;
+			//	TCHAR szUid[50] = { 0 };
+			//	_ui64tot_s(m_uniqueid.get_unique_id(), szUid, 50, 10);
+			//	return szUid;
+			//}(),
+			[&]()->TString {
+				// 如果存在, 或者异常,新建spid;
+				TCHAR szUid[50] = { 0 };
+				_ui64tot_s(m_uniqueid.get_unique_id(), szUid, 50, 10);
+				return TString(szUid);
+			}().c_str(),
+			customer.customer_name().c_str(),
+			customer.customer_phone().c_str(),
+			customer.customer_gender(),
+			customer.customer_password().c_str(),
+			customer.customer_old_phone().c_str(),
+			customer.customer_vcode().c_str(),
+			customer.customer_vcode_expiry_time().c_str(),
+			customer.customer_enable()
+		);
 
-/************************************************************************/
-/*  函数:[9/30/2016 IT];
-/*  描述:;
-/*  参数:;
-/*  	[IN] :;
-/*  	[OUT] :;
-/*  	[IN/OUT] :;
-/*  返回:void;
-/*  注意:;
-/*  示例:;
-/*
-/*  修改:;
-/*  日期:;
-/*  内容:;
-/************************************************************************/
-INT CWxAdoImpl::QueryProductType(IN LPCTSTR lpStudioID, OUT LPVOID lpOutProductType, IN CONST DWORD& dwTimeOut /* = 3000 */ )
-{
-	
+		pObj->pCommand->CommandText = _bstr_t(strSql);
+		// 执行SQL语句,返回记录集
+		_RecordsetPtr rst = pObj->pCommand->Execute(NULL, NULL, adCmdText);
+		if (!rst->adoEOF)
+		{
+			;
+		}
+		rst->Close();
+#else
 
-	return 0;
-}
 
-/************************************************************************/
-/*  函数:[9/30/2016 IT];
-/*  描述:;
-/*  参数:;
-/*  	[IN] :;
-/*  	[OUT] :;
-/*  	[IN/OUT] :;
-/*  返回:void;
-/*  注意:;
-/*  示例:;
-/*
-/*  修改:;
-/*  日期:;
-/*  内容:;
-/************************************************************************/
-INT CWxAdoImpl::QueryProductInfo(IN LPCTSTR lpStudioID, OUT LPVOID lpOutProductInfo, IN CONST DWORD& dwTimeOut /* = 3000 */ )
-{
+#endif
+	}
+	catch (_com_error &e)
+	{
+		_bstr_t bstrSource(e.Source());
+		_bstr_t bstrDescription(e.Description());
+		SolveDBError(e.Error(), pObj);
+		WriteTextLog(_T("SQL出错:%08lx,%s,%s,%s"), e.Error(), e.ErrorMessage(), (TCHAR*)bstrSource, (TCHAR*)bstrDescription);
+		return FALSE;
+	}
 
+	return TRUE;
+}
 
+BOOL CWxAdoImpl::AddType(IN LPVOID lpStudioInfo, IN const DWORD & dwTimeOut)
+{
 	return 0;
 }
 
-/************************************************************************/
-/*  函数:[9/30/2016 IT];
-/*  描述:;
-/*  参数:;
-/*  	[IN] :;
-/*  	[OUT] :;
-/*  	[IN/OUT] :;
-/*  返回:void;
-/*  注意:;
-/*  示例:;
-/*
-/*  修改:;
-/*  日期:;
-/*  内容:;
-/************************************************************************/
-INT CWxAdoImpl::QuerySceneryInfo(IN LPCTSTR lpStudioID, OUT LPVOID lpOutSceneryInfo, IN CONST DWORD& dwTimeOut /* = 3000 */ )
+BOOL CWxAdoImpl::AddReply(IN LPVOID lpStudioInfo, IN const DWORD & dwTimeOut)
 {
-
 	return 0;
 }
 
-/************************************************************************/
-/*  函数:[9/30/2016 IT];
-/*  描述:;
-/*  参数:;
-/*  	[IN] :;
-/*  	[OUT] :;
-/*  	[IN/OUT] :;
-/*  返回:void;
-/*  注意:;
-/*  示例:;
-/*
-/*  修改:;
-/*  日期:;
-/*  内容:;
-/************************************************************************/
-INT CWxAdoImpl::QueryPackageType(IN LPCTSTR lpStudioID, OUT LPVOID lpOutPackageType, IN CONST DWORD& dwTimeOut /* = 3000 */ )
-{
-	
-
-	return 0;
-}
-
-/************************************************************************/
-/*  函数:[9/30/2016 IT];
-/*  描述:;
-/*  参数:;
-/*  	[IN] :;
-/*  	[OUT] :;
-/*  	[IN/OUT] :;
-/*  返回:void;
-/*  注意:;
-/*  示例:;
-/*
-/*  修改:;
-/*  日期:;
-/*  内容:;
-/************************************************************************/
-INT CWxAdoImpl::QueryPackageInfo(IN LPCTSTR lpStudioID, OUT LPVOID lpOutPackageInfo, IN CONST DWORD& dwTimeOut /* = 3000 */ )
-{
-	
-	return 0;
-}
-
-/************************************************************************/
-/*  函数:[9/30/2016 IT];
-/*  描述:;
-/*  参数:;
-/*  	[IN] :;
-/*  	[OUT] :;
-/*  	[IN/OUT] :;
-/*  返回:void;
-/*  注意:;
-/*  示例:;
-/*
-/*  修改:;
-/*  日期:;
-/*  内容:;
-/************************************************************************/
-INT CWxAdoImpl::QueryPackageItems(IN LPCTSTR lpStudioID, OUT LPVOID lpOutPackageItems, IN CONST DWORD& dwTimeOut /* = 3000 */ )
-{
-	
-	return 0;
-}
-
-/************************************************************************/
-/*  函数:[10/5/2016 IT];
-/*  描述:;
-/*  参数:;
-/*  	[IN] :;
-/*  	[OUT] :;
-/*  	[IN/OUT] :;
-/*  返回:void;
-/*  注意:;
-/*  示例:;
-/*
-/*  修改:;
-/*  日期:;
-/*  内容:;
-/************************************************************************/
-INT CWxAdoImpl::QueryPackageItemsView(IN LPCTSTR lpStudioID, OUT LPVOID lpOutPackageItems, IN CONST DWORD & dwTimeOut)
-{
-	
-
-	return 0;
-}
-
-/************************************************************************/
-/*  函数:[10/5/2016 IT];
-/*  描述:;
-/*  参数:;
-/*  	[IN] :;
-/*  	[OUT] :;
-/*  	[IN/OUT] :;
-/*  返回:void;
-/*  注意:;
-/*  示例:;
-/*
-/*  修改:;
-/*  日期:;
-/*  内容:;
-/************************************************************************/
-INT CWxAdoImpl::QueryPackageItemsDetail(IN LPCTSTR lpStudioID, IN LPCTSTR lpPackageSN, OUT LPVOID lpOutPackageItems, IN CONST DWORD & dwTimeOut)
-{
-	
-
-	return 0;
-}
-
-/************************************************************************/
-/*  函数:[10/5/2016 IT];
-/*  描述:;
-/*  参数:;
-/*  	[IN] :;
-/*  	[OUT] :;
-/*  	[IN/OUT] :;
-/*  返回:void;
-/*  注意:;
-/*  示例:;
-/*
-/*  修改:;
-/*  日期:;
-/*  内容:;
-/************************************************************************/
-INT CWxAdoImpl::QueryCustomerType(IN LPCTSTR lpStudioID, OUT LPVOID lpOutCustomerFrom, IN CONST DWORD& dwTimeOut /* = 3000 */ )
-{
-	
-
-	return 0;
-}
-
-/************************************************************************/
-/*  函数:[10/5/2016 IT];
-/*  描述:;
-/*  参数:;
-/*  	[IN] :;
-/*  	[OUT] :;
-/*  	[IN/OUT] :;
-/*  返回:void;
-/*  注意:;
-/*  示例:;
-/*
-/*  修改:;
-/*  日期:;
-/*  内容:;
-/************************************************************************/
-INT CWxAdoImpl::QueryCustomerInfo(IN LPCTSTR lpStudioID, OUT LPVOID lpOutCustomerInfo, IN LPCTSTR lpFilter, IN CONST DWORD& dwTimeOut /* = 3000 */)
-{
-	
-
-	return 0;
-}
-
-/************************************************************************/
-/*  函数:[10/5/2016 IT];
-/*  描述:;
-/*  参数:;
-/*  	[IN] :;
-/*  	[OUT] :;
-/*  	[IN/OUT] :;
-/*  返回:void;
-/*  注意:;
-/*  示例:;
-/*
-/*  修改:;
-/*  日期:;
-/*  内容:;
-/************************************************************************/
-INT CWxAdoImpl::QueryOrderType(IN LPCTSTR lpStudioID, OUT LPVOID lpOutOrderType, IN CONST DWORD& dwTimeOut /* = 3000 */ )
-{
-	
-
-	return 0;
-}
-
-/************************************************************************/
-/*  函数:[10/16/2016 IT];
-/*  描述:;
-/*  参数:;
-/*  	[IN] :;
-/*  	[OUT] :;
-/*  	[IN/OUT] :;
-/*  返回:void;
-/*  注意:;
-/*  示例:;
-/*
-/*  修改:;
-/*  日期:;
-/*  内容:;
-/************************************************************************/
-INT CWxAdoImpl::QueryOrderInfo(IN LPCTSTR lpStudioID, OUT LPVOID lpOutOrderInfo, IN LPCTSTR lpFilter, IN CONST DWORD& dwTimeOut /* = 3000 */ )
-{
-	
-
-	return 0;
-}
-
-/************************************************************************/
-/*  函数:[10/16/2016 IT];
-/*  描述:;
-/*  参数:;
-/*  	[IN] :;
-/*  	[OUT] :;
-/*  	[IN/OUT] :;
-/*  返回:void;
-/*  注意:;
-/*  示例:;
-/*
-/*  修改:;
-/*  日期:;
-/*  内容:;
-/************************************************************************/
-INT CWxAdoImpl::QueryOrderScenery(IN LPCTSTR lpStudioID, OUT LPVOID lpOutOrderScenery, IN LPCTSTR lpFilter, IN CONST DWORD& dwTimeOut /* = 3000 */)
-{
-	
-
-	return 0;
-}
-
-/************************************************************************/
-/*  函数:[10/16/2016 IT];
-/*  描述:;
-/*  参数:;
-/*  	[IN] :;
-/*  	[OUT] :;
-/*  	[IN/OUT] :;
-/*  返回:void;
-/*  注意:;
-/*  示例:;
-/*
-/*  修改:;
-/*  日期:;
-/*  内容:;
-/************************************************************************/
-INT CWxAdoImpl::QueryOrderPackageItems(IN LPCTSTR lpStudioID, OUT LPVOID lpOutOrderPackageItems, IN LPCTSTR lpFilter, IN CONST DWORD& dwTimeOut /* = 3000 */)
-{
-	
-	return 0;
-}
-
-/************************************************************************/
-/*  函数:[10/16/2016 IT];
-/*  描述:;
-/*  参数:;
-/*  	[IN] :;
-/*  	[OUT] :;
-/*  	[IN/OUT] :;
-/*  返回:void;
-/*  注意:;
-/*  示例:;
-/*
-/*  修改:;
-/*  日期:;
-/*  内容:;
-/************************************************************************/
-INT CWxAdoImpl::QuerySysConfig(IN LPCTSTR lpStudioID, OUT LPVOID lpOutSysConfig, IN CONST DWORD& dwTimeOut /* = 3000 */ )
-{
-	
-	return 0;
-}
-
-/************************************************************************/
-/*  函数:[10/16/2016 IT];
-/*  描述:;
-/*  参数:;
-/*  	[IN] :;
-/*  	[OUT] :;
-/*  	[IN/OUT] :;
-/*  返回:void;
-/*  注意:;
-/*  示例:;
-/*
-/*  修改:;
-/*  日期:;
-/*  内容:;
-/************************************************************************/
-INT CWxAdoImpl::QueryLog(IN LPCTSTR lpStudioID, OUT LPVOID lpOutLog, IN CONST DWORD& dwTimeOut /* = 3000 */ )
+BOOL CWxAdoImpl::UpdateCustomer(IN LPVOID lpCustomerInfo, IN const DWORD & dwTimeOut)
 {
-	
-
 	return 0;
 }
-
-/************************************************************************/
-/*  函数:[10/27/2016 IT];
-/*  描述:;
-/*  参数:;
-/*  	[IN] :;
-/*  	[OUT] :;
-/*  	[IN/OUT] :;
-/*  返回:void;
-/*  注意:;
-/*  示例:;
-/*
-/*  修改:;
-/*  日期:;
-/*  内容:;
-/************************************************************************/
-INT CWxAdoImpl::QueryStudioInfo(IN LPCTSTR lpStudioID, OUT LPVOID lpOutStudioInfo, IN CONST DWORD & dwTimeOut)
-{
-	
-
-	return 0;
-}
-
-/************************************************************************/
-/*  函数:[10/27/2016 IT];
-/*  描述:;
-/*  参数:;
-/*  	[IN] :;
-/*  	[OUT] :;
-/*  	[IN/OUT] :;
-/*  返回:void;
-/*  注意:;
-/*  示例:;
-/*
-/*  修改:;
-/*  日期:;
-/*  内容:;
-/************************************************************************/
-INT CWxAdoImpl::SupQueryStudioInfo(OUT LPVOID lpOutStudioInfo, IN CONST DWORD & dwTimeOut)
-{
-	
-
-	return 0;
-}
-
-/************************************************************************/
-/*  函数:[2/26/2017 Jeff];
-/*  描述:;
-/*  参数:;
-/*  	[IN] :;
-/*  	[OUT] :;
-/*  	[IN/OUT] :;
-/*  返回:void;
-/*  注意:;
-/*  示例:;
-/*
-/*  修改:;
-/*  日期:;
-/*  内容:;
-/************************************************************************/
-INT CWxAdoImpl::QueryMaxOrderId(IN LPCTSTR lpStudioID, IN CONST DWORD& dwTimeOut /* = 3000 */)
-{
-	
-
-	return 0;
-}
-
-/************************************************************************/
-/*  函数:[2/26/2017 Jeff];
-/*  描述:;
-/*  参数:;
-/*  	[IN] :;
-/*  	[OUT] :;
-/*  	[IN/OUT] :;
-/*  返回:void;
-/*  注意:;
-/*  示例:;
-/*
-/*  修改:;
-/*  日期:;
-/*  内容:;
-/************************************************************************/
-INT CWxAdoImpl::QueryMaxPrintId(IN LPCTSTR lpStudioID, IN CONST DWORD& dwTimeOut /* = 3000 */)
-{
-	
-
-	return 0;
-}
-
-/************************************************************************/
-/*  函数:[10/27/2016 IT];
-/*  描述:;
-/*  参数:;
-/*  	[IN] :;
-/*  	[OUT] :;
-/*  	[IN/OUT] :;
-/*  返回:void;
-/*  注意:;
-/*  示例:;
-/*
-/*  修改:;
-/*  日期:;
-/*  内容:;
-/************************************************************************/
-BOOL CWxAdoImpl::InsertStudioInfo(IN LPVOID lpStudioInfo, IN CONST DWORD & dwTimeOut)
-{
-	
-	
-	return FALSE;
-}
-
-BOOL CWxAdoImpl::UpdateStudioInfo(IN LPVOID lpStudioInfo, IN CONST DWORD & dwTimeOut)
-{
-	
-	return FALSE;
-}
-
-/*
-GETDBPTR(dwTimeOut);
-try
-{
-
-}
-catch (CDBException* e)
-{
-e->ReportError();
-SolveDBError(e->m_nRetCode, pDatabase);
-e->Delete();
-return FALSE;
-}
-return TRUE;
-*/

+ 9 - 30
source/hook/WxAdoInterface/WxAdoImpl.h

@@ -20,6 +20,7 @@
 
 //class CDatabase;
 #include "IWxAdoInterface.h"
+#include "CUniqueId.h"
 
 #pragma once
 
@@ -45,7 +46,7 @@ private:
 	volatile LONG m_nObjRef;
 	// µ¥ÀýʵÀý;
 	static CWxAdoImpl* m_pInstance;
-
+	CUniqueId m_uniqueid;
 	void SolveDBError( IN CONST DWORD &dwError, IN LPVOID pDBConn);
 	//template<typename T> BOOL GetFiedValue(IN _RecordsetPtr rst, IN LPCTSTR lpFiedName, T &value);
 public:
@@ -64,35 +65,13 @@ public:
 	void ReleasePool();
 
 	BOOL ExecuteSQL( IN LPCTSTR lpExcuteSQL, IN CONST DWORD &dwTimeOut = 30000 );
-	BOOL IsUserExist( IN LPCTSTR lpPhone, IN LPCTSTR lpPassword, OUT LPVOID lpOutUserInfo,IN CONST DWORD &dwTimeOut = 3000 );
-	INT QueryUserDetail(IN LPCTSTR lpStudioID, IN LPVOID lpUserDetail, IN CONST DWORD& dwTimeOut = 3000);
-	INT QueryUserDetail( IN LPCTSTR lpStudioID, IN LPCTSTR lpAccount, IN LPCTSTR lpPassword, OUT LPVOID lpOutUserInfo,IN CONST DWORD &dwTimeOut = 3000 );
-	INT QueryDepartmentInfo( IN LPCTSTR lpStudioID, OUT LPVOID lpOutDepartmentInfo, IN CONST DWORD& dwTimeOut = 3000  );
-	INT QueryStaffInfo(IN LPCTSTR lpStudioID, OUT LPVOID lpOutStaffInfo, IN CONST DWORD& dwTimeOut = 3000 );
-	INT QueryUserInfo(IN LPCTSTR lpStudioID, OUT LPVOID lpOutUserInfo, IN CONST DWORD& dwTimeOut = 3000 );
-	INT QueryProductType(IN LPCTSTR lpStudioID, OUT LPVOID lpOutProductType, IN CONST DWORD& dwTimeOut = 3000 );
-	INT QueryProductInfo(IN LPCTSTR lpStudioID, OUT LPVOID lpOutProductInfo, IN CONST DWORD& dwTimeOut = 3000 );
-	INT QuerySceneryInfo(IN LPCTSTR lpStudioID, OUT LPVOID lpOutSceneryInfo, IN CONST DWORD& dwTimeOut = 3000 );
-	INT QueryPackageType(IN LPCTSTR lpStudioID, OUT LPVOID lpOutPackageType, IN CONST DWORD& dwTimeOut = 3000 );
-	INT QueryPackageInfo(IN LPCTSTR lpStudioID, OUT LPVOID lpOutPackageInfo, IN CONST DWORD& dwTimeOut = 3000 );
-	INT QueryPackageItems(IN LPCTSTR lpStudioID, OUT LPVOID lpOutPackageItems, IN CONST DWORD& dwTimeOut = 3000 );
-	INT QueryPackageItemsView(IN LPCTSTR lpStudioID, OUT LPVOID lpOutPackageItems, IN CONST DWORD& dwTimeOut = 3000);
-	INT QueryPackageItemsDetail(IN LPCTSTR lpStudioID, IN LPCTSTR lpPackageSN, OUT LPVOID lpOutPackageItems, IN CONST DWORD& dwTimeOut = 3000);
-	INT QueryCustomerType(IN LPCTSTR lpStudioID, OUT LPVOID lpOutCustomerFrom, IN CONST DWORD& dwTimeOut = 3000 );
-	INT QueryCustomerInfo(IN LPCTSTR lpStudioID, OUT LPVOID lpOutCustomerInfo, IN LPCTSTR lpFilter, IN CONST DWORD& dwTimeOut = 3000);
-	INT QueryOrderType(IN LPCTSTR lpStudioID, OUT LPVOID lpOutOrderType, IN CONST DWORD& dwTimeOut = 3000 );
-	INT QueryOrderInfo(IN LPCTSTR lpStudioID, OUT LPVOID lpOutOrderInfo, IN LPCTSTR lpFilter, IN CONST DWORD& dwTimeOut = 3000 );
-	INT QueryOrderScenery(IN LPCTSTR lpStudioID, OUT LPVOID lpOutOrderScenery, IN LPCTSTR lpFilter, IN CONST DWORD& dwTimeOut = 3000);
-	INT QueryOrderPackageItems(IN LPCTSTR lpStudioID, OUT LPVOID lpOutOrderPackageItems, IN LPCTSTR lpFilter, IN CONST DWORD& dwTimeOut = 3000);
-	INT QuerySysConfig(IN LPCTSTR lpStudioID, OUT LPVOID lpOutSysConfig, IN CONST DWORD& dwTimeOut = 3000 );
-	INT QueryLog(IN LPCTSTR lpStudioID, OUT LPVOID lpOutLog, IN CONST DWORD& dwTimeOut = 3000 );
-	INT QueryStudioInfo(IN LPCTSTR lpStudioID, OUT LPVOID lpOutStudioInfo, IN CONST DWORD& dwTimeOut = 3000 );
-	INT SupQueryStudioInfo(OUT LPVOID lpOutStudioInfo, IN CONST DWORD& dwTimeOut = 3000 );
-	INT QueryMaxOrderId(IN LPCTSTR lpStudioID, IN CONST DWORD& dwTimeOut = 3000);
-	INT QueryMaxPrintId(IN LPCTSTR lpStudioID, IN CONST DWORD& dwTimeOut = 3000);
-	//////////////////////////////////////////////////////////////////////////
-	BOOL InsertStudioInfo(IN LPVOID lpStudioInfo, IN CONST DWORD& dwTimeOut = 3000 );
-	BOOL UpdateStudioInfo(IN LPVOID lpStudioInfo, IN CONST DWORD& dwTimeOut = 3000);
+	BOOL IsUserExist( IN LPCTSTR lpPhone, IN LPCTSTR lpPassword, OUT LPVOID lpOutValue,IN CONST DWORD &dwTimeOut = 3000 );
+	INT QueryUserDetail(IN LPCTSTR lpPhone, IN LPVOID lpOutValue, IN CONST DWORD& dwTimeOut = 3000);
+	BOOL AddCustomer(IN LPVOID lpCustomerInfo, IN CONST DWORD& dwTimeOut = 3000);
+	BOOL AddType(IN LPVOID lpStudioInfo, IN CONST DWORD& dwTimeOut = 3000);
+	BOOL AddReply(IN LPVOID lpStudioInfo, IN CONST DWORD& dwTimeOut = 3000);
+
+	BOOL UpdateCustomer(IN LPVOID lpCustomerInfo, IN CONST DWORD& dwTimeOut = 3000);
 };
 
 #endif

+ 7 - 4
source/hook/WxAdoInterface/WxAdoInterface.vcxproj

@@ -65,7 +65,7 @@
       <DisableSpecificWarnings>4018;4065;4146;4244;4251;4267;4305;4307;4309;4334;4355;4506;4800;4996</DisableSpecificWarnings>
     </ClCompile>
     <Lib>
-      <AdditionalDependencies>libprotobufd.lib;libprotobuf-lited.lib;libprotocd.lib;%(AdditionalDependencies)</AdditionalDependencies>
+      <AdditionalDependencies>libprotobufd.lib;%(AdditionalDependencies)</AdditionalDependencies>
       <AdditionalLibraryDirectories>..\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
     </Lib>
     <PostBuildEvent>
@@ -86,7 +86,7 @@
       <DisableSpecificWarnings>4018;4065;4146;4244;4251;4267;4305;4307;4309;4334;4355;4506;4800;4996</DisableSpecificWarnings>
     </ClCompile>
     <Lib>
-      <AdditionalDependencies>libprotobuf.lib;libprotobuf-lite.lib;libprotoc.lib;%(AdditionalDependencies)</AdditionalDependencies>
+      <AdditionalDependencies>libprotobuf.lib;%(AdditionalDependencies)</AdditionalDependencies>
       <AdditionalLibraryDirectories>..\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
     </Lib>
     <PostBuildEvent>
@@ -106,7 +106,10 @@
       <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
       </PrecompiledHeader>
     </ClCompile>
-    <ClCompile Include="Global.cpp" />
+    <ClCompile Include="CUniqueId.cpp">
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">NotUsing</PrecompiledHeader>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">NotUsing</PrecompiledHeader>
+    </ClCompile>
     <ClCompile Include="stdafx.cpp">
       <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
       <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>
@@ -118,7 +121,7 @@
     <ClInclude Include="..\pb\msg.pb.h" />
     <ClInclude Include="..\pb\table.pb.h" />
     <ClInclude Include="CritSection.h" />
-    <ClInclude Include="Global.h" />
+    <ClInclude Include="CUniqueId.h" />
     <ClInclude Include="IWxAdoInterface.h" />
     <ClInclude Include="SafeList.h" />
     <ClInclude Include="stdafx.h" />

+ 6 - 6
source/hook/WxAdoInterface/WxAdoInterface.vcxproj.filters

@@ -18,9 +18,6 @@
     </Filter>
   </ItemGroup>
   <ItemGroup>
-    <ClCompile Include="Global.cpp">
-      <Filter>源文件</Filter>
-    </ClCompile>
     <ClCompile Include="stdafx.cpp">
       <Filter>源文件</Filter>
     </ClCompile>
@@ -36,14 +33,14 @@
     <ClCompile Include="..\pb\table.pb.cc">
       <Filter>pb</Filter>
     </ClCompile>
+    <ClCompile Include="CUniqueId.cpp">
+      <Filter>源文件</Filter>
+    </ClCompile>
   </ItemGroup>
   <ItemGroup>
     <ClInclude Include="CritSection.h">
       <Filter>头文件</Filter>
     </ClInclude>
-    <ClInclude Include="Global.h">
-      <Filter>头文件</Filter>
-    </ClInclude>
     <ClInclude Include="IWxAdoInterface.h">
       <Filter>头文件</Filter>
     </ClInclude>
@@ -68,6 +65,9 @@
     <ClInclude Include="..\pb\table.pb.h">
       <Filter>pb</Filter>
     </ClInclude>
+    <ClInclude Include="CUniqueId.h">
+      <Filter>头文件</Filter>
+    </ClInclude>
   </ItemGroup>
   <ItemGroup>
     <Text Include="ReadMe.txt" />

+ 7 - 4
source/hook/WxAdoInterface/WxAdoPool.cpp

@@ -1,6 +1,9 @@
 #include "StdAfx.h"
 #include "WxAdoPool.h"
-#include "Global.h"
+
+#ifdef _DEBUG
+#define new DEBUG_NEW
+#endif
 
 //////////////////////////////////////////////////////////////////////////
 CWxAdoPool::CWxAdoPool()
@@ -165,7 +168,7 @@ pAdoObj CWxAdoPool::GetAConnection( IN CONST DWORD &dwTimeOut /* = 1000 */ )
 					//bGetIdl = TRUE;
 					m_listBusyConnections._push_back(pConnection);
 					InterlockedIncrement(&m_nObjRef);	//增加引用计数;
-					WxAdoGlobal::WriteTextLog(_T("创建连接对象:共有 %d 个"), m_nObjRef);
+					WriteTextLog(_T("创建连接对象:共有 %d 个"), m_nObjRef);
 					break;
 				}
 			}
@@ -176,7 +179,7 @@ pAdoObj CWxAdoPool::GetAConnection( IN CONST DWORD &dwTimeOut /* = 1000 */ )
 			Sleep(0);
 			// 超时,则结束返回NULL;
 			if ( (GetTickCount() - dwTime) >= dwTimeOut){
-				WxAdoGlobal::WriteTextLog(_T("获取连接对象超时"));
+				WriteTextLog(_T("获取连接对象超时"));
 				break;
 			}
 		}
@@ -269,7 +272,7 @@ pAdoObj CWxAdoPool::InitAConnection()
 		if (pObj)
 			delete pObj;
 		pObj = NULL;
-		WxAdoGlobal::WriteTextLog(_T("SQL连接串:%08lx,%s,%s,%s"), e.Error(), e.ErrorMessage(), (TCHAR*)bstrSource, (TCHAR*)bstrDescription);
+		WriteTextLog(_T("SQL连接串:%08lx,%s,%s,%s"), e.Error(), e.ErrorMessage(), (TCHAR*)bstrSource, (TCHAR*)bstrDescription);
 	}
 
 	return pObj;

+ 91 - 0
source/hook/WxAdoInterface/stdafx.cpp

@@ -6,3 +6,94 @@
 
 // TODO: 在 STDAFX.H 中
 // 引用任何所需的附加头文件,而不是在此文件中引用
+/************************************************************************/
+	/*  函数:WriteTextLog[7/28/2016 IT];
+	/*  描述:写文本日志;
+	/*  参数:;
+	/*  	[IN] :;
+	/*  返回:void;
+	/*  注意:;
+	/*  示例:;
+	/*
+	/*  修改:;
+	/*  日期:;
+	/*  内容:;
+	/************************************************************************/
+void WriteTextLog(const TCHAR *format, ...)
+{
+	try
+	{
+		static ThreadSection _critSection;
+		AutoThreadSection aSection(&_critSection);
+		// 解析出日志路径;
+		TCHAR szlogpath[MAX_PATH] = { 0 };
+		static TCHAR szModulePath[MAX_PATH] = { 0 };
+		static TCHAR szFna[_MAX_DIR] = { 0 };
+		if (szModulePath[0] == _T('\0'))
+		{
+			TCHAR szDrive[_MAX_DRIVE] = { 0 };
+			TCHAR szDir[_MAX_DIR] = { 0 };
+			TCHAR szExt[_MAX_DIR] = { 0 };
+			::GetModuleFileName(NULL, szModulePath, sizeof(szModulePath) / sizeof(TCHAR));
+			_tsplitpath_s(szModulePath, szDrive, szDir, szFna, szExt);
+			_tcscpy_s(szModulePath, szDrive);
+			_tcscat_s(szModulePath, szDir);
+		}
+
+		_stprintf_s(szlogpath, _T("%s%s.txt"), szModulePath, szFna);
+
+		// 打开或创建文件;
+		CStdioFile fp;
+		if (PathFileExists(szlogpath))
+		{
+			if (fp.Open(szlogpath, CFile::modeWrite) == FALSE)
+			{
+				return;
+			}
+			fp.SeekToEnd();
+		}
+		else
+		{
+			if (!fp.Open(szlogpath, CFile::modeCreate | CFile::modeWrite))
+				return;
+		}
+
+		// 格式化前设置语言区域;
+		TCHAR* old_locale = _tcsdup(_tsetlocale(LC_CTYPE, NULL));
+		_tsetlocale(LC_CTYPE, _T("chs"));//设定中文;
+
+		// 格式化日志内容;
+		va_list		args = NULL;
+		int			len = 0;
+		TCHAR		*buffer = NULL;
+		va_start(args, format);
+		// _vscprintf doesn't count. terminating '\0'
+		len = _vsctprintf_p(format, args);
+		if (len == -1)
+		{
+			goto clear;
+		}
+
+		len++;
+		buffer = (TCHAR*)malloc(len * sizeof(TCHAR));
+		_vstprintf_s(buffer, len, format, args); // C4996
+		// Note: vsprintf is deprecated; consider using vsprintf_s instead
+
+		// 将日志内容输入到文件中;
+		fp.WriteString(CTime::GetCurrentTime().Format(_T("%Y-%m-%d %H:%M:%S ")));
+		fp.WriteString(buffer);
+		fp.WriteString(_T("\n"));
+
+		// 关闭文件,释放资源并设置回原语言区域;
+		free(buffer);
+	clear:
+		_tsetlocale(LC_CTYPE, old_locale);
+		free(old_locale);//还原区域设定;
+		fp.Close();
+	}
+	catch (CException *e)
+	{
+		e->ReportError();
+		e->Delete();
+	}
+}

+ 20 - 2
source/hook/WxAdoInterface/stdafx.h

@@ -39,7 +39,7 @@
 
 
 // TODO: 在此处引用程序需要的其他头文件
-
+#include "CritSection.h"
 #include "table.pb.h"
 
 // Ado//由于MFC封装的ODBC不太好用;
@@ -48,6 +48,8 @@
 #pragma warning (default: 4146)  // 微软建议不要理会这个错误;
 using namespace ADOCG;
 
+extern void WriteTextLog(const TCHAR *format, ...);
+
 typedef struct __ADO__
 {
 	_ConnectionPtr pConnection;
@@ -73,4 +75,20 @@ typedef struct __ADO__
 	//		pConnection->Release();
 	//	}
 	//}
-}AdoObj, *pAdoObj;
+}AdoObj, *pAdoObj;
+
+#ifdef USE_ODBC
+#define DB_SS_CONN_WITH_PORT		_T("driver={SQL Server};Server=%s,%d;database=%s;uid=%s;pwd=%s")
+#define DB_SS_CONN_WITHOUT_PORT		_T("driver={SQL Server};Server=%s;database=%s;uid=%s;pwd=%s")
+#define DB_SS_CONN_WITHOUT_PORT2	_T("driver={SQL Server};Server=%s;database=%d;uid=%s;pwd=%s")
+#define DB_SW_CONN_WITH_PORT		_T("Driver={SQL Server};Server=%s,%d;Database=%s;Trusted_Connection=yes;")
+#define DB_SW_CONN_WITHOUT_PORT		_T("Driver={SQL Server};Server=%s;Database=%s;Trusted_Connection=yes;")
+#define DB_SW_CONN_WITHOUT_PORT2	_T("Driver={SQL Server};Server=%s;Database=%d;Trusted_Connection=yes;")
+#else
+#define DB_SS_CONN_WITH_PORT		_T("Provider=sqloledb;Data Source=%s,%ld;Initial Catalog=%s;User Id=%s;Password=%s; ")
+#define DB_SS_CONN_WITHOUT_PORT		_T("Provider=sqloledb;Data Source=%s;Initial Catalog=%s;User Id=%s;Password=%s; ")
+#define DB_SS_CONN_WITHOUT_PORT2	_T("Provider=sqloledb;Data Source=%s,%ld;Initial Catalog=%s;User Id=%s;Password=%s; ")
+#define DB_SW_CONN_WITH_PORT		_T("Provider=sqloledb;Data Source=%s;Initial Catalog=%s;User Id=%s;Password=%s; ")
+#define DB_SW_CONN_WITHOUT_PORT		_T("Provider=sqloledb;Data Source=%s;Initial Catalog=%s;Trusted_Connection=yes;")
+#define DB_SW_CONN_WITHOUT_PORT2	_T("Provider=sqloledb;Data Source=%s;Initial Catalog=%d;Trusted_Connection=yes;")
+#endif

+ 11 - 4
source/hook/WxService/WxService.cpp

@@ -5,6 +5,10 @@
 #include "WxService.h"
 #include "MainProcess.h"
 
+#define _CRTDBG_MAP_ALLOC 
+#include<stdlib.h>
+#include<crtdbg.h>
+
 #ifdef _DEBUG
 #define new DEBUG_NEW
 #endif
@@ -35,9 +39,13 @@ void CALLBACK WorkStart()
 
 #ifdef _DEBUG
 	tb_customer customer;
-	TCHAR szMax[MAX_PATH] = {0};
+	TCHAR szMax[MAX_PATH] = { 0 };
 	TString str;
-	g_pAdoPool->IsUserExist(_T("15089231318"), _T("123456"), (LPVOID)&customer);
+	g_pAdoPool->IsUserExist(_T("13352667321"), _T("123456"), (LPVOID)&customer);
+
+	customer.set_customer_phone(_T("1508923138"));
+	customer.set_customer_password(_T("1508923138"));
+	g_pAdoPool->AddCustomer((LPVOID)&customer);
 #endif
 
 	WinService::GetDebugPriv();
@@ -61,8 +69,7 @@ void CALLBACK WorkEndof()
 int _tmain(int argc, TCHAR* argv[], TCHAR* envp[])
 {
 	int nRetCode = 0;
-	
-	//_CrtSetBreakAlloc(582);
+	_CrtSetBreakAlloc(165);
 	// 直接获得前景窗口的句柄;
 	HWND hwnd = GetForegroundWindow(); 
 	SendMessage(hwnd , WM_SETICON, ICON_SMALL, (LPARAM)LoadIcon(NULL,MAKEINTRESOURCE(IDI_MICON)));

+ 2 - 2
source/hook/WxService/WxService.vcxproj

@@ -71,7 +71,7 @@
       <SubSystem>Console</SubSystem>
       <TargetMachine>MachineX86</TargetMachine>
       <AdditionalLibraryDirectories>..\lib;</AdditionalLibraryDirectories>
-      <AdditionalDependencies>libprotobufd.lib;libprotobuf-lited.lib;libprotocd.lib;%(AdditionalDependencies)</AdditionalDependencies>
+      <AdditionalDependencies>libprotobufd.lib;%(AdditionalDependencies)</AdditionalDependencies>
     </Link>
   </ItemDefinitionGroup>
   <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
@@ -93,7 +93,7 @@
       <EnableCOMDATFolding>true</EnableCOMDATFolding>
       <TargetMachine>MachineX86</TargetMachine>
       <AdditionalLibraryDirectories>..\lib;</AdditionalLibraryDirectories>
-      <AdditionalDependencies>libprotobuf.lib;libprotobuf-lite.lib;libprotoc.lib;%(AdditionalDependencies)</AdditionalDependencies>
+      <AdditionalDependencies>libprotobuf.lib;%(AdditionalDependencies)</AdditionalDependencies>
     </Link>
   </ItemDefinitionGroup>
   <ItemGroup>

+ 1 - 1
source/hook/WxService/stdafx.cpp

@@ -8,7 +8,7 @@
 // 引用任何所需的附加头文件,而不是在此文件中引用
 HMODULE g_hpool = NULL;
 IWxAdoInterface* g_pAdoPool = NULL;
-typedef IWxAdoInterface* (*CREATEINSTANCE)();
+
 BOOL CreatePoolInstance()
 {   
 	g_pAdoPool = CWxAdoImpl::GetInstance();