int DzpkDealCountDown(void *pSocketUser,int nMsgID,PACKET_HEAD_T *pHead,char *pBuf,int nLen,char **pBackUserBuf,int *pBackBufLen) { DZPK_USER_T *pUser = (DZPK_USER_T *)pSocketUser; if(pUser) { Json::Value msg_commond; int nMsgID = 0; if(GetJsonValue(pBuf,msg_commond,&nMsgID) == 0) { if(CMD_CNTD_GIFTS == nMsgID) { int room_number =atoi((msg_commond["room_number"].asString()).c_str()); WriteRoomLog(4000,room_number,pUser->nUserID,"\n\n"); WriteRoomLog(4000,room_number,pUser->nUserID,"recv content:%s",pBuf); deal_count_down( pUser->nUserID,dealers_vector,msg_commond,connpool,level_list,pUser,pHead); } else { WriteRoomLog(50000,pUser->nRoomID,pUser->nUserID,"heart ware msg error [%d]<>[%d] content:%s \n",CMD_CNTD_GIFTS,nMsgID,pBuf); } } else { WriteRoomLog(50000,pUser->nRoomID,pUser->nUserID,"heart ware GetJsonValue error content:%s \n",pBuf); } } return 0; }
int dzpkGiveTipToDealer(void *pSocketUser,int nMsgID,PACKET_HEAD_T *pHead,char *pBuf,int nLen,char **pBackUserBuf,int *pBackBufLen) { DZPK_USER_T *pUser = (DZPK_USER_T *)pSocketUser; if(pUser) { Json::Value msg_commond; int nMsgID = 0; if(GetJsonValue(pBuf,msg_commond,&nMsgID) == 0) { if(CMD_GIVE_TIP_TO_DEALER == nMsgID) { int room_number = atoi((msg_commond["room_number"].asString()).c_str()); string seat_num = msg_commond["seat_num"].asString(); WriteRoomLog(4000,room_number,pUser->nUserID,"\n\n"); WriteRoomLog(4000,room_number,pUser->nUserID,"recv content:%s",pBuf); dealGiveTipToDealer(room_number, pUser, seat_num); } else { WriteRoomLog(50000,pUser->nRoomID,pUser->nUserID,"heart ware msg error [%d]<>[%d] content:%s \n",CMD_GIVE_TIP_TO_DEALER,nMsgID,pBuf); } } else { WriteRoomLog(50000,pUser->nRoomID,pUser->nUserID,"heart ware GetJsonValue error content:%s \n",pBuf); } } return 0; }
/*发送消息*/ int DzpkSendMsgToRoomUser(void *pSocketUser,int nMsgID,PACKET_HEAD_T *pHead,char *pBuf,int nLen,char **pBackUserBuf,int *pBackBufLen) { DZPK_USER_T *pUser = (DZPK_USER_T *)pSocketUser; if(pUser) { Json::Value msg_commond; int nMsgID = 0; if(GetJsonValue(pBuf,msg_commond,&nMsgID) == 0) { if(CMD_SEND_MSG_TO_ROOM == nMsgID) { int room_number =atoi((msg_commond["room_number"].asString()).c_str()); int nType =atoi((msg_commond["type"].asString()).c_str()); WriteRoomLog(4000,room_number,pUser->nUserID,"\n\n"); WriteRoomLog(4000,room_number,pUser->nUserID,"recv content:%s",pBuf); deal_send_to_room(pUser->nUserID,room_number,pBuf,nLen,nType); } else { WriteRoomLog(50000,pUser->nRoomID,pUser->nUserID,"heart ware msg error [%d]<>[%d] content:%s \n",CMD_SEND_MSG_TO_ROOM,nMsgID,pBuf); } } else { WriteRoomLog(50000,pUser->nRoomID,pUser->nUserID,"heart ware GetJsonValue error content:%s \n",pBuf); } } return 0; }
int reloadMemData(void *pSocketUser,int nMsgID,PACKET_HEAD_T *pHead,char *pBuf,int nLen,char **pBackUserBuf,int *pBackBufLen) { DZPK_USER_T *pUser = (DZPK_USER_T *)pSocketUser; if(pUser) { Json::Value msg_commond; int nMsgID = 0; if(GetJsonValue(pBuf,msg_commond,&nMsgID) == 0) { if(CMD_READ_MEM_DATA == nMsgID) { printf("recv reload memory data message\n"); g_pMemData->loadMemData(); } } } return 0; }
/*获得锦标赛列表*/ int DzpkCpsGetRankList(void *pSocketUser,int nMsgID,PACKET_HEAD_T *pHead,char *pBuf,int nLen,char **pBackUserBuf,int *pBackBufLen) { DZPK_USER_T *pUser = (DZPK_USER_T *)pSocketUser; if(pUser) { Json::Value msg_commond; int nMsgID = 0; if(GetJsonValue(pBuf,msg_commond,&nMsgID) == 0) { if(CMD_CPS_RANK_LIST == nMsgID) { int room_number =atoi((msg_commond["room_number"].asString()).c_str()); WriteRoomLog(4000,room_number,pUser->nUserID,"\n\n"); WriteRoomLog(4000,room_number,pUser->nUserID,"recv content:%s",pBuf); //取得获得用户列表函数指针 DZPK_MODULE_T *pModule = DzpkGetModule(room_number); if(pModule->msgCpsGetRankList) { pModule->msgCpsGetRankList( pUser->nUserID,dealers_vector,msg_commond,connpool,level_list,pUser,pHead); } else { WriteRoomLog(50000,pUser->nRoomID,pUser->nUserID,"room_number:[%d] cps rank list pointer null \n",room_number); } } else { WriteRoomLog(50000,pUser->nRoomID,pUser->nUserID,"cps rank list msg error[%d]<>[%d] content:%s \n",CMD_CPS_RANK_LIST,nMsgID,pBuf); } } else { WriteRoomLog(50000,pUser->nRoomID,pUser->nUserID,"enter room GetJsonValue error content:%s \n",pBuf); } } return 0; }
/*用户坐下*/ int DzpkUserSeatDown(void *pSocketUser,int nMsgID,PACKET_HEAD_T *pHead,char *pBuf,int nLen,char **pBackUserBuf,int *pBackBufLen) { //调用deal_seat_down函数 DZPK_USER_T *pUser = (DZPK_USER_T *)pSocketUser; if(pUser) { Json::Value msg_commond; int nMsgID = 0; if(GetJsonValue(pBuf,msg_commond,&nMsgID) == 0) { if(CMD_SEAT_DOWN == nMsgID) { int room_number =atoi((msg_commond["room_number"].asString()).c_str()); WriteRoomLog(4000,room_number,pUser->nUserID,"\n\n"); WriteRoomLog(4000,room_number,pUser->nUserID,"recv send content:%s",pBuf); //取得坐下函数指针 DZPK_MODULE_T *pModule = DzpkGetModule(room_number); if(pModule->msgSeatDown) { pModule->msgSeatDown( pUser->nUserID,dealers_vector,msg_commond,connpool,level_list,pUser,pHead); } else { WriteRoomLog(50000,pUser->nRoomID,pUser->nUserID,"room_number:[%d] seat down pointer null \n",room_number); } } else { WriteRoomLog(50000,pUser->nRoomID,pUser->nUserID,"seat down msg error [%d]<>[%d] content:%s \n",CMD_SEAT_DOWN,nMsgID,pBuf); } } else { WriteRoomLog(50000,pUser->nRoomID,pUser->nUserID,"seat down GetJsonValue error content:%s \n",pBuf); } } return 0; }
/*告诉服务器重新读背包*/ int DzpkReReadPack(void *pSocketUser,int nMsgID,PACKET_HEAD_T *pHead,char *pBuf,int nLen,char **pBackUserBuf,int *pBackBufLen) { DZPK_USER_T *pUser = (DZPK_USER_T *)pSocketUser; if(pUser) { Json::Value msg_commond; int nMsgID = 0; if(GetJsonValue(pBuf,msg_commond,&nMsgID) == 0) { if(CMD_RE_READ_USER_PACK == nMsgID) { int room_number =atoi((msg_commond["room_number"].asString()).c_str()); WriteRoomLog(4000,room_number,pUser->nUserID,"\n\n"); WriteRoomLog(4000,room_number,pUser->nUserID,"recv content:%s",pBuf); //取得离开房间函数指针 DZPK_MODULE_T *pModule = DzpkGetModule(room_number); if(pModule->msgReReadPack) { pModule->msgReReadPack( pUser->nUserID,dealers_vector,msg_commond,connpool,level_list,pUser,pHead); } else { WriteRoomLog(50000,pUser->nRoomID,pUser->nUserID,"room_number:[%d] re read pack pointer null \n",room_number); } } else { WriteRoomLog(50000,pUser->nRoomID,pUser->nUserID,"re read pack msg error:[%d]<>[%d] content:%s \n",CMD_RE_READ_USER_PACK,nMsgID,pBuf); } } else { WriteRoomLog(50000,pUser->nRoomID,pUser->nUserID,"re read pack GetJsonValue error content:%s \n",pBuf); } } return 0; }
int DzpkPresentChips(void *pSocketUser,int nMsgID,PACKET_HEAD_T *pHead,char *pBuf,int nLen,char **pBackUserBuf,int *pBackBufLen) { DZPK_USER_T *pUser = (DZPK_USER_T *)pSocketUser; if(pUser) { Json::Value msg_commond; int nMsgID = 0; if(GetJsonValue(pBuf,msg_commond,&nMsgID) == 0) { if(CMD_PRESENT_CHIPS == nMsgID) { int room_number =atoi((msg_commond["room_number"].asString()).c_str()); WriteRoomLog(4000,room_number,pUser->nUserID,"\n\n"); WriteRoomLog(4000,room_number,pUser->nUserID,"recv content:%s",pBuf); //取得赠送筹码函数指针 DZPK_MODULE_T *pModule = DzpkGetModule(room_number); if(pModule->msgPresentChip) { pModule->msgPresentChip( pUser->nUserID,dealers_vector,msg_commond,connpool,level_list,pUser,pHead); } else { WriteRoomLog(50000,pUser->nRoomID,pUser->nUserID,"room_number:[%d] present ship pointer null \n",room_number); } } else { WriteRoomLog(50000,pUser->nRoomID,pUser->nUserID,"present chips msg error[%d]<>[%d] content:%s \n",CMD_PRESENT_CHIPS,nMsgID,pBuf); } } else { WriteRoomLog(50000,pUser->nRoomID,pUser->nUserID,"present chips GetJsonValue error content:%s \n",pBuf); } } return 0; }
/*聊天*/ int DzpkUserSpeekWords(void *pSocketUser,int nMsgID,PACKET_HEAD_T *pHead,char *pBuf,int nLen,char **pBackUserBuf,int *pBackBufLen) { DZPK_USER_T *pUser = (DZPK_USER_T *)pSocketUser; if(pUser) { Json::Value msg_commond; int nMsgID = 0; if(GetJsonValue(pBuf,msg_commond,&nMsgID) == 0) { if(CMD_SPEEK_WORDS == nMsgID) { int room_number =atoi((msg_commond["room_number"].asString()).c_str()); WriteRoomLog(4000,room_number,pUser->nUserID,"\n\n"); WriteRoomLog(4000,room_number,pUser->nUserID,"packlen[%d<>%d] recv content:%s",nLen,pHead->nLen,pBuf); //取得聊天函数指针 DZPK_MODULE_T *pModule = DzpkGetModule(room_number); if(pModule->msgSpeekWorks) { pModule->msgSpeekWorks( pUser->nUserID,dealers_vector,msg_commond,connpool,level_list,pUser,pHead); } else { WriteRoomLog(50000,pUser->nRoomID,pUser->nUserID,"room_number:[%d] speek words pointer null \n",room_number); } } else { WriteRoomLog(50000,pUser->nRoomID,pUser->nUserID,"speak words msg error [%d]<>[%d] content:%s \n",CMD_SPEEK_WORDS,nMsgID,pBuf); } } else { WriteRoomLog(50000,pUser->nRoomID,pUser->nUserID,"speak words GetJsonValue error content:%s \n",pBuf); } } return 0; }
void SoftUpdate::OnBnClickedButton1() { m_link.ShowWindow(SW_HIDE); m_gif.ShowWindow(SW_SHOW); m_gif.Load(_T("res\\checknew.gif")); m_gif.Draw(); checknew.EnableWindow(FALSE); DWORD dw; if(!IsNetworkAlive(&dw)) { m_gif.ShowWindow(SW_HIDE); m_link.ShowWindow(SW_SHOW); m_link.SetWindowText(_T("<a href=\"http://www.ltplayer.com/faq.html\">网络连接断开,请检查网络设置</a>")); checknew.EnableWindow(TRUE); return; } CInternetSession mysession; CHttpConnection *myconn=0; CHttpFile *myfile=0; mysession.SetOption(INTERNET_OPTION_CONNECT_TIMEOUT, 5); //重试之间的等待延时 mysession.SetOption(INTERNET_OPTION_CONNECT_RETRIES, 1); //重试次数 try { myconn=mysession.GetHttpConnection(L"127.0.0.1"); myfile=myconn->OpenRequest(L"GET",L"/index.asp"); if(myfile->SendRequest()==0) { m_gif.ShowWindow(SW_HIDE); m_link.ShowWindow(SW_SHOW); m_link.SetWindowText(_T("<a href=\"http://www.ltplayer.com/faq.html\">网络连接断开,请检查网络设置</a>")); myfile->Close(); myconn->Close(); mysession.Close(); delete myfile; delete myconn; myfile=0; myconn=0; checknew.EnableWindow(TRUE); return; } } catch (CMemoryException* e) { myfile->Close(); myconn->Close(); mysession.Close(); delete myfile; delete myconn; myfile=0; myconn=0; return; } CString mystr; char tmp[1024]; while(myfile->ReadString((wchar_t*)tmp,1024)) { mystr+=tmp; } myfile->Close(); myconn->Close(); mysession.Close(); delete myfile; delete myconn; myfile=0; myconn=0; mystr=_T("{ptm:2012-7-16,ver:0.0.1.6}"); CString OFVERSION =GetJsonValue(mystr,_T("ver")); CString OFPUBLISH =GetJsonValue(mystr,_T("ptm")); if(OFVERSION=="" || OFPUBLISH=="") { m_gif.ShowWindow(SW_HIDE); m_link.ShowWindow(SW_SHOW); m_link.SetWindowText(_T("<a href=\"http://www.ltplayer.com/faq.html\">网络连接断开,请检查网络设置</a>")); checknew.EnableWindow(TRUE); return; } USES_CONVERSION; //CString mystr=_T("0.0.1.7"); CString newversion=OFVERSION; int index=0; OFVERSION.Remove(_T('.')); int versiontotal=atoi(W2A(OFVERSION)); if(versiontotal>USERVERSION) { CString cs; cs.Format(_T("<a href=\"http://www.ltplayer.com/download.html\">发现最新版本%s(%s),请点击更新</a>"),newversion,OFPUBLISH); m_gif.ShowWindow(SW_HIDE); m_link.ShowWindow(SW_SHOW); m_link.SetWindowText(cs); checknew.EnableWindow(TRUE); } else { m_gif.ShowWindow(SW_HIDE); m_link.ShowWindow(SW_SHOW); m_link.SetWindowText(_T("您使用的是最新版本,无需升级")); checknew.EnableWindow(TRUE); } }
/*进入房间*/ int DzpkUserEnterRoom(void *pSocketUser,int nMsgID,PACKET_HEAD_T *pHead,char *pBuf,int nLen,char **pBackUserBuf,int *pBackBufLen) { //printf("enter DzpkUserEnterRoom\n"); DZPK_USER_T *pUser = (DZPK_USER_T *)pSocketUser; if(pUser) { Json::Value msg_commond; int nMsgID = 0; if(GetJsonValue(pBuf,msg_commond,&nMsgID) == 0) { if(CMD_ENTER_ROOM == nMsgID) { int room_number =atoi((msg_commond["room_number"].asString()).c_str()); WriteRoomLog(4000,room_number,pUser->nUserID,"\n\n"); WriteRoomLog(4000,room_number,pUser->nUserID,"recv content:%s",pBuf); DZPK_MODULE_T *pModule = DzpkGetModule(room_number); int nCpsRecordID = atoi((msg_commond["cps_record_id"].asString()).c_str()); if(nCpsRecordID > 0) { CPS_RECORD_T *pRecord = CpsGetRecord(nCpsRecordID); if(pRecord) { pModule = DzpkGetModuleFromRomType(pRecord->nType); CpsFreeRecord(pRecord); } else { //返回进不去 CpsEnterRoom( pUser->nSocketID,dealers_vector,msg_commond,connpool,level_list,pUser,pHead); return 0; } } //取得进入房间函数指针 if(pModule == NULL) { pModule = DzpkGetModule(room_number); } if(pModule->msgEnterRoom) { pModule->msgEnterRoom( pUser->nSocketID,dealers_vector,msg_commond,connpool,level_list,pUser,pHead); } else { WriteRoomLog(50000,pUser->nRoomID,pUser->nUserID,"room_number:[%d] enter room pointer null \n",room_number); } } else { WriteRoomLog(50000,pUser->nRoomID,pUser->nUserID,"enter room msg error[%d]<>[%d] content:%s \n",CMD_ENTER_ROOM,nMsgID,pBuf); } } else { WriteRoomLog(50000,pUser->nRoomID,pUser->nUserID,"enter room GetJsonValue error content:%s \n",pBuf); } } return 0; }