add request api

master
ZGGSONG 3 years ago
parent fb4fcc2ae6
commit 92d9ce43ad

@ -6,7 +6,6 @@ namespace S3Demo.Helper
/// 单例模式
/// </summary>
/// <typeparam name="T">//new()new不支持非公共的无参构造函数 </typeparam>
// Token: 0x0200016F RID: 367
public abstract class SingletonHelper<T> where T : class
{
private static T sInstance;

@ -6,12 +6,12 @@ using System.Threading.Tasks;
namespace S3Demo.Model
{
public class ReqData
public class ScadaRequest
{
public string s3Flag { get; set; }
public int dbFlag { get; set; }
public DateTime dateTime { get; set; }
}
public class RespData
public class ScadaResponse
{
/// <summary>
/// 返回代码200 接口访问成功

@ -1,11 +1,12 @@
using System;
using S3Demo.Helper;
using Ksat.Supplyment.Library.Uploader;
using Ksat.Logging;
using System.Threading.Tasks;
using Amazon.S3;
using Newtonsoft.Json;
using Amazon;
using Amazon.S3;
using Amazon.Runtime;
using S3Demo.Helper;
using Ksat.Supplyment.Library.Uploader;
using Ksat.Logging;
namespace S3Demo.Model.Uploader
{
@ -34,6 +35,10 @@ namespace S3Demo.Model.Uploader
public event UploadFinishHandler UploadFinish;
/// <summary>
/// Scada Api
/// </summary>
private static string url = "http://172.17.204.30:9000/api/tri/imagesupload";
public void Cancel()
{
@ -52,7 +57,12 @@ namespace S3Demo.Model.Uploader
string res = await mTask;
UploadFinish(this, res.Equals("OK"), res);
//TODO: 请求接口,上传状态
ScadaRequest req = new ScadaRequest();
ScadaResponse resp = new ScadaResponse();
req.s3Flag = res;
resp = JsonConvert.DeserializeObject<ScadaResponse>(Helper.HttpHelper.PostUrl(url, JsonConvert.SerializeObject(req)));
Console.WriteLine($"{DateTime.Now.ToString("HH:mm:ss.fff")} s3Recv {RequestData.Keyname} ==>{res}");
Console.WriteLine($"{DateTime.Now.ToString("HH:mm:ss.fff")} ScadaRecv ==>{resp.code} & {resp.message}");
}
}
}

Loading…
Cancel
Save