@@ -12,11 +12,11 @@ namespace BusinessService {
1212	BusinessService::BusinessService () {
1313
1414		//  임계영역 Object 생성
15- 		InitializeCriticalSectionAndSpinCount (&idCs,  2000 );
15+ 		InitializeCriticalSection (&idCs);
1616
17- 		InitializeCriticalSectionAndSpinCount (&userCs,  2000 );
17+ 		InitializeCriticalSection (&userCs);
1818
19- 		InitializeCriticalSectionAndSpinCount (&roomCs,  2000 );
19+ 		InitializeCriticalSection (&roomCs);
2020
2121		iocpService = new  IocpService::IocpService ();
2222
@@ -783,6 +783,19 @@ namespace BusinessService {
783783			string sendMsg = loginBeforeMessage;
784784			InsertSendQueue (SendTo::SEND_ME, sendMsg, " "  , sock, ClientStatus::STATUS_LOGOUT);
785785		}
786+ 		else  if  (direction == Direction::USER_GOOD_INFO) { //  인기도 조회
787+ 			vector<RankVo> vec = move (Redis::GetInstance ()->Zrevrange (" pl"  , 20 ));
788+ 			string sendMsg = " 인기도 리스트"  ;
789+ 			vector<RankVo>::iterator iter;
790+ 			for  (iter = vec.begin (); iter != vec.end (); iter++)
791+ 			{
792+ 				sendMsg += " \n "  ;
793+ 				sendMsg += iter->getNickName ();
794+ 				sendMsg += "  :"  ;
795+ 				sendMsg += to_string (iter->getPoint ());
796+ 			}
797+ 			InsertSendQueue (SendTo::SEND_ME, sendMsg, " "  , sock, ClientStatus::STATUS_WAITING);
798+ 		}
786799		else  { //  그외 명령어 입력
787800			string sendMsg = errorMessage;
788801			sendMsg += waitRoomMessage;
@@ -862,6 +875,34 @@ namespace BusinessService {
862875			//  친구추가
863876			AddFriend (sock, msg, id, ClientStatus::STATUS_CHATTIG);
864877		}
878+ 		else  if  (direction == USER_GOOD) { //  인기도
879+ 880+ 			//  방이름 임시 저장
881+ 			string roomName = string (userMap.find (sock)->second .roomName );
882+ 883+ 			EnterCriticalSection (&userCs);
884+ 			unordered_map<SOCKET, PER_HANDLE_DATA> userCopyMap = userMap; //  로그인된 친구정보 확인위해 복사
885+ 			LeaveCriticalSection (&userCs);
886+ 887+ 			unordered_map<SOCKET, PER_HANDLE_DATA>::const_iterator iter;
888+ 			bool  find = false ;
889+ 			for  (iter = userCopyMap.begin (); iter != userCopyMap.end (); iter++) {
890+ 				if  (strcmp (msg.c_str (), iter->second .userName ) == 0 ) {
891+ 					Redis::GetInstance ()->Zincr (" pl"  , msg);
892+ 					find = true ;
893+ 					break ;
894+ 				}
895+ 			}
896+ 897+ 			if  (find) {
898+ 				string sendMsg = " 인기도 추천 성공\n "  ;
899+ 				InsertSendQueue (SendTo::SEND_ME, sendMsg, " "  , sock, ClientStatus::STATUS_CHATTIG);
900+ 			}
901+ 			else  {
902+ 				string sendMsg = " 인기도 추천 실패\n "  ;
903+ 				InsertSendQueue (SendTo::SEND_ME, sendMsg, " "  , sock, ClientStatus::STATUS_CHATTIG);
904+ 			}
905+ 		}
865906		else  { //  채팅방에서 채팅중
866907
867908			string sendMsg;
0 commit comments