public override GetGroupMemebersApiMahuaCommandResult Handle(GetGroupMemebersApiMahuaCommand message) { var groupMemebersString = MpqApi.Api_GetGroupMemberA(CurrentQq, message.ToGroup); var re = new GetGroupMemebersApiMahuaCommandResult { GroupMemebersString = groupMemebersString }; return(re); }
public override GetGroupMemebersWithModelApiMahuaCommandResult Handle( GetGroupMemebersWithModelApiMahuaCommand message) { var json = MpqApi.Api_GetGroupMemberA(CurrentQq, message.ToGroup); if (string.IsNullOrEmpty(json)) { return(new GetGroupMemebersWithModelApiMahuaCommandResult { ModelWithSourceString = new ModelWithSourceString <IEnumerable <GroupMemberInfo> > { SourceString = json, Model = Enumerable.Empty <GroupMemberInfo>() } }); } var js = new JavaScriptSerializer { MaxJsonLength = int.MaxValue }; var infos = js.Deserialize <GroupMemberInfoListJson>(json); var modelWithSourceString = new ModelWithSourceString <IEnumerable <GroupMemberInfo> > { SourceString = json, Model = infos.Mems .Select(x => new GroupMemberInfo { Group = message.ToGroup, // todo age Age = 0, // todo Area Area = string.Empty, Authority = GetGroupMemberAuthority(x.Role), // todo CanModifyInGroupName CanModifyInGroupName = false, Gender = GetGender(x.G), // todo CanModifyInGroupName HasBadRecord = false, InGroupName = x.Card, JoinTime = Clock.ConvertSecondsToDateTime(x.Join_time), LastSpeakingTime = Clock.ConvertSecondsToDateTime(x.Last_speak_time), Level = x.Lv.Level.ToString(), NickName = x.Nick, Qq = x.Uin.ToString(), // todo SpecialTitle SpecialTitle = string.Empty, // todo TitleExpirationTime TitleExpirationTime = TimeSpan.MinValue }).ToArray(), }; var re = new GetGroupMemebersWithModelApiMahuaCommandResult { ModelWithSourceString = modelWithSourceString, }; return(re); }