public JsonResult getAllMembersByGroupId(string groupId) { string strJson = getGroupDetailById(groupId); GroupDetailModel2 groupDetailModel = fastJSON.JSON.ToObject<GroupDetailModel1>(strJson).data[0]; GroupMemberIdModel[] groupList = groupDetailModel.affiliations; List<string> userIdList = new List<string>();//获取用户ID string ownerId = ""; foreach (GroupMemberIdModel user in groupList) { if (user.member != null) { userIdList.Add(user.member); } else { userIdList.Add(user.owner); ownerId = user.owner; } } if (userIdList.Count > 0) { //根据ID查询用户信息 UserBLL bll = new UserBLL(); DataTable DTable = bll.GetUsersByUserIds(userIdList); UserModel model = new UserModel(); if (DTable != null) { List<UserModel> litestModel = new List<UserModel>(); for (int i = 0; i < DTable.Rows.Count; i++) { DataRowView rowview = DTable.DefaultView[i]; litestModel.Add(new UserModel() { UserName = rowview["UserName"].ToString(), EnglishName = rowview["EnglishName"].ToString(), UserId = rowview["UserId"].ToString(), isOwner = rowview["UserId"].ToString() == ownerId ? true : false, Status = Convert.ToInt32(rowview["Status"].ToString()), Gender = Convert.ToBoolean(rowview["Gender"].ToString()), Signature = rowview["Signature"].ToString(), HeadPic = Convert.ToInt32(rowview["HeadPic"].ToString()), CellPhone = rowview["CellPhone"].ToString(), OfficePhone = rowview["OfficePhone"].ToString(), Email = rowview["Email"].ToString(), DeptId = rowview["DeptId"].ToString(), Position = rowview["Position"].ToString(), DisplayIndex = Convert.ToInt32(rowview["DisplayIndex"].ToString()), active = true, Comment = rowview["Comment"].ToString() }); } return Json(litestModel, JsonRequestBehavior.AllowGet); } } return null; }