public HttpResponseMessage NoTeamUserList([FromBody] UserListParameterModel para) { UserLogic userLogic = new UserLogic(); jsonResult = userLogic.NoTeamUserList(para); returnResult.Content = new StringContent(jsonResult, Encoding.UTF8, "application/json"); return(returnResult); }
public string NoTeamUserList(UserListParameterModel para) { string result = ""; MessageModel message = new MessageModel(); JavaScriptSerializer jss = new JavaScriptSerializer(); HashSet <object> returnResult = new HashSet <object>(); List <User2Model> userInfo; using (HiGame_V1Entities context = new HiGame_V1Entities()) { //查询条件:user表中没有战队信息的user信息,按注册日期排序 //var sql = "SELECT t1.UserID,t1.PhoneNumber,t1.UserWebNickName," + // " t1.UserWebPicture,t1.UserName,t1.Address,"+ // " t1.Sex,CONVERT(varchar(100), t1.Birthday, 23) as Birthday,t1.Hobby" + // " FROM"+ // " db_User t1"+ // " LEFT JOIN db_Team t2 ON t1.UserID = t2.CreateUserID"+ // " LEFT JOIN db_TeamUser t3 ON t1.UserID = t3.UserID"+ // " LEFT JOIN db_GameIDofUser t4 ON t1.UserID = t4.UserID" + // " WHERE t2.CreateUserID IS NULL AND t3.UserID IS NULL AND t4.CertifyState=1"; var sql = "SELECT t1.UserID,t1.PhoneNumber,t1.UserWebNickName," + " t1.UserWebPicture,t1.UserName,t1.Address," + " t1.Sex,CONVERT(varchar(100), t1.Birthday, 23) as Birthday,t1.Hobby" + " FROM" + " db_User t1" + " LEFT JOIN db_Team t2 ON t1.UserID = t2.CreateUserID" + " LEFT JOIN db_TeamUser t3 ON t1.UserID = t3.UserID" + " LEFT JOIN db_GameIDofUser t4 ON t1.UserID = t4.UserID" + " WHERE t2.CreateUserID IS NULL AND t3.UserID IS NULL "; userInfo = context.Database.SqlQuery <User2Model>(sql) .Skip((para.StartPage - 1) * para.PageCount) .Take(para.PageCount).ToList(); //循环user,添加擅长英雄图标 for (int i = 0; i < userInfo.Count; i++) { ///氦气 userInfo[i].Asset = User.GetAssetByUserID(userInfo[i].UserID); //战斗力 userInfo[i].GamePower = User.GetGamePowerByUserID(userInfo[i].UserID); //擅长英雄 userInfo[i].HeroImage = User.GetHeroImgeByUserID(userInfo[i].UserID); } } returnResult.Add(message); returnResult.Add(userInfo); result = jss.Serialize(returnResult); return(result); }