public static async Task <bool> DeleteMessageImageTextAsync(int pkid) { using (var client = new Tuhu.Service.Push.MessageBoxPushClient()) { var result = await client.DeleteMessageImageTextAsync(pkid); result.ThrowIfException(true); return(result.Result > 0); } }
public static async Task <IEnumerable <MessageImageText> > SelectImageTextByBatchIdAsync(int templateid) { using (var client = new Tuhu.Service.Push.MessageBoxPushClient()) { var result = await client.SelectImageTextByBatchIdAsync(templateid); result.ThrowIfException(true); return(result.Result); } }
public static async Task <bool> LogMessageNavigationTypeAsync(MessageNavigationType type) { using (var client = new Tuhu.Service.Push.MessageBoxPushClient()) { var result = await client.LogMessageNavigationTypeAsync(type); result.ThrowIfException(true); return(result.Result > 0); } }
public static async Task <IEnumerable <MessageNavigationType> > SelectMessageNavigationTypesAsync() { using (var client = new Tuhu.Service.Push.MessageBoxPushClient()) { var result = await client.SelectAllMessageNavigationTypeAsync(); result.ThrowIfException(true); return(result.Result ?? new List <MessageNavigationType>().AsEnumerable()); } }
public IEnumerable <string> SelectAllTopicNames() { //var props = typeof(UserMessageSetting).GetProperties().Where(x => x.PropertyType == typeof(bool?)); //return props.Select(x => x.Name); using (var client = new Tuhu.Service.Push.MessageBoxPushClient()) { var result = client.SelectAllMessageNavigationType(); result.ThrowIfException(true); return(result.Result.Select(x => x.PushAlias)); } }
public static async Task <bool> SubmitMessageImageTextAsync(MessageImageText model) { using (var client = new Tuhu.Service.Push.MessageBoxPushClient()) { if (model.Pkid != 0) { var result = await client.UpdateMessageImageTextAsync(model); result.ThrowIfException(true); return(result.Result > 0); } else { var result = await client.InsertMessageImageTextAsync(model); result.ThrowIfException(true); return(result.Result > 0); } } }
public void Execute(IJobExecutionContext context) { string jobname = "handleusermessagesetting"; int maxpkid = 0; var checkresult = HandleExpiredMessageBoxJob.CheckIsOpenWithDescription(jobname); if (!checkresult.Item1) { Logger.Info("开关已关 return"); } var navigations = SelectAllMessageNavigationTypesAsync(); int.TryParse(checkresult.Item2, out maxpkid); int count = 0; while (true) { count++; Logger.Info($"开始刷新第{count}批次"); checkresult = HandleExpiredMessageBoxJob.CheckIsOpenWithDescription(jobname); if (!checkresult.Item1) { Logger.Info("开关已关 return"); } int.TryParse(checkresult.Item2, out maxpkid); var results = SelectUserMessageSetting(maxpkid); if (results != null && results.Any()) { Parallel.ForEach(results, new ParallelOptions() { MaxDegreeOfParallelism = 3 }, setting => { try { string topname = navigations.FirstOrDefault(x => x.PkId == setting.MessageNavigationType)?.PushAlias; if (!string.IsNullOrEmpty(topname)) { using (var client = new Tuhu.Service.Push.MessageBoxPushClient()) { var result = client.SubscribeUserMessageSwitchInfo(setting); result.ThrowIfException(true); } } } catch (System.Exception ex) { Logger.Warn("HandleUserMessageSettingJob ex=>" + ex); } }); HandleExpiredMessageBoxJob.UpdateRunTimeSwitchDescription(jobname, results.Max(x => x.PkId).ToString()); Logger.Info($"结束刷新第{count}批次"); } else { break; } } Logger.Info($"刷新结束"); }