123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668 |
- //mainCtrl.cpp TCHAT_MESSAGE_STRU
- #include "stdafx.h"
- ///////////////////////////////////////////////////////////////////////////////
- #include "mainCtrl.h"
- #include "mysqldata.h"
- #include "LYFZIPManage.h"
- extern CString g_mainpath;
- extern CDatabase g_db;
- CStringArray g_baduserarray;
- #include "MyTimer.h"
- ////////////////////////////////////////clientip
- BOOL BadUser(CString account)
- {
- for(int i=0; i<g_baduserarray.GetSize (); i++)
- {
- if(account==g_baduserarray.ElementAt (i))return 1;
- }
- return 0;
- }
- ///////////////////////////////////////////////////////////////////////////////
- ///////////////////////////////////////////////////////////////////////////////
- static void HandleServerNetEvent(IN SOCKET hSocket, IN ETransportEvent eEvent,
- IN void *pDataBuf, IN unsigned long nDataLen,
- IN int nError, IN void *pContext)
- {
- if( nError != TRANSPORT_OK ) return;
- CMainCtrl *pMainCtrl = (CMainCtrl *)pContext;
- if( NULL == pMainCtrl ) return;
-
- pMainCtrl->processNetEvent(hSocket, eEvent, pDataBuf, nDataLen);
- }
- ///////////////////////////////////////////////////////////////////////////////
- CMainCtrl::CMainCtrl()
- {
- int nElementSize = sizeof(TUSER_GAME_INFO_STRU);
- m_tClientConnections.Init(nElementSize, "SERVERTUNNEL_CONNECTION_TABLE");
- // g_baduserarray.Add ("564531");
- }
- CMainCtrl::~CMainCtrl()
- {
- }
- int CMainCtrl::StartServer()
- {
- /*for Client, Port can be 0,
- and for Server, Port is Listening Port*/
- unsigned short usPort = 8379;
- int nResult = m_tServerTunnel.net_OpenSocket(Transport_Server,
- usPort,
- HandleServerNetEvent, this);
- if( TRANSPORT_OK != nResult )
- {
- // printf("net_OpenSocket failed!\n");
- return nResult;
- }
- // printf("Server is ready! Port = %d...\n", usPort);
- return TRANSPORT_OK;
- }
- int CMainCtrl::StopServer()
- {
- //printf("\nNow is Stopping Server, please wait...");
- m_tServerTunnel.net_CloseSocket();
- m_tClientConnections.End();
- return TRANSPORT_OK;
- }
- CTableInfoMgr *CMainCtrl::GetClientConnectionTable()
- {
- return &m_tClientConnections;
- }
- ///////////////////////////////////////////////////////////////////////////////
- void CMainCtrl::processNetEvent(IN SOCKET hSocket,
- IN ETransportEvent eEvent,
- IN void *pRecvMsg, IN unsigned long nDataLen)
- {
- unsigned long ulUserID = hSocket;
- if( Transport_AcceptEv == eEvent )
- {
- // printf("Accept one new connection. Socket = %d\n", hSocket);
- }
- else if( Transport_ReadEv == eEvent )
- {
- if( NULL == pRecvMsg ) return;
-
- TMessageHeader* pHeader = (TMessageHeader *)pRecvMsg;
- char *pDataBuf = (char *)pRecvMsg + MESSAGE_HEADER_LEN;
- WORD dwMessageID = pHeader->wMessageId;
- switch(dwMessageID)
- {
- case MSG_LOGIN_REQ:
- {
- TLOGIN_STRU tLoginInfo = {0};
- memcpy(&tLoginInfo, pDataBuf, sizeof(TLOGIN_STRU));
- DWORD dwConnectionID = tLoginInfo.tCommonMsg.dwConnectionID;
- if( dwConnectionID != hSocket )
- {
- dwConnectionID = hSocket;
- tLoginInfo.tCommonMsg.dwConnectionID = dwConnectionID;
- }
- processLoginRequest(&tLoginInfo);
-
- break;
- }
- case MSG_CHATMESSAGE_REQ:
- {
- TCHAT_MESSAGE_STRU *pChatMessage = (TCHAT_MESSAGE_STRU *)pDataBuf;
-
- DWORD dwConnectionID = pChatMessage->tCommonMsg.dwConnectionID;
- if( dwConnectionID != hSocket )
- {
- dwConnectionID = hSocket;
- pChatMessage->tCommonMsg.dwConnectionID = dwConnectionID;
- }
- processChatMessageRequest((void *)pChatMessage);
- break;
- }
- }
- }
- else if( Transport_CloseEv == eEvent )
- {
- unsigned long ulUserID = hSocket;
- processDiconnection(ulUserID);
- }
- }
- void CMainCtrl::processLoginRequest(void *pLoginInfo)
- {
- if( NULL == pLoginInfo ) return;
- TLOGIN_STRU *ptLoginInfo = (TLOGIN_STRU *)pLoginInfo;
- DWORD dwUserID = ptLoginInfo->tCommonMsg.dwConnectionID;
- int nResult = VerifyUserLoginInfo((void *)ptLoginInfo);
-
- DWORD dwConnectionID = (LOGIN_RESULT_SUC == nResult) ? dwUserID : INVALID_SOCKET;
- WORD wMessageId = MSG_LOGIN_RESP;
- LOGIN_RESULT_STRU tLoginResult = {0};
- tLoginResult.tCommonMsg.dwConnectionID = dwConnectionID;
- tLoginResult.tCommonMsg.wMessageId = wMessageId;
- tLoginResult.byResult = nResult;
- tLoginResult.dwUserID = dwConnectionID;
- tLoginResult.byStatus =
- (LOGIN_RESULT_SUC == nResult) ? USER_STATUS_ONLINE : USER_STATUS_OFFLINE;
- CTableInfoMgr *pConnectionTable = GetClientConnectionTable();
- long lCount = pConnectionTable->GetItemCount();
- tLoginResult.wUserCount = (WORD)lCount;
-
- DWORD dwDataLen = sizeof(LOGIN_RESULT_STRU);
- TMessageHeader tHeader = {0};
- tHeader.wMessageId = wMessageId;
- tHeader.dwDataLen = dwDataLen;
-
- SOCKET hSocket = (SOCKET)dwUserID;
- m_tServerTunnel.net_Send(hSocket, &tHeader, (void *)&tLoginResult, dwDataLen);
- /*Send User Info*/
- TUSERLIST_INFO_STRU tUserListInfo = {0};
- dwDataLen = sizeof(TUSERLIST_INFO_STRU);
- memset(&tHeader, 0x00, sizeof(TMessageHeader));
- tHeader.wMessageId = MSG_USERINFO_RESP;
- tHeader.dwDataLen = dwDataLen;
-
- for(long lIndex = 0; lIndex < lCount; lIndex++)
- {
- TUSER_GAME_INFO_STRU *pUserInfo = (TUSER_GAME_INFO_STRU *)pConnectionTable->GetItemValue(lIndex);
- if( NULL == pUserInfo ) continue;
- memset(&tUserListInfo, 0x00, sizeof(TUSERLIST_INFO_STRU));
- tUserListInfo.dwConnectionID = pUserInfo->dwConnectionID;
- tUserListInfo.byStatus = pUserInfo->tUserInfo.byStatus;
- strcpy(tUserListInfo.szUserName, pUserInfo->tUserInfo.szUserName);
- if( dwUserID == pUserInfo->dwConnectionID ) /*The owner*/
- {
- sendMessageToAllUsers(&tHeader, (void *)&tUserListInfo, dwDataLen);
- }
- else /*The Others*/
- {
- m_tServerTunnel.net_Send(hSocket, &tHeader, (void *)&tUserListInfo, dwDataLen);
- }
- }
- }
- void CMainCtrl::processDiconnection(unsigned long ulUserID)
- {
- CTableInfoMgr *pConnectionTable = GetClientConnectionTable();
- TUSER_GAME_INFO_STRU *pUserInfo = (TUSER_GAME_INFO_STRU *)pConnectionTable->Find(ulUserID);
- if( NULL != pUserInfo )
- {
- TUSERLIST_INFO_STRU tUserListInfo = {0};
- DWORD dwDataLen = sizeof(TUSERLIST_INFO_STRU);
- TMessageHeader tHeader = {0};
- memset(&tHeader, 0x00, sizeof(TMessageHeader));
- tHeader.wMessageId = MSG_LOGOUT_RESP;
- tHeader.dwDataLen = dwDataLen;
- tUserListInfo.dwConnectionID = pUserInfo->dwConnectionID;
- tUserListInfo.byStatus = USER_STATUS_OFFLINE;
- strcpy(tUserListInfo.szUserName, pUserInfo->tUserInfo.szUserName);
- pConnectionTable->Delete(ulUserID);
- sendMessageToAllUsers(&tHeader, (void *)&tUserListInfo, dwDataLen);
- }
- // printf("Disconnect one connection. Socket = %ld\n", ulUserID);
- }
- void FillHeader(BYTE *pSendData, WORD wMessageId, DWORD dwDataLen)
- {
- TMessageHeader *pMessageHeader =(TMessageHeader*)pSendData;
- pMessageHeader->byVersion = 101;
- pMessageHeader->wHeaderFlag = MESSAGE_HEADER_FLAG;
- pMessageHeader->wMessageId = wMessageId;
- pMessageHeader->wMessageSubId = 0;
- pMessageHeader->dwDataLen = dwDataLen;
- pMessageHeader->wReserve = 0;
-
- /* convert network word */
- htons(pMessageHeader->wHeaderFlag);
- htons(pMessageHeader->wMessageId);
- htons(pMessageHeader->wMessageSubId);
- htonl(pMessageHeader->dwDataLen);
- htons(pMessageHeader->wCheckSum);
- htonl(pMessageHeader->wReserve);
- }
- BOOL CheckUser(CString account, CString psw)
- {
- CRstClientInfo rsSt;
- rsSt.m_strFilter ="[account]='"+account+"' and [psw]='"+psw+"'";
- rsSt.Open();
- if(!rsSt.IsEOF())
- {
- rsSt.Close();
- return 1;
- }
- rsSt.Close();
- return 0;
- }
- int CheckPhoneType(CString phoneno)//移动:0 联通:1 电信:2 小灵通:3 未知:-1
- {
- int i = 0;
- if(phoneno.IsEmpty ())return -1;
- for( i=0; i<phoneno.GetLength (); i++)
- {
- if(phoneno.GetAt (i)<'0'||phoneno.GetAt (i)>'9')return -1;
- }
- if(phoneno.GetAt (0)=='1')
- {
- if(phoneno.GetLength ()!=11)
- return -1;
- int mobile[]={139,138,137,136,135,134,159,158,152,151,150,157,188,187,144,182};
- int unicom[]={130,131,132,155,156,186,185};
- int telecom[]={133,153,189,180,181};
- for(i=0; i<sizeof(mobile)/sizeof(int); i++)
- {
- if(mobile[i]==atoi(phoneno.Left (3)))
- {
- return 0;
- }
- }
- for(i=0; i<sizeof(unicom)/sizeof(int); i++)
- {
- if(unicom[i]==atoi(phoneno.Left (3)))
- {
- return 1;
- }
- }
- for(i=0; i<sizeof(telecom)/sizeof(int); i++)
- {
- if(telecom[i]==atoi(phoneno.Left (3)))
- {
- return 2;
- }
- }
- return -1;
- }
- else if(phoneno.GetAt (0)=='0')
- {
- if(phoneno.GetLength ()>=10 && phoneno.GetLength ()<=12)
- {
- return 3;
- }
- }
- return -1;
- }
- /*
- 移动:
- 139,138,137,136,135,134,159,158,152,151,150,157,188,187,144
- 联通:
- 130,131,132,155,156,186,185
- 电信:
- 133,153,189,180
- */
- extern void ReCalAccount(CString account);
- extern void WriteLogin(CString str);
- int GetBalance(CString account)
- {
- CString count1="";
- CString count2="";
- CString count3="";
- try
- {
- CRecordset myset(&g_db);
- CString sql="select sum([count]) as cot from recharge where account='"+account+"'";
- myset.Open (CRecordset::forwardOnly, sql);
- if(!myset.IsEOF())
- myset.GetFieldValue ("cot", count1);
- myset.Close();
- sql="select sum([msgcount]) as cot from sendreg where account='"+account+"'";
- myset.Open (CRecordset::forwardOnly, sql);
- if(!myset.IsEOF())
- myset.GetFieldValue ("cot", count2);
- myset.Close();
- sql="select sum([msgcount2]) as cot from sendreg where account='"+account+"'";
- myset.Open (CRecordset::forwardOnly, sql);
- if(!myset.IsEOF())
- myset.GetFieldValue ("cot", count3);
- myset.Close();
- // return atoi(count1)-min(atoi(count2),atoi(count3));
- return atoi(count1)-atoi(count2);
- }
- catch(...)
- {
- return -1;
- }
- }
- BOOL g_bWork=0;
- void CMainCtrl::processChatMessageRequest(void *pChatMsg)
- {
- }
- void CMainCtrl::sendMessageToAllUsers(void *pHeader,
- void *pDataBuf, unsigned long ulDataLen)
- {
- if( (NULL == pHeader) || (NULL == pDataBuf) || (0 >= ulDataLen) ) return;
- CTableInfoMgr *pConnectionTable = GetClientConnectionTable();
- long lCount = pConnectionTable->GetItemCount();
- for(long lIndex = 0; lIndex < lCount; lIndex++)
- {
- TUSER_GAME_INFO_STRU *pUserInfo = (TUSER_GAME_INFO_STRU *)pConnectionTable->GetItemValue(lIndex);
- if( NULL == pUserInfo ) continue;
- SOCKET hSocket = (SOCKET)pUserInfo->dwConnectionID;
- m_tServerTunnel.net_Send(hSocket, pHeader, pDataBuf, ulDataLen);
- }
- }
- ///////////////////////////////////////////////////////////////////////////////
- int CMainCtrl::VerifyUserLoginInfo(void *pLoginInfo)
- {
- /* static ticks=::GetTickCount ();
- if(::GetTickCount ()-ticks<500)
- {
- ticks=::GetTickCount ();
- return LOGIN_RESULT_FAILED;
- }
- ticks=::GetTickCount ();*/
- int nResult = LOGIN_RESULT_SUC;
- if( NULL == pLoginInfo )
- {
- return LOGIN_RESULT_FAILED;
- }
- TLOGIN_STRU *ptLoginInfo = (TLOGIN_STRU *)pLoginInfo;
- DWORD dwUserID = ptLoginInfo->tCommonMsg.dwConnectionID;
- /* CString ip;
- struct sockaddr_in sa;
- int salen = sizeof(sa);
- SOCKET s=dwUserID;
- ::getpeername( s, (struct sockaddr*)&sa, &salen );
- ip.Format ("%d.%d.%d.%d", (BYTE)sa.sin_addr.S_un.S_un_b.s_b1 , (BYTE)sa.sin_addr.S_un.S_un_b.s_b2 , (BYTE)sa.sin_addr.S_un.S_un_b.s_b3 , (BYTE)sa.sin_addr.S_un.S_un_b.s_b4);
- CRecordset myset(&g_db);
- CString sql="select count(*) as cot from noregisterdomain where [ip]='"+ip+"'";
- myset.Open (CRecordset::forwardOnly, sql);
- myset.GetFieldValue ("cot", sql);
- myset.Close();
- if(atoi(sql))
- {
- WriteLogin2(ip+"-此IP未绑定");
- shutdown(s,SD_BOTH);
- closesocket(s);
- return LOGIN_RESULT_FAILED;
- }*/
- /*verify the user information*/
- CTableInfoMgr *pConnectionTable = GetClientConnectionTable();
- long lCount = pConnectionTable->GetItemCount();
- for(long lIndex = 0; lIndex < lCount; lIndex++)
- {
- TUSER_GAME_INFO_STRU *pUserInfo = (TUSER_GAME_INFO_STRU *)pConnectionTable->GetItemValue(lIndex);
- if( NULL == pUserInfo ) continue;
- if( (0 == stricmp(pUserInfo->tUserInfo.szUserName, ptLoginInfo->tUserInfo.szUserName))
- && (USER_STATUS_ONLINE == pUserInfo->tUserInfo.byStatus) )
- {
- return LOGIN_RESULT_MULTI;
- }
- }
- TUSER_GAME_INFO_STRU *pUserGameInfo = new TUSER_GAME_INFO_STRU;
- memset(pUserGameInfo, 0x00, sizeof(TUSER_GAME_INFO_STRU));
-
- pUserGameInfo->dwConnectionID = dwUserID;
- pUserGameInfo->tUserInfo.dwUserID = dwUserID;
- strcpy(pUserGameInfo->tUserInfo.szUserName, ptLoginInfo->tUserInfo.szUserName);
- strcpy(pUserGameInfo->tUserInfo.szPassword, ptLoginInfo->tUserInfo.szPassword);
- pUserGameInfo->tUserInfo.byStatus = USER_STATUS_ONLINE;
- pConnectionTable->Add(pUserGameInfo->dwConnectionID, (void *)pUserGameInfo);
- return nResult;
- }
-
- int CMainCtrl::GetLengthEx(CString str)
- {
- int leng=0;
- TBYTE ucHigh, ucLow;
- for (int i=0; i<str.GetLength(); i++)
- {
- if ( (TBYTE)str[i] < 0x80 )
- {
- leng++;
- continue;
- }
- ucHigh = (TBYTE)str[i];
- if(i+1==str.GetLength())
- {
- leng++;
- break;
- }
- ucLow = (TBYTE)str[i+1];
- if ( ucHigh < 0xa1 || ucLow < 0xa1)
- {
- leng++;
- continue;
- }
- leng++;
- i++;
- }
- return leng;
- }
- int CMainCtrl::GetCount(CString phones, CString content)
- {
- int count=0;
- int leng=GetLengthEx(content);
- int m_nMobile=0;
- int m_nPhone=0;
-
- CStringArray phonearray;
- int pos=phones.Find (",");
- if(pos!=-1)
- {
- phonearray.Add(phones.Left (pos));
- phones=phones.Right (phones.GetLength ()-pos-1);
- pos=phones.Find (",");
- while(pos!=-1)
- {
- phonearray.Add (phones.Left (pos));
- phones=phones.Right (phones.GetLength ()-pos-1);
- pos=phones.Find (",");
- }
- phonearray.Add (phones);
- }
- else
- phonearray.Add (phones);
- for(int i=0; i<phonearray.GetSize (); i++)
- {
- phones=phonearray.ElementAt (i);
- if(CheckPhoneType(phones)==0 || CheckPhoneType(phones)==1 || CheckPhoneType(phones)==2)
- m_nMobile++;
- else if(CheckPhoneType(phones)==3)
- m_nPhone++;
- }
- if(m_nMobile)
- {
- count+=m_nMobile*(leng/70);
- if(leng%70)
- count+=m_nMobile;
- }
- if(m_nPhone)
- {
- count+=m_nPhone*(leng/56);
- if(leng%56)
- count+=m_nPhone;
- }
- return count;
- }
- BOOL CMainCtrl::IsExist(CString account, CString phones, CString content, CString timestamp)
- {//已保存此条记录, 不再保存, 否则重复
- CRecordset myset(&g_db);
- CString sql="select count(*) as cot from sendreg where [account]='"+account+"' and [content]='"+content+"' and [phones]='"+phones+"' and [timestamp]='"+timestamp+"'";
- myset.Open (CRecordset::forwardOnly, sql);
- if(!myset.IsEOF())
- {
- myset.GetFieldValue ("cot", sql);
- if(atoi(sql))
- return 1;
- else
- return 0;
- }
- else
- return 0;
- }
- void CMainCtrl::WriteLog(CString account, CString content)
- {
-
- }
- /*
- CStringArray contentarray;
- CStringArray contentarray2;
- int leng[2]={70,56};
- CStringArray *pArray[2]={&contentarray,&contentarray2};
- for(int a=0; a<1; a++)
- {
- CString contenttemp=content;
- if(GetLengthEx(contenttemp)>leng[a])
- {
- while(GetLengthEx(contenttemp)>leng[a])
- {
- for(int pos=leng[a]; pos<contenttemp.GetLength (); pos++)
- {
- if(GetLengthEx(contenttemp.Left (pos))==leng[a])
- {
- if((pos+1)<contenttemp.GetLength ())
- {
- if(GetLengthEx(contenttemp.Left (pos+1))==leng[a])
- pos++;
- }
- break;
- }
- }
- if(pos==contenttemp.GetLength ())
- {
- pArray[a]->Add (contenttemp);
- contenttemp.Empty ();
- break;
- }
- else
- {
- pArray[a]->Add (contenttemp.Left (pos));
- contenttemp=contenttemp.Right (contenttemp.GetLength ()-pos);
- }
- }
- if(!contenttemp.IsEmpty ())
- pArray[a]->Add (contenttemp);
- }
- else
- pArray[a]->Add (content);
- }
- CStringArray phonearray;
- int pos=phones.Find (",");
- if(pos!=-1)
- {
- phonearray.Add(phones.Left (pos));
- phones=phones.Right (phones.GetLength ()-pos-1);
- pos=phones.Find (",");
- while(pos!=-1)
- {
- phonearray.Add (phones.Left (pos));
- phones=phones.Right (phones.GetLength ()-pos-1);
- pos=phones.Find (",");
- }
- phonearray.Add (phones);
- }
- else
- phonearray.Add (phones);
- int phonearraysize1,phonearraysize2,phonearraysize3,phonearraysize4;
- CArray<CStringArray, CStringArray>multiphonearray1;
- CArray<CStringArray, CStringArray>multiphonearray2;
- CArray<CStringArray, CStringArray>multiphonearray3;
- CArray<CStringArray, CStringArray>multiphonearray4;
- phonearraysize1=phonearraysize2=phonearraysize3=phonearraysize4=1;
- multiphonearray1.SetSize(phonearraysize1);multiphonearray1.ElementAt (0).RemoveAll ();
- multiphonearray2.SetSize(phonearraysize2);multiphonearray2.ElementAt (0).RemoveAll ();
- multiphonearray3.SetSize(phonearraysize3);multiphonearray3.ElementAt (0).RemoveAll ();
- multiphonearray4.SetSize(phonearraysize4);multiphonearray4.ElementAt (0).RemoveAll ();
- int size[4]={1,1,1,1};
- CArray<CStringArray, CStringArray> *pPhoneArray[4]={&multiphonearray1,&multiphonearray2,&multiphonearray3,&multiphonearray4};
- for(int i=0; i<phonearray.GetSize (); i++)
- {
- phones=phonearray.ElementAt (i);
- pos=CheckPhoneType(phones);
- if(pos==-1)continue;
- if(pPhoneArray[pos]->ElementAt (size[pos]-1).GetSize ()>=1000)
- {
- size[pos]++;
- pPhoneArray[pos]->SetSize(size[pos]);
- pPhoneArray[pos]->ElementAt (size[pos]-1).RemoveAll ();
- pPhoneArray[pos]->ElementAt (size[pos]-1).Add (phones);
- }
- else
- {
- pPhoneArray[pos]->ElementAt (size[pos]-1).Add (phones);
- }
- }
- ///
- for(i=0; i<4; i++)
- {
- for(int j=0; j<pPhoneArray[i]->GetSize (); j++)
- {
- if(!pPhoneArray[i]->ElementAt(j).GetSize ())continue;
- phones.Empty ();
- for(int n=0; n<pPhoneArray[i]->ElementAt (j).GetSize (); n++)
- {
- phones+=pPhoneArray[i]->ElementAt (j).ElementAt (n);
- phones+=",";
- }
- phones.TrimRight (",");
- if(i<3)
- {
- for(int m=0; m<contentarray.GetSize (); m++)
- {
- content=contentarray.ElementAt (m);
- int count=GetCount(phones,content);
- count2+=count;
- CString scount;
- scount.Format ("%d", count);
- if(IsExist(account,phones,content,timestamp))
- break;
- sql="insert into sendreg([account],[phones],[content],[timestamp],[msgcount],[msgcount2]) values\
- ('"+account+"','"+phones+"','"+content+"','"+timestamp+"','"+scount+"','0')";
- MyExecuteSQL(&g_db, sql);
- }
- }
- else
- {
-
- }
- }
- }
- // if(count2!=count)
- // AfxMessageBox("数量不一至");
- ReCalAccount(account);
- str="发送信息成功!";
- */
- //nullbalance
|