예제 #1
0
        public void ExecuteCommand(GameSession session, ProtobufRequestInfo requestInfo)
        {
            var sendData = SendGroupInfoByGroupID.ParseFrom(requestInfo.Body);
            var userInfo = RedisUtility.Get <RedisUserInfoModel>(RedisUtility.GetKey(GameInformationBase.COMMUNITYUSERINFO, sendData.Openid, sendData.Unionid));

            if (userInfo == null || !userInfo.GroupID.Any(w => w == sendData.GroupID))
            {
                session.Close();
                return;
            }
            GroupInfoDAL groupInfoDAL    = new GroupInfoDAL();
            var          groupInfo       = groupInfoDAL.GetGroupInfoByGroupID(sendData.GroupID, userInfo.Type);
            var          returnGroupInfo = ReturnGroupInfoByGroupID.CreateBuilder();

            if (groupInfo != null)
            {
                var data = returnGroupInfo.SetStatus(1).SetCreateTime(TimeToLong.ConvertDateTimeInt(groupInfo.CreateTime)).SetGroupID(groupInfo.GroupID)
                           .SetGroupName(HttpUtility.UrlDecode(HttpUtility.UrlDecode(groupInfo.GroupName))).SetNikeName(HttpUtility.UrlDecode(HttpUtility.UrlDecode(groupInfo.NikeName))).SetCreateUserID(groupInfo.CreateUserID)
                           .SetGroupNumberPeople(groupInfoDAL.GetGroupPeopleNumber(sendData.GroupID)).Build().ToByteArray();
                session.Send(new ArraySegment <byte>(CreateHead.CreateMessage(GameInformationBase.BASEAGREEMENTNUMBER + 1033, data.Length, requestInfo.MessageNum, data)));
            }
            else
            {
                var data = returnGroupInfo.SetStatus(0).Build().ToByteArray();
                session.Send(new ArraySegment <byte>(CreateHead.CreateMessage(GameInformationBase.BASEAGREEMENTNUMBER + 1033, data.Length, requestInfo.MessageNum, data)));
            }
        }