|
|
|
@ -4,16 +4,16 @@ using Amazon.S3;
|
|
|
|
|
using System;
|
|
|
|
|
using S3Demo.Storage;
|
|
|
|
|
using S3Demo.Model;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
using System.Diagnostics;
|
|
|
|
|
using System.Text.RegularExpressions;
|
|
|
|
|
using System.IO;
|
|
|
|
|
using Ksat.Supplyment.Library.Model;
|
|
|
|
|
using Newtonsoft.Json;
|
|
|
|
|
|
|
|
|
|
namespace S3Demo
|
|
|
|
|
{
|
|
|
|
|
public class Run
|
|
|
|
|
{
|
|
|
|
|
//请求接口
|
|
|
|
|
private static string url = "http://127.0.0.1:9000/api/workflowcenter/anonymous/v1/trackgo/track";
|
|
|
|
|
private static BasicAWSCredentials credentials = new BasicAWSCredentials("admin", "admin123.");
|
|
|
|
|
//private static BasicAWSCredentials credentials = new BasicAWSCredentials("Q3AM3UQ867SPQQA43P2F", "zuf+tfteSlswRu7BJ86wekitnifILbZam1KYY3TG");
|
|
|
|
|
private static string bucketName = "minio/test";
|
|
|
|
@ -163,6 +163,7 @@ namespace S3Demo
|
|
|
|
|
string flag = ObjectModel.Putobjectswithtags(bucketName, S3Path, e.FullPath, tags, credentials, conf).Result;
|
|
|
|
|
if (flag.Equals("OK"))
|
|
|
|
|
{
|
|
|
|
|
//保存至数据库
|
|
|
|
|
using (var dev = new CodeFirstDbContext())
|
|
|
|
|
{
|
|
|
|
|
dev.UploadFinishs.Add(new Ksat.Supplyment.Library.Model.Uploader.UploadFinish()
|
|
|
|
@ -173,8 +174,13 @@ namespace S3Demo
|
|
|
|
|
RetryCount = 1,
|
|
|
|
|
RequestData = S3Path
|
|
|
|
|
});
|
|
|
|
|
string res = dev.SaveChanges() == 1 ? "上传并保存成功" : "上传成功,保存失败";
|
|
|
|
|
Console.WriteLine(res);
|
|
|
|
|
int saveInfo = dev.SaveChanges();//1: 保存至数据库成功,否则保存失败
|
|
|
|
|
ReqData req = new ReqData();
|
|
|
|
|
RespData resp = new RespData();
|
|
|
|
|
req.ruleName = "picSave";
|
|
|
|
|
req.picReq = saveInfo;
|
|
|
|
|
resp = JsonConvert.DeserializeObject<RespData>(HttpModel.PostUrl(url, JsonConvert.SerializeObject(req)));
|
|
|
|
|
Console.WriteLine("resp: " + resp.code + " " + resp.message);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
Console.WriteLine("S3对象存储路径: " + bucketName + "/" + S3Path);
|
|
|
|
|