public async Task <PagingResult <CodeGenHistoryEntity> > History(string id) { var tb = await storageService.CreateTableAsync("CodeGenHistories"); var query = new TableQuery <CodeGenHistoryEntity>().Where( TableQuery.GenerateFilterCondition("PartitionKey", QueryComparisons.Equal, id)); var result = await storageService.ExecuteQueryAsync(tb, query); return(new PagingResult <CodeGenHistoryEntity>() { data = result, skip = 0, take = result.Count, total = result.Count }); }
/// <summary> /// 发送邮件通知给订阅者 /// </summary> /// <param name="apiId"></param> /// <param name="log"></param> /// <returns></returns> public static async Task ApiresourcePublishNotify(string apiId, TextWriter log) { log.WriteLine(apiId); var tb = await storage.CreateTableAsync("ApiResourceSubscriptions"); var query = new TableQuery <ApiResourceSubscriptionEntity>().Where( TableQuery.GenerateFilterCondition("PartitionKey", QueryComparisons.Equal, apiId)); var result = await storage.ExecuteQueryAsync(tb, query); var mails = result.Select(x => x.RowKey).ToList(); if (mails.Count < 1) { log.WriteLine("没有订阅者"); return; } var vars = new Dictionary <string, string[]>(); vars.Add("%apiId%", new string[mails.Count]); for (var i = 0; i < mails.Count; i++) { vars["%apiId%"][i] = apiId; } log.WriteLine(string.Join(",", mails)); try { var sendResult = await mail.SendEmail(SendCloudMailTemplates.apiresource_published_notify, mails.ToArray(), vars); } catch (Exception ex) { log.WriteLine(ex.Message); } }