kyy
2025-10-20 abda8a5571c81053222a3a4acdb3d35f51fc086b
WebApi/Gs.Toolbox/InterfaceUtil.cs
@@ -1,8 +1,9 @@
using System.Net.Cache;
using System.Net;
using System.Text;
using Newtonsoft.Json;
using Newtonsoft.Json;
using System.Data.SqlClient;
using System.Dynamic;
using System.Net;
using System.Net.Cache;
using System.Text;
namespace Gs.Toolbox;
@@ -38,7 +39,7 @@
            request.Method = "POST";
            request.ContentType = "application/json";
            request.Accept = "*/*";
            request.Timeout = 150000;
            //request.Timeout = 150000;
            request.AllowAutoRedirect = false;
            request.ServicePoint.Expect100Continue = false;
            HttpRequestCachePolicy noCachePolicy = new HttpRequestCachePolicy(HttpRequestCacheLevel.NoCacheNoStore);
@@ -54,6 +55,7 @@
                responseStr = reader.ReadToEnd();
                reader.Close();
            }
           // LogHelper.Debug(url, "HttpPostErp response:" + param + ",response:" + responseStr.ToString());
        }
        catch (Exception ex)
        {
@@ -67,10 +69,11 @@
            requestStream = null;
            response = null;
        }
        //{"msg":"操作成功","code":200,"data":{"number":"CGSL168397","code":"200","id":"268781"}}
        if (_rtn != -1)
        {
            Result _result = JsonConvert.DeserializeObject<Result>(responseStr);
            if ("200".Equals(_result.state))
            if ("200".Equals(_result.code))
                _rtn = 1;
        }
        sbLog.Append("," + DateTime.Now.ToString() + "结束发送");
@@ -102,16 +105,15 @@
        return (_rtn, (_rtn > 0 ? strLogGuid : responseStr));
    }
}
//{"msg":"操作成功","code":200,"data":{"number":"CGSL168397","code":"200","id":"268781"}}
public class Result
{
    /// <summary>
    /// 200成功,否则失败
    /// </summary>
    public string? state { get; set; }
    ///
    public string? msg { get; set; }
    public string? status { get; set; }
    public string? message { get; set; }
    public string? code { get; set; }
   // public string? data { get; set; }
}