public async Task <ResultModel> UpdateOtherInfo([FromBody] OtherUserInfo otherUserInfo) { var ret = new ResultModel { IsSucceeded = true }; if (!_signInManager.IsSignedIn(User)) { ret.IsSucceeded = false; ret.ErrorMessage = "未登录"; return(ret); } var user = await _userManager.GetUserAsync(User); if (user == null) { ret.IsSucceeded = false; ret.ErrorMessage = "找不到当前用户"; return(ret); } if (otherUserInfo != null) { user.OtherInfo = JsonConvert.SerializeObject(otherUserInfo); var result = await _userManager.UpdateAsync(user); ret.IsSucceeded = result.Succeeded; if (!ret.IsSucceeded) { ret.ErrorMessage = result.Errors.Any() ? result.Errors.Select(i => i.Description).Aggregate((accu, next) => accu + "\n" + next) : "修改失败"; } } return(ret); }
protected void otherUserInfoToFriendCell(UIFriendCell friendCell, OtherUserInfo otherUserInfo) { friendCell.userHead.textureName = otherUserInfo.hi.ToString(); friendCell.userName.text = otherUserInfo.n; friendCell.userLevel.text = otherUserInfo.lv.ToString(); friendCell.userVIPLevel.text = otherUserInfo.vipLv.ToString(); friendCell.userRank.text = Core.Data.stringManager.getString(6081) + otherUserInfo.r.ToString(); friendCell.setRoleIcons(otherUserInfo.p); friendCell.otherUserInfo = otherUserInfo; }
/// <summary> /// Initializes a new instance of the <see cref="User" /> class. /// </summary> /// <param name="loginId"> /// The login id. /// </param> /// <exception cref="ArgumentNullException">loginId is null </exception> public User(string loginId) { if (loginId == null) { throw new ArgumentNullException("loginId"); } LoginId = loginId.Trim(); _security = new SecurityInfo(this); _contact = new ContactInfo(this); _other = new OtherUserInfo { CreateTime = DateTime.Now }; }
// 1为 同意 2为 不同意 public void agreeOrRefusedFriendRequest(OtherUserInfo otherUserInfo, int agreeOrRefusedFriend) { this.agreeOrRefusedFriend = agreeOrRefusedFriend; this.agreeOrRefusedFriendData = otherUserInfo; HttpTask task = new HttpTask(ThreadType.MainThread, TaskResponse.Default_Response); task.AppendCommonParam(RequestType.AGREE_OR_REFUSED_FRIEND, new AgreeOrRefusedFriendParam(Core.Data.playerManager.PlayerID, otherUserInfo.g.ToString(), this.agreeOrRefusedFriend)); task.afterCompleted += agreeOrRefusedFriendRequestCompleted; task.ErrorOccured += agreeOrRefusedFriendRequestError; task.DispatchToRealHandler(); }
// op 1申请添加好友,2删除好友 public void addOrDeleteFriendRequest(OtherUserInfo deleteFriendInfo, int op) { this.addOrDeleteFriendOP = op; this.deleteFriendInfo = deleteFriendInfo; HttpTask task = new HttpTask(ThreadType.MainThread, TaskResponse.Default_Response); task.AppendCommonParam(RequestType.ADD_OR_DELETE_FRIEND, new AddOrDeleteFriendParam(Core.Data.playerManager.PlayerID, deleteFriendInfo.g.ToString(), 1)); task.afterCompleted += addOrDeleteFriendRequestCompleted; task.ErrorOccured += addOrDeleteFriendRequestError; task.DispatchToRealHandler(); }
// protected void setOtherUserDataListToFriendCell(ShowType showType) // { // List<OtherUserData> otherUserInfoConfig = null; // if(showType == ShowType.Friend) // { // otherUserInfoConfig = Core.Data.FriendManager.getFriendConfig(); // } // else // { // otherUserInfoConfig = Core.Data.FriendManager.getSuDiConfig(); // } // if(otherUserInfoConfig == null || otherUserInfoConfig.Count == 0) // { // return; // } // // setFriendCell(showType, otherUserInfoConfig); // } public void setCell(ShowType showType, List <OtherUserInfo> otherUserInfoList) { UITable table = null; UIFriendCell.FriendCellType friendCellType = UIFriendCell.FriendCellType.None; this.currentShowType = showType; // 该页显示的个数 int count = FriendManager.pageShowListItemCount; int start = 0; if (showType == ShowType.Friend) { table = this.friendTable; friendCellType = UIFriendCell.FriendCellType.FriendCell; this.listCount = Core.Data.FriendManager.friendListCount; this.currentPage = Core.Data.FriendManager.friendListCurrentPage; this.pageCount = Core.Data.FriendManager.friendListPageCount; } else if (showType == ShowType.SuDi) { table = this.suDiTable; friendCellType = UIFriendCell.FriendCellType.SuDiCell; this.listCount = Core.Data.FriendManager.suDiListCount; this.currentPage = Core.Data.FriendManager.suDiListCurrentPage; this.pageCount = Core.Data.FriendManager.suDiListPageCount; } else if (showType == ShowType.Request) { table = this.requestTable; friendCellType = UIFriendCell.FriendCellType.RequestCell; this.listCount = Core.Data.FriendManager.requestFriendListCount; this.currentPage = Core.Data.FriendManager.requestFriendListCurrentPage; this.pageCount = Core.Data.FriendManager.requestFriendListPageCount; } else if (showType == ShowType.Search) { table = this.searchTable; friendCellType = UIFriendCell.FriendCellType.SearchCell; } if (this.currentPage == 1) { this.upPageButton.SetActive(false); } if (this.currentPage == pageCount) { this.downPageButton.SetActive(false); count = this.listCount - (this.currentPage - 1) * FriendManager.pageShowListItemCount; } while (table.transform.childCount > 0) { GameObject g = table.transform.GetChild(0).gameObject; g.transform.parent = null; Destroy(g); } table.Reposition(); start = FriendManager.pageShowListItemCount * (this.currentPage - 1); for (int i = start; i < count; i++) { OtherUserInfo otherUserInfo = otherUserInfoList[i]; UIFriendCell friendCell = this.getFriendCellObj(table.transform); friendCell.CurrentFriendCellType = friendCellType; this.otherUserInfoToFriendCell(friendCell, otherUserInfo); } table.Reposition(); }