/// <summary> /// 发送邮件 /// </summary> /// <param name="recipients">收件人,支持多收件人,使用逗号分割</param> /// <param name="subject">标题</param> /// <param name="content">内容</param> /// <returns>是否成功</returns> public async Task <bool> SendAsync(string recipients, string subject, string content) { var model = new { Recipients = recipients, Subject = subject, Content = content, Merchant = "FiiiLab", SendLevel = 5 }; string url = ConfigurationManager.AppSettings["FP_EMAIL_API__URL"]; string emailToken = ConfigurationManager.AppSettings["Email_Token"]; var result = await RestUtilities.PostJsonAsync($"{url}/api/Message/PostEmail", new Dictionary <string, string> { { "bearer", emailToken } }, JsonConvert.SerializeObject(model)); //{"Data":null,"DataCount":0,"IsSuccess":false,"ReasonCode":10010,"Message":"验证失败"} return(true); }
/// <summary> /// 上传图片,同时生成缩略图 /// </summary> /// <param name="fileName"></param> /// <param name="bytes"></param> /// <returns></returns> public async Task <Guid[]> UploadWithThumbnailAsync(string fileName, byte[] bytes) { if (string.IsNullOrEmpty(blob_URL)) { throw new ArgumentException("Blob_URL not found"); } var url = blob_URL.TrimEnd('/') + "/File/UploadWithThumbnail"; var token = GenerateToken(); var json = JsonConvert.SerializeObject(new { FileName = fileName, File = bytes, FileType = "img" }); var result = await RestUtilities.PostJsonAsync(url, new Dictionary <string, string> { { "Authorization", "bearer " + token } }, json); var data = JsonConvert.DeserializeObject <ServiceResult <Guid[]> >(result); return(data.Code == 0 ? data.Data : null); }