public void IntlMsg_GetUser(InternalMsg.InternalBaseMsg msg) { var intlMsg = msg as InternalMsg.IntlMsg_GetUser; var resDataHeader = JsonConvert.DeserializeObject <LBD.ResponesDataHeader>(intlMsg.result); if (resDataHeader.statusCode == 1000) { var resData = JsonConvert.DeserializeObject <LBD.Respones_GetUserInfio>(intlMsg.result); if (null != user) { if (!string.IsNullOrEmpty(resData.responseData.walletAddress)) { user.walletAddr = resData.responseData.walletAddress; LBD.LBDApiManager.Instance.AddLBDCmd(new LBD.Msg.LBDMsg_GetProxy() { uid = user.UID, guid = user.Id.ToString(), lineuserid = user.lineUID }); } else { // Is not LBW member TcpMsg.MessageResponse ackData; if (user.stateType == UserStateType.CreateNickName) { ackData = new TcpMsg.AckCreateNickName() { errCode = TcpMsg.Error.IsNot_LBW_Member }; } else if (user.stateType == UserStateType.ExistingUserConnect) { ackData = new TcpMsg.AckVerifyAccessToken() { errCode = TcpMsg.Error.IsNot_LBW_Member, authType = TcpMsg.AuthType.IsNot_LBW_Member }; } else { logger.Warn($"User is not an LBW member User StateError StateType={user.stateType.ToString()}"); return; } logger.Warn($"User is not an LBW member StateType={user.stateType.ToString()}"); user.Send(new Packet(ackData)); } } else { logger.Warn($"Is User Null~~~"); } } else { logger.Warn($"Error statusCode={resDataHeader.statusCode} statusMessage={resDataHeader.statusMessage}"); } }
public void IntlMsg_GetProxy(InternalMsg.InternalBaseMsg msg) { var intlMsg = msg as InternalMsg.IntlMsg_GetProxy; var resDataHeader = JsonConvert.DeserializeObject <LBD.ResponesDataHeader>(intlMsg.result); if (resDataHeader.statusCode == 1000) { var resData = JsonConvert.DeserializeObject <LBD.Respones_GetProxyInfo>(intlMsg.result); if (null != user) { if (resData.responseData.isApproved) { TcpMsg.MessageResponse ackData; if (user.stateType == UserStateType.CreateNickName) { ackData = new TcpMsg.AckCreateNickName(); } else if (user.stateType == UserStateType.ExistingUserConnect) { ackData = new TcpMsg.AckVerifyAccessToken() { authType = TcpMsg.AuthType.AuthSucess }; } else { logger.Warn($"User is not Proxy Approved User StateError StateType={user.stateType.ToString()}"); return; } user.Send(new Packet(ackData)); } else { logger.Debug($"User is not Proxy Approved RequestProxy UID={user.UID}"); LBD.LBDApiManager.Instance.AddLBDCmd(new LBD.Msg.LBDMsg_RequestProxy() { uid = user.UID, guid = user.Id.ToString(), fromUserId = user.lineUID, landingUri = string.Empty }); var ackData = new TcpMsg.AckRequestProxy(); user.Send(new Packet(ackData)); } } else { logger.Warn($"Is User Null~~~"); } } else { logger.Warn($"Error statusCode={resDataHeader.statusCode} statusMessage={resDataHeader.statusMessage}"); } }
public void CreateNickName(string nickname) { if (stateType == UserStateType.CreateNickName) { var repoUser = TCGGameSrv.IocContainer.Resolve <Repository.IUser>(); logger.Debug($"UserID={UID}, CreateNickName={nickname}"); var ackData = new TcpMsg.AckCreateNickName(); if (string.IsNullOrEmpty(nickname)) { ackData.errCode = TcpMsg.Error.NickNameNullOrEmpty; } else { var isNick = repoUser.ExistsUserNickName(nickname); if (isNick) { ackData.errCode = TcpMsg.Error.NickName_Already_Exists; } else { var tblUser = repoUser.GetUserFromUid(UID); tblUser.nickname = nickname; repoUser.Update(tblUser); GetWalletAddress(); logger.Info($"UserID={UID}, CreateNickName={nickName} Success"); return; } } if (ackData.errCode != TcpMsg.Error.None) { logger.Warn($"UID={UID} Error Code={ackData.errCode.ToString()}"); } Send(new Packet(ackData)); stateType = UserStateType.None; } }