コード例 #1
0
    /// <summary>
    /// 1 移出黑名单 2 去仇人身边 3 换一批(id发0)
    /// </summary>
    public void C2S_ReqDoSomething(FriendOperation _state, int _id)
    {
        //Debug.Log("好友请求    " + _state + "   ,  id :  " + _id);
        pt_req_firend_other_d709 msg = new pt_req_firend_other_d709();

        msg.state   = (int)_state;
        msg.oth_uid = _id;
        NetMsgMng.SendMsg(msg);
    }
コード例 #2
0
    /// <summary>
    /// 1 加为好友 3 添加黑名单 2 删除好友
    /// </summary>
    public void C2S_ReqOperateFriend(FriendOperation _state, List <int> _friends)
    {
        //Debug.Log("请求:1:加好友2:加黑名单3:删除好友    " + _state);
        pt_req_add_del_blacklist_d706 msg = new pt_req_add_del_blacklist_d706();

        msg.state    = (int)_state;
        msg.uid_list = _friends;
        NetMsgMng.SendMsg(msg);
    }
コード例 #3
0
        public async Task <IActionResult> Follow([FromRoute] Guid friendId)
        {
            try
            {
                Guid userId = User.GetUserId();
                if (userId.Equals(friendId))
                {
                    return(BadRequest("invalid"));
                }

                var friendOperation = await _friendOperationRepo.First(fo => fo.FollowerUserId == userId && fo.FollowingUserId == friendId);

                if (friendOperation != null)
                {
                    return(BadRequest("Zaten takip ediyorsun."));
                }
                else
                {
                    var entity = new FriendOperation()
                    {
                        Id              = new Guid(),
                        FollowerUserId  = userId,
                        FollowingUserId = friendId
                    };

                    var response = await _friendOperationRepo.Add(entity);

                    if (response)
                    {
                        try
                        {
                            await _notificationHelper.SendFollowNotification(userId, friendId);

                            await _gameHelper.Point(userId, GameType.Follow);

                            await _gameHelper.Point(friendId, GameType.Following);
                        }
                        catch { }

                        return(Ok("Takip etmeye başladın."));
                    }
                    else
                    {
                        return(BadRequest("Takip ederken hata oluştu."));
                    }
                }
            }
            catch (Exception ex)
            {
                _logHelper.Log("FriendOperationsController", 500, "Follow", ex.Message);
                return(null);
            }
        }