|
@@ -1,5 +1,6 @@
|
|
|
using Azure.Cosmos;
|
|
|
using Azure.Storage.Blobs.Models;
|
|
|
+using Azure.Storage.Sas;
|
|
|
using HTEXLib.COMM.Helpers;
|
|
|
using HTEXLib.Models;
|
|
|
using Microsoft.Azure.Cosmos.Table;
|
|
@@ -867,6 +868,7 @@ namespace TEAMModelOS.FunctionV4.HttpTrigger
|
|
|
List<ArtStudentPdf> studentPdfs = _studentPdfs.Deserialize<List<ArtStudentPdf>>();
|
|
|
List<Task<string>> uploads = new List<Task<string>>();
|
|
|
studentPdfs.ForEach(x => {
|
|
|
+ x.blob = $"art/{x.artId}/report/{x.studentId}.json";
|
|
|
uploads.Add(_azureStorage.GetBlobContainerClient($"{_schoolCode}").UploadFileByContainer(x.ToJsonString(), "art", $"{x.artId}/report/{x.studentId}.json", true));
|
|
|
});
|
|
|
var uploadJsonUrls= await Task.WhenAll(uploads);
|
|
@@ -875,35 +877,44 @@ namespace TEAMModelOS.FunctionV4.HttpTrigger
|
|
|
(string uri, string sas) = _azureStorage.GetBlobContainerSAS($"{_schoolCode}",Azure.Storage.Sas.BlobContainerSasPermissions.Read);
|
|
|
studentPdfs.ForEach(x => {
|
|
|
string atrUrl = "https://teammodelos.blob.core.chinacloudapi.cn/0-public/art-report-template/report.html";
|
|
|
- var a = list.Find(l => l.Contains(x.studentId));
|
|
|
- if (a != null) {
|
|
|
- a = $"{HttpUtility.UrlEncode($"{a}?{sas}", Encoding.UTF8)}";
|
|
|
- string url = $"{atrUrl}?url={a}&pdfpath={x.artId}/report/{x.studentId}";
|
|
|
- urls.Add(url);
|
|
|
- }
|
|
|
+ var s = _azureStorage.GetBlobSAS($"{_schoolCode}", x.blob, BlobSasPermissions.Read);
|
|
|
+ s = $"{HttpUtility.UrlEncode($"{s}", Encoding.UTF8)}";
|
|
|
+ string url = $"{atrUrl}?url={s}&pdfpath={x.artId}/report/{x.studentId}";
|
|
|
+ urls.Add(url);
|
|
|
+ //var a = list.Find(l => l.Contains(x.studentId));
|
|
|
+ //if (a != null) {
|
|
|
+
|
|
|
+ // a = $"{HttpUtility.UrlEncode($"{a}?{sas}", Encoding.UTF8)}";
|
|
|
+ // string url = $"{atrUrl}?url={a}&pdfpath={x.artId}/report/{x.studentId}";
|
|
|
+ // urls.Add(url);
|
|
|
+ //}
|
|
|
});
|
|
|
string env = "release";
|
|
|
if (Environment.GetEnvironmentVariable("Option:Location").Contains("Test",StringComparison.CurrentCultureIgnoreCase)||
|
|
|
Environment.GetEnvironmentVariable("Option:Location").Contains("Dep", StringComparison.CurrentCultureIgnoreCase)) {
|
|
|
env = "develop";
|
|
|
}
|
|
|
+ var screenshot = new ScreenshotDto
|
|
|
+ {
|
|
|
+ width = 1080,
|
|
|
+ height = 1920,
|
|
|
+ urls = urls,
|
|
|
+ fileNameKey = "pdfpath",
|
|
|
+ cnt = $"{_schoolCode}",
|
|
|
+ root = "art",
|
|
|
+ pagesize = 5,
|
|
|
+ env = env
|
|
|
+ };
|
|
|
+ var st= screenshot.ToJsonString();
|
|
|
var httpResponse= await _httpClient.PostAsJsonAsync("http://cdhabook.teammodel.cn:8805/screen/screenshot-pdf",
|
|
|
- new ScreenshotDto
|
|
|
- {
|
|
|
- width = 1080,
|
|
|
- height=1920,
|
|
|
- urls= urls,
|
|
|
- fileNameKey= "pdfpath",
|
|
|
- cnt=$"{_schoolCode}",
|
|
|
- root="art",
|
|
|
- pagesize=5,
|
|
|
- env = env
|
|
|
- }
|
|
|
+ screenshot
|
|
|
);
|
|
|
+ List<string> resUrls = new List<string>();
|
|
|
if (httpResponse.StatusCode == HttpStatusCode.OK) {
|
|
|
JsonElement json_res = await httpResponse.Content.ReadFromJsonAsync<JsonElement>();
|
|
|
+ resUrls= json_res.GetProperty("urls").Deserialize<List<string>>();
|
|
|
}
|
|
|
- await response.WriteAsJsonAsync(new { data =new { count= studentPdfs.Count } });
|
|
|
+ await response.WriteAsJsonAsync(new { data =new { count= studentPdfs.Count , resUrls } });
|
|
|
return response;
|
|
|
}
|
|
|
|