public async Task<bool> UpdateUserDeviceTokenAynce(BahamutAppUser appUser, DeviceToken deviceToken) { try { var suc = await ChicagoServer.BahamutPubSubService.RegistUserDeviceAsync(appUser.UserData.UserId, appUser.DeviceToken, DeviceTokenExpireTime); if (suc) { appUser.DeviceToken = deviceToken; } return suc; } catch (Exception) { LogManager.GetLogger("Warn").Info("Regist Device Token Error:{0}", appUser.UserData.UserId); return false; } }
public void Login(ICSharpServerSession session, dynamic msg) { string appToken = msg.AppToken; string appkey = msg.Appkey; string userId = msg.UserId; Task.Run(async () => { var result = await ChicagoServer.TokenService.ValidateAppTokenAsync(appkey, userId, appToken); if (result != null) { var sharelinker = new BahamutAppUser() { Session = session, UserData = result, IsOnline = true }; session.RegistUser(sharelinker); this.SendJsonResponse(session, new { IsValidate = "true" }, ExtensionName, "Login"); LogManager.GetLogger("Info").Info("Login Success:{0}", userId); NotificaionCenterExtension.Instance.RegistUser(result.UserId, session); } else { LogManager.GetLogger("Info").Info("Login Failed:{0}", userId); this.SendJsonResponse(session, new { IsValidate = "false" }, ExtensionName, "Login"); } }); }
public bool RemoveUser(BahamutAppUser user) { //return userManager.RemoveUser(user); return false; }
private void SendBahamutNotifyCmd(BahamutPublishModel msgModel, BahamutAppUser registedUser) { var cmd = string.IsNullOrWhiteSpace(msgModel.CustomCmd) ? DEFAULT_NOTIFY_CMD : msgModel.CustomCmd; object resObj = null; if (msgModel.NotifyType == null && msgModel.Info == null) { resObj = new { }; } else if (msgModel.Info == null) { resObj = new { NotificationType = msgModel.NotifyType }; } else if (msgModel.NotifyType == null) { resObj = new { Info = msgModel.Info }; } else { resObj = new { NotificationType = msgModel.NotifyType, Info = msgModel.Info }; } this.SendJsonResponse(registedUser.Session, resObj, ExtensionName, cmd); }