public static async Task <PushTemplate> SelectTemplateByPKIDAsync(int pkid) { using (var client = new Tuhu.Service.PushApi.TemplateApiClient()) { var result = await client.GetTemplatesByPkIdAsync(pkid); result.ThrowIfException(true); return(result.Result); } }
public static async Task <bool> UpdateTemplatePushStatusAsync(int pkid, PushStatus status) { using (var client = new Tuhu.Service.PushApi.TemplateApiClient()) { var result = await client.UpdateTemplatePushStatusAsync(pkid, status.Cast <Tuhu.Service.PushApi.Models.Push.PushStatus>()); result.ThrowIfException(true); var data = result.Result; return(data); } }
public static async Task <TemplateQueryResult> SelectPushTemplatesAsync(TemplateQuery query) { using (var client = new Tuhu.Service.PushApi.TemplateApiClient()) { var result = await client.QueryTemplatesAsync(query.Cast <Tuhu.Service.PushApi.Models.Push.TemplateQuery>()); result.ThrowIfException(true); var datas = result.Result; return(datas.Cast <TemplateQueryResult>()); } }
public static async Task <int> UpdateTemplateBatchIDAsync(int templateid, int batchid) { using (var client = new Tuhu.Service.PushApi.TemplateApiClient()) { var result = await client.UpdateTemplateBatchIdByPkIdAsync(templateid, batchid); result.ThrowIfException(true); var datas = result.Result; return(datas); } }
public static async Task <int> CreateOrUpdateTemplateAsync(PushTemplate template) { try { #if DEBUG template.CreateUser = "******"; #endif if (template.PKID != 0) { using (var client = new Tuhu.Service.PushApi.TemplateApiClient()) { var result = await client.UpdateTemplateAsync(template); result.ThrowIfException(true); var datas = result.Result; return(datas); } } else { if (template.BatchID != 0) { var temp = await SelectPushTemplateByBatchIDAndDeviceTypeAsync(template.BatchID, template.DeviceType); if (temp != null) { template.PKID = temp.PKID; return(await CreateOrUpdateTemplateAsync(template)); } } if (string.IsNullOrEmpty(template.PlanName)) { template.PlanName = "计划名称"; } using (var client = new Tuhu.Service.PushApi.TemplateApiClient()) { var result = await client.CreateTemplateAsync(template); result.ThrowIfException(true); var datas = result.Result; return(datas); } } } catch (System.Exception ex) { WebLog.LogException(ex); return(0); } }
public static async Task <bool> UpdateTemplatePlanInfoAsync(int batchid, string planname, DateTime templateExpireTime, Dictionary <int, PushStatus> status) { using (var client = new Tuhu.Service.PushApi.TemplateApiClient()) { var result = await client.UpdatePlanAsync(batchid, new Service.PushApi.Models.Push.UpdatePlanRequest() { PlanName = planname, Status = status, TemplateExpireTime = templateExpireTime }); result.ThrowIfException(true); var datas = result.Result; return(datas); } }
public static async Task <IEnumerable <WxTemplateInfo> > SelectAllBaiduTemplateAsync() { using (var client = new Tuhu.Service.PushApi.TemplateApiClient()) { var result = await client.GetBaiduTemplateListAsync(); result.ThrowIfException(true); var datas = result.Result; return(datas.Select(x => new WxTemplateInfo() { template_id = x.TemplateId, content = x.Content, example = x.Example, title = x.Title } )); } }