diff --git a/93_nei_core/Getf_Service_Transfer_Client_Service_HttpHandler/HttpWebService.cs b/93_nei_core/Getf_Service_Transfer_Client_Service_HttpHandler/HttpWebService.cs index ed38dcf..c6af492 100644 --- a/93_nei_core/Getf_Service_Transfer_Client_Service_HttpHandler/HttpWebService.cs +++ b/93_nei_core/Getf_Service_Transfer_Client_Service_HttpHandler/HttpWebService.cs @@ -56,18 +56,36 @@ namespace Getf_Service_Transfer_Client_Service_HttpHandler var bodyParam = jObject["Param"]; if (data != null && data.Length > 0) { - httpRequst.SetRequestUrl(url + "byte"); - BodyEntity be = new(); + //httpRequst.SetRequestUrl(url + "byte"); + //BodyEntity be = new(); + //if (bodyData != null) + //{ + // if (bodyData["commond"] != null) + // be.commond = bodyData["commond"].ToString(); + // if (bodyData["fileName"] != null) + // be.FileName = bodyData["fileName"].ToString(); + // be.bytes = data; + //} + //httpRequst.SetBody(be); + ////_LogHelper.Info($"body:{Newtonsoft.Json.JsonConvert.SerializeObject(be)}"); + httpRequst.SetContentType("multipart/form-data"); if (bodyData != null) { + httpRequst.SetFiles(HttpFile.Create("file", data, "image.png")); if (bodyData["commond"] != null) - be.commond = bodyData["commond"].ToString(); - if (bodyData["fileName"] != null) - be.FileName = bodyData["fileName"].ToString(); - be.bytes = data; + { + var dic = new Dictionary(); + var childs = bodyData["commond"].Children(); + foreach (var child in childs) + { + var name = ((Newtonsoft.Json.Linq.JProperty)child).Name; + var value = ((Newtonsoft.Json.Linq.JProperty)child).Value.ToString(); + dic.Add(name, value); + } + //httpRequst.SetBody(Newtonsoft.Json.JsonConvert.DeserializeObject(bodyData["commond"].ToString()), "multipart/form-data"); + httpRequst.SetBody(dic, "multipart/form-data"); + } } - httpRequst.SetBody(be); - _LogHelper.Info($"body:{Newtonsoft.Json.JsonConvert.SerializeObject(be)}"); } else {