public void ExecuteCommand(GameSession session, ProtobufRequestInfo requestInfo) { GroupInfoDAL groupInfoDAL = new GroupInfoDAL(); var sendApplyToJoin = SendApplyToJoin.ParseFrom(requestInfo.Body); RedisUserInfoModel user = RedisUtility.Get <RedisUserInfoModel>(RedisUtility.GetKey(GameInformationBase.COMMUNITYUSERINFO, sendApplyToJoin.Openid, sendApplyToJoin.Unionid)); if (groupInfoDAL.GetGroupInfoByGroupID(sendApplyToJoin.GroupID, user.Type) == null) { var returnApplyToJoin = ReturnApplyToJoin.CreateBuilder().SetStatus(0).SetMessage("圈子不存在").Build().ToByteArray(); session.Send(new ArraySegment <byte>(CreateHead.CreateMessage(GameInformationBase.BASEAGREEMENTNUMBER + 1041, returnApplyToJoin.Length, requestInfo.MessageNum, returnApplyToJoin))); } else if (groupInfoDAL.PlayerApplyRecord(user.UserID, sendApplyToJoin.GroupID, 0) == 1) { var returnApplyToJoin = ReturnApplyToJoin.CreateBuilder().SetStatus(0).SetMessage("已申请,待群主通过").Build().ToByteArray(); session.Send(new ArraySegment <byte>(CreateHead.CreateMessage(GameInformationBase.BASEAGREEMENTNUMBER + 1041, returnApplyToJoin.Length, requestInfo.MessageNum, returnApplyToJoin))); } else if (groupInfoDAL.PlayerApplyRecord(user.UserID, sendApplyToJoin.GroupID, 1) == 1 || groupInfoDAL.IsUserInGroup(sendApplyToJoin.GroupID, user.UserID) != 0) { var returnApplyToJoin = ReturnApplyToJoin.CreateBuilder().SetStatus(0).SetMessage("已再圈子中,请勿重复申请").Build().ToByteArray(); session.Send(new ArraySegment <byte>(CreateHead.CreateMessage(GameInformationBase.BASEAGREEMENTNUMBER + 1041, returnApplyToJoin.Length, requestInfo.MessageNum, returnApplyToJoin))); } //else if (true) //{ // var returnApplyToJoin = ReturnApplyToJoin.CreateBuilder().SetStatus(0).SetMessage("已再圈子中,请勿重复申请").Build().ToByteArray(); // session.Send(new ArraySegment<byte>(CreateHead.CreateMessage(GameInformationBase.BASEAGREEMENTNUMBER + 1041, returnApplyToJoin.Length, requestInfo.MessageNum, returnApplyToJoin))); //} else { groupInfoDAL.ApplyToJoin(sendApplyToJoin.GroupID, user.UserID); var returnApplyToJoin = ReturnApplyToJoin.CreateBuilder().SetStatus(1).SetMessage("申请成功").Build().ToByteArray(); session.Send(new ArraySegment <byte>(CreateHead.CreateMessage(GameInformationBase.BASEAGREEMENTNUMBER + 1041, returnApplyToJoin.Length, requestInfo.MessageNum, returnApplyToJoin))); } }
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))); } }
public void ExecuteCommand(GameSession session, ProtobufRequestInfo requestInfo) { var sendData = SendGroupUserInfoByGroupID.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 = ReturnGroupUserInfoByGroupID.CreateBuilder(); if (groupInfo != null) { var list = groupInfoDAL.GetGroupStaffInfoByGroupID(sendData.GroupID); if (list != null) { foreach (var item in list) { var userInfoDB = new mjuserinfoDAL().GetModel(item.GroupUserID); if (userInfoDB != null) { var groupUserInfo = GroupUserInfo.CreateBuilder(); groupUserInfo.SetGroupUserID(item.GroupUserID).SetNickName(HttpUtility.UrlDecode(HttpUtility.UrlDecode(userInfoDB.nickname))) .SetPicture(userInfoDB.headimg).SetStatus(0); if (Gongyong.userlist.Any(w => w.UserID.Equals(item.GroupUserID))) { groupUserInfo.SetStatus(1); } if (RedisUtility.Get <RedisGameModel>(RedisUtility.GetKey(GameInformationBase.COMMUNITYUSERGAME, userInfoDB.openid, userInfoDB.unionid)) != null) { groupUserInfo.SetStatus(2); } returnGroupInfo.AddUserList(groupUserInfo); } } var data = returnGroupInfo.SetStatus(1).Build().ToByteArray(); session.Send(new ArraySegment <byte>(CreateHead.CreateMessage(GameInformationBase.BASEAGREEMENTNUMBER + 1035, data.Length, requestInfo.MessageNum, data))); return; } } var dataF = returnGroupInfo.SetStatus(0).Build().ToByteArray(); session.Send(new ArraySegment <byte>(CreateHead.CreateMessage(GameInformationBase.BASEAGREEMENTNUMBER + 1035, dataF.Length, requestInfo.MessageNum, dataF))); }
public void ExecuteCommand(GameSession session, ProtobufRequestInfo requestInfo) { List <GroupInfo> groupInfoList = new List <GroupInfo>(); var requestGroupInfo = SendGroupInfo.ParseFrom(requestInfo.Body); RedisUserInfoModel user = RedisUtility.Get <RedisUserInfoModel>(RedisUtility.GetKey(GameInformationBase.COMMUNITYUSERINFO, requestGroupInfo.Openid, requestGroupInfo.Unionid)); if (user == null) { session.Logger.Debug(string.Format("缓存无此用户{0}", string.IsNullOrEmpty(requestGroupInfo.Openid) ? "用户openid为空" : "")); return; } GroupInfoDAL groupInfoDAL = new GroupInfoDAL(); var list = groupInfoDAL.GetGroupIDListByUserID(user.UserID, user.Type); var returnGroupInfo = ReturnGroupInfo.CreateBuilder(); var GroupInfodata = GroupInfo.CreateBuilder(); Byte[] returnGroupInfoData = null; if (list == null || list.Count == 0) { returnGroupInfoData = returnGroupInfo.Build().ToByteArray(); session.Send(new ArraySegment <byte>(CreateHead.CreateMessage(GameInformationBase.BASEAGREEMENTNUMBER + 1031, returnGroupInfoData.Length, requestInfo.MessageNum, returnGroupInfoData))); } else { foreach (var GroupID in list.Distinct()) { DAL.Model.GroupInfo groupInfoModel = groupInfoDAL.GetGroupInfoByGroupID(GroupID, user.Type); if (groupInfoModel != null) { if (groupInfoModel.CreateUserID == user.UserID) { GroupInfodata.SetGroupID(GroupID).SetGroupIntroduction(groupInfoModel.GroupIntroduction ?? "").SetGroupName(HttpUtility.UrlDecode(HttpUtility.UrlDecode(groupInfoModel.GroupName))).SetNikeName(groupInfoModel.GroupName).SetRoomCardCounts(RoomCardUtility.GetRoomCard(groupInfoModel.CreateUserID)).SetCreateTime(TimeToLong.ConvertDateTimeInt(groupInfoModel.CreateTime)).SetIsGroupLord(true); returnGroupInfo.AddGroupInfo(GroupInfodata); //data.SetGroupInfo(1,GroupInfo) } else { GroupInfodata.SetGroupID(GroupID).SetGroupIntroduction(groupInfoModel.GroupIntroduction ?? "").SetGroupName(HttpUtility.UrlDecode(HttpUtility.UrlDecode(groupInfoModel.GroupName))).SetNikeName(groupInfoModel.GroupName).SetRoomCardCounts(RoomCardUtility.GetRoomCard(groupInfoModel.CreateUserID)).SetCreateTime(TimeToLong.ConvertDateTimeInt(groupInfoModel.CreateTime)).SetIsGroupLord(false); returnGroupInfo.AddGroupInfo(GroupInfodata); } } } returnGroupInfoData = returnGroupInfo.Build().ToByteArray(); session.Send(new ArraySegment <byte>(CreateHead.CreateMessage(GameInformationBase.BASEAGREEMENTNUMBER + 1031, returnGroupInfoData.Length, requestInfo.MessageNum, returnGroupInfoData))); } }
public void ExecuteCommand(GameSession session, ProtobufRequestInfo requestInfo) { GroupInfoDAL groupInfoDAL = new GroupInfoDAL(); var sendQuitGroup = SendQuitGroup.ParseFrom(requestInfo.Body); byte[] resultData = null; var deluserInfo = new mjuserinfoDAL().GetModel(sendQuitGroup.UserID); var groupInfo = groupInfoDAL.GetGroupInfoByGroupID(sendQuitGroup.GroupID, deluserInfo.is_band.Value); if (groupInfo == null) { session.Logger.Debug("用户退出不存在朋友圈 关闭连接"); session.Close(); return; } if (groupInfoDAL.GetIsExistenceInGroup(sendQuitGroup.GroupID, sendQuitGroup.UserID, 4) != 1) { resultData = ReturnQuitGroup.CreateBuilder().SetStatus(1).SetMessage("您不是该圈子的成员!").Build().ToByteArray(); session.Send(new ArraySegment <byte>(CreateHead.CreateMessage(GameInformationBase.BASEAGREEMENTNUMBER + 1091, resultData.Length, requestInfo.MessageNum, resultData))); return; } if (groupInfoDAL.GetIsExistenceApplyStatus(sendQuitGroup.GroupID, sendQuitGroup.UserID, 4) == 1) { resultData = ReturnQuitGroup.CreateBuilder().SetStatus(1).SetMessage("您已经申请过退出,请等待群主通过!").Build().ToByteArray(); session.Send(new ArraySegment <byte>(CreateHead.CreateMessage(GameInformationBase.BASEAGREEMENTNUMBER + 1091, resultData.Length, requestInfo.MessageNum, resultData))); } else if (groupInfoDAL.ApplyUsersOutByUserIDTransaction(sendQuitGroup.GroupID, sendQuitGroup.UserID, 4, groupInfo.CreateUserID, true) != 0) { // groupInfoDAL.DelApplyByUserID(sendQuitGroup.GroupID, sendQuitGroup.UserID); //groupInfoDAL.ChangeApplyStatus(sendQuitGroup.GroupID, sendQuitGroup.UserID, 4); resultData = ReturnQuitGroup.CreateBuilder().SetStatus(1).SetMessage("申请退出成功,等待群主通过!").Build().ToByteArray(); session.Send(new ArraySegment <byte>(CreateHead.CreateMessage(GameInformationBase.BASEAGREEMENTNUMBER + 1091, resultData.Length, requestInfo.MessageNum, resultData))); } else { resultData = ReturnQuitGroup.CreateBuilder().SetStatus(1).SetMessage("申请退出失败!").Build().ToByteArray(); session.Send(new ArraySegment <byte>(CreateHead.CreateMessage(GameInformationBase.BASEAGREEMENTNUMBER + 1091, resultData.Length, requestInfo.MessageNum, resultData))); } }
public void ExecuteCommand(GameSession session, ProtobufRequestInfo requestInfo) { var sendAgentGetGroupInfo = SendAgentGetGroupInfo.ParseFrom(requestInfo.Body); GroupInfoDAL groupInfoDAL = new GroupInfoDAL(); DAL.Model.GroupInfo groupInfoModel = groupInfoDAL.GetGroupInfoByGroupID(sendAgentGetGroupInfo.GroupID, 0); if (groupInfoModel != null) { var returnDate = ReturnAgentGetGroupInfo.CreateBuilder().SetGroupID(sendAgentGetGroupInfo.GroupID). SetGroupName(HttpUtility.UrlDecode(HttpUtility.UrlDecode(groupInfoModel.GroupName))).SetNikeName(HttpUtility.UrlDecode(HttpUtility.UrlDecode(groupInfoModel.GroupName))). SetRoomCardCounts(RoomCardUtility.GetRoomCard(sendAgentGetGroupInfo.UserID)). SetCreateTime(TimeToLong.ConvertDateTimeInt(groupInfoModel.CreateTime)). Build().ToByteArray(); session.Send(new ArraySegment <byte>(CreateHead.CreateMessage(GameInformationBase.BASEAGREEMENTNUMBER + 1106, returnDate.Length, requestInfo.MessageNum, returnDate))); } else { var returnMessage = ReturnMessgae.CreateBuilder().SetStatue(0).SetMessage("圈子不存在").Build().ToByteArray(); session.Send(new ArraySegment <byte>(CreateHead.CreateMessage(GameInformationBase.BASEAGREEMENTNUMBER + 1104, returnMessage.Length, requestInfo.MessageNum, returnMessage))); } }
public void ExecuteCommand(GameSession session, ProtobufRequestInfo requestInfo) { GroupInfoDAL groupInfoDAL = new GroupInfoDAL(); var groupUsersManager = SendAgentGroupUsersManager.ParseFrom(requestInfo.Body); // RedisUserInfoModel user = RedisUtility.Get<RedisUserInfoModel>(RedisUtility.GetKey(GameInformationBase.COMMUNITYUSERINFO, groupUsersManager.Openid, groupUsersManager.Unionid)); var player = Player.CreateBuilder(); var returnPlayerList = ReturnPlayerList.CreateBuilder(); var list = groupInfoDAL.GetUsersIDListByGroupID(groupUsersManager.GroupID); var deluserInfo = new mjuserinfoDAL().GetModel(groupUsersManager.DelByUserID); byte[] returnMessage = null; if (deluserInfo == null) { returnMessage = ReturnMessgae.CreateBuilder().SetStatue(0).SetMessage("没有该用户").Build().ToByteArray(); session.Send(new ArraySegment <byte>(CreateHead.CreateMessage(GameInformationBase.BASEAGREEMENTNUMBER + 1104, returnMessage.Length, requestInfo.MessageNum, returnMessage))); // session.Close(); return; } var groupInfo = groupInfoDAL.GetGroupInfoByGroupID(groupUsersManager.GroupID, deluserInfo.is_band.Value); if (groupInfo == null) { returnMessage = ReturnMessgae.CreateBuilder().SetStatue(0).SetMessage("没有该用户").Build().ToByteArray(); session.Send(new ArraySegment <byte>(CreateHead.CreateMessage(GameInformationBase.BASEAGREEMENTNUMBER + 1104, returnMessage.Length, requestInfo.MessageNum, returnMessage))); // session.Close(); return; } //删除用户 if (groupUsersManager.HasDelByUserID && !groupUsersManager.HasAddUsers) { if (groupInfo.CreateUserID == groupUsersManager.DelByUserID) { returnMessage = ReturnMessgae.CreateBuilder().SetStatue(0).SetMessage("群主不能删除自己").Build().ToByteArray(); session.Send(new ArraySegment <byte>(CreateHead.CreateMessage(GameInformationBase.BASEAGREEMENTNUMBER + 1104, returnMessage.Length, requestInfo.MessageNum, returnMessage))); return; } // groupInfoDAL.DelUsersByUserIDTransaction( groupUsersManager.GroupID, groupUsersManager.DelByUserID); groupInfoDAL.DelUsersByUserIDTransaction(groupUsersManager.GroupID, groupUsersManager.DelByUserID, 3, groupUsersManager.DelByUserID); returnMessage = ReturnMessgae.CreateBuilder().SetStatue(1).SetMessage("删除成功").Build().ToByteArray(); session.Send(new ArraySegment <byte>(CreateHead.CreateMessage(GameInformationBase.BASEAGREEMENTNUMBER + 1104, returnMessage.Length, requestInfo.MessageNum, returnMessage))); return; } //添加用户 else if (!groupUsersManager.HasDelByUserID && groupUsersManager.HasAddUsers) { //var groupInfo = groupInfoDAL.GetGroupInfoByGroupID(groupUsersManager.GroupID); //if (groupInfo.CreateUserID == groupUsersManager.AddUsers) //{ // returnMessage = ReturnMessgae.CreateBuilder().SetStatue(0).SetMessage("添加失败").Build().ToByteArray(); // session.Send(new ArraySegment<byte>(CreateHead.CreateMessage(GameInformationBase.BASEAGREEMENTNUMBER + 1104, returnMessage.Length, requestInfo.MessageNum, returnMessage))); // return; //} if (new DAL.DAL.mjuserinfoDAL().GetModel(groupUsersManager.AddUsers) != null) { //加入类型,1圈主添加,2申请加入,3推荐加入 var err = groupInfoDAL.AddUserToGroup(groupUsersManager.GroupID, groupUsersManager.AddUsers, 1); if (err == 0) { returnMessage = ReturnMessgae.CreateBuilder().SetStatue(0).SetMessage("添加失败,已存在该用户").Build().ToByteArray(); session.Send(new ArraySegment <byte>(CreateHead.CreateMessage(GameInformationBase.BASEAGREEMENTNUMBER + 1104, returnMessage.Length, requestInfo.MessageNum, returnMessage))); } else { returnMessage = ReturnMessgae.CreateBuilder().SetStatue(1).SetMessage("添加成功").Build().ToByteArray(); groupInfoDAL.AddGroupTips(groupUsersManager.GroupID, groupUsersManager.AddUsers, 1); //添加成狗后把用户丢到RedisUs 避免需重复登陆问题 RedisUserInfoModel user = RedisUtility.Get <RedisUserInfoModel>(RedisUtility.GetKey(GameInformationBase.COMMUNITYUSERINFO, groupUsersManager.AddUsers.ToString(), groupUsersManager.AddUsers.ToString())); if (user != null) { user.GroupID.Add((int)groupUsersManager.GroupID); RedisUtility.Set(RedisUtility.GetKey(GameInformationBase.COMMUNITYUSERINFO, user.Openid, user.Unionid), user); var userInfo = Gongyong.userlist.Find(w => w.UserID == user.UserID); if (userInfo != null) { userInfo.GroupID.Add((int)groupUsersManager.GroupID); } } session.Send(new ArraySegment <byte>(CreateHead.CreateMessage(GameInformationBase.BASEAGREEMENTNUMBER + 1104, returnMessage.Length, requestInfo.MessageNum, returnMessage))); } } else { returnMessage = ReturnMessgae.CreateBuilder().SetStatue(0).SetMessage("无此用户").Build().ToByteArray(); session.Send(new ArraySegment <byte>(CreateHead.CreateMessage(GameInformationBase.BASEAGREEMENTNUMBER + 1104, returnMessage.Length, requestInfo.MessageNum, returnMessage))); return; } return; } foreach (var userID in list) { DAL.Model.mjuserinfo userinfo = new DAL.DAL.mjuserinfoDAL().GetModel(userID); if (userinfo == null) { groupInfoDAL.DelUsersByUserID(groupUsersManager.GroupID, userID); } else { player.SetGroupUserID(userID).SetNickName(HttpUtility.UrlDecode(HttpUtility.UrlDecode(userinfo.nickname))).SetPicture(userinfo.headimg); returnPlayerList.AddPlayerList(player); } } //返回待审核人数 int counts = groupInfoDAL.GroupApplyRecord(groupUsersManager.GroupID).Count(); returnPlayerList.SetApplyUsers(counts); var returnPlayerListData = returnPlayerList.Build().ToByteArray(); session.Send(new ArraySegment <byte>(CreateHead.CreateMessage(GameInformationBase.BASEAGREEMENTNUMBER + 1051, returnPlayerListData.Length, requestInfo.MessageNum, returnPlayerListData))); }
public void ExecuteCommand(GameSession session, ProtobufRequestInfo requestInfo) { GroupInfoDAL groupInfoDAL = new GroupInfoDAL(); var requestUsersManager = SendGroupUsersManager.ParseFrom(requestInfo.Body); // RedisUserInfoModel user = RedisUtility.Get<RedisUserInfoModel>(RedisUtility.GetKey(GameInformationBase.COMMUNITYUSERINFO, requestUsersManager.Openid, requestUsersManager.Unionid)); var nowUser = Gongyong.userlist.First(w => w != null && w.unionid.Equals(requestUsersManager.Unionid)); if (nowUser == null) { session.Logger.Debug("管理朋友圈用户 未登录!"); return; } var player = Player.CreateBuilder(); var returnPlayerList = ReturnPlayerList.CreateBuilder(); var list = groupInfoDAL.GetUsersIDListByGroupID(requestUsersManager.GroupID); byte[] returnMessage = null; var groupInfo = groupInfoDAL.GetGroupInfoByGroupID(requestUsersManager.GroupID, nowUser.Type); if (nowUser.Type == 0) { if (groupInfo.CreateUserID != nowUser.UserID) { session.Logger.Debug("管理朋友圈用户不是圈主!"); return; } } else if (nowUser.Type == 1)//龙宝用户 { if (!groupInfo.CreateUserUnionID.Equals(nowUser.unionid)) { session.Logger.Debug("管理朋友圈用户不是圈主!"); return; } } //删除用户 if (requestUsersManager.HasDelByUserID && !requestUsersManager.HasAddUsers) { if (groupInfo.CreateUserID == requestUsersManager.DelByUserID) { returnMessage = ReturnMessgae.CreateBuilder().SetStatue(0).SetMessage("群主不能删除自己").Build().ToByteArray(); session.Send(new ArraySegment <byte>(CreateHead.CreateMessage(GameInformationBase.BASEAGREEMENTNUMBER + 1104, returnMessage.Length, requestInfo.MessageNum, returnMessage))); return; } else { // groupInfoDAL.DelUsersByUserID(requestUsersManager.GroupID, requestUsersManager.DelByUserID); groupInfoDAL.DelUsersByUserIDTransaction(requestUsersManager.GroupID, requestUsersManager.DelByUserID, 3, requestUsersManager.DelByUserID); returnMessage = ReturnMessgae.CreateBuilder().SetStatue(0).SetMessage(string.Format("删除用户{0}成功", requestUsersManager.DelByUserID)).Build().ToByteArray(); session.Send(new ArraySegment <byte>(CreateHead.CreateMessage(GameInformationBase.BASEAGREEMENTNUMBER + 1104, returnMessage.Length, requestInfo.MessageNum, returnMessage))); return; } } //添加用户 else if (!requestUsersManager.HasDelByUserID && requestUsersManager.HasAddUsers) { //加入类型,1圈主添加,2申请加入,3推荐加入 // byte[] returnMessage = null; //var groupInfo = groupInfoDAL.GetGroupInfoByGroupID(requestUsersManager.GroupID); //if (groupInfo.CreateUserID == requestUsersManager.AddUsers) //{ // returnMessage = ReturnMessgae.CreateBuilder().SetStatue(0).SetMessage("添加失败").Build().ToByteArray(); // session.Send(new ArraySegment<byte>(CreateHead.CreateMessage(GameInformationBase.BASEAGREEMENTNUMBER + 1104, returnMessage.Length, requestInfo.MessageNum, returnMessage))); // return; //} if (new DAL.DAL.mjuserinfoDAL().GetModel(requestUsersManager.AddUsers) != null) { var err = groupInfoDAL.AddUserToGroup(requestUsersManager.GroupID, requestUsersManager.AddUsers, 1); if (err == 0) { returnMessage = ReturnMessgae.CreateBuilder().SetStatue(0).SetMessage("添加失败,已存在该用户").Build().ToByteArray(); session.Send(new ArraySegment <byte>(CreateHead.CreateMessage(GameInformationBase.BASEAGREEMENTNUMBER + 1104, returnMessage.Length, requestInfo.MessageNum, returnMessage))); } else { returnMessage = ReturnMessgae.CreateBuilder().SetStatue(1).SetMessage("添加成功").Build().ToByteArray(); //添加成狗后把用户丢到RedisUs 避免需重复登陆问题 RedisUserInfoModel user = RedisUtility.Get <RedisUserInfoModel>(RedisUtility.GetKey(GameInformationBase.COMMUNITYUSERINFO, requestUsersManager.AddUsers.ToString(), requestUsersManager.AddUsers.ToString())); if (user != null) { user.GroupID.Add((int)requestUsersManager.GroupID); RedisUtility.Set(RedisUtility.GetKey(GameInformationBase.COMMUNITYUSERINFO, user.Openid, user.Unionid), user); var userInfo = Gongyong.userlist.Find(w => w.UserID == user.UserID); if (userInfo != null) { userInfo.GroupID.Add((int)requestUsersManager.GroupID); } } session.Send(new ArraySegment <byte>(CreateHead.CreateMessage(GameInformationBase.BASEAGREEMENTNUMBER + 1104, returnMessage.Length, requestInfo.MessageNum, returnMessage))); } } else { returnMessage = ReturnMessgae.CreateBuilder().SetStatue(0).SetMessage("无此用户").Build().ToByteArray(); session.Send(new ArraySegment <byte>(CreateHead.CreateMessage(GameInformationBase.BASEAGREEMENTNUMBER + 1104, returnMessage.Length, requestInfo.MessageNum, returnMessage))); return; } return; } else if (requestUsersManager.HasCheckRecordByUserID) { var createRommRecord = CreateRommRecord.CreateBuilder(); var returnRecordList = ReturnRecordList.CreateBuilder(); var listRecord = groupInfoDAL.GetCreateRoomRecord(requestUsersManager.CheckRecordByUserID, requestUsersManager.GroupID); foreach (var item in listRecord) { createRommRecord.SetGroupID(item.GroupID).SetRoomID(item.RoomID).SetCreateUserID(item.CreateUserID).SetCreateDate(TimeToLong.ConvertDateTimeInt(item.CreateDate)).SetUseRoomCard(item.UseRoomCard); returnRecordList.AddCreateRommRecordList(createRommRecord); } session.Send(new ArraySegment <byte>(CreateHead.CreateMessage(GameInformationBase.BASEAGREEMENTNUMBER + 1052, returnRecordList.Build().ToByteArray().Length, requestInfo.MessageNum, returnRecordList.Build().ToByteArray()))); // session.Close(); return; } foreach (var userID in list) { DAL.Model.mjuserinfo userinfo = new DAL.DAL.mjuserinfoDAL().GetModel(userID); if (userinfo == null) { groupInfoDAL.DelUsersByUserID(requestUsersManager.GroupID, userID); } else { player.SetGroupUserID(userID).SetNickName(HttpUtility.UrlDecode(HttpUtility.UrlDecode(userinfo.nickname))).SetPicture(userinfo.headimg); returnPlayerList.AddPlayerList(player); } } //返回待审核人数 int counts = groupInfoDAL.GroupApplyRecord(requestUsersManager.GroupID).Count(); returnPlayerList.SetApplyUsers(counts); var returnPlayerListData = returnPlayerList.Build().ToByteArray(); session.Send(new ArraySegment <byte>(CreateHead.CreateMessage(GameInformationBase.BASEAGREEMENTNUMBER + 1051, returnPlayerListData.Length, requestInfo.MessageNum, returnPlayerListData))); }