SVN-Revision: r970
This commit is contained in:
tdx
2025-09-08 10:33:40 +00:00
parent a08d5d33fa
commit 5e3fef9e5f
3 changed files with 47 additions and 2 deletions
@@ -342,6 +342,50 @@ namespace Lskj.QueryEssentialInfo
return code;
}
/// <summary>
/// 初始化
/// </summary>
public static string Init(out string resultRead, out string resultMsg)
{
string code = "-9999";
resultRead = "";
resultMsg = "";
try
{
string url = "http://swgxs.poc.htjs.net:9019/v2/web/sbmk/personal-tax/api/v1/gsmycsh";
HttpTools.setting("application/json", null, null, HttpTools.Encode.UTF8);
Dictionary<string, string> headerDic = new Dictionary<string, string>();
DateTime utcNow = DateTime.UtcNow;
string date = utcNow.ToString("r", CultureInfo.InvariantCulture);
string host = "api.baiwangjs.com";
string x_htjs_nonce = Guid.NewGuid().ToString().ToLower();
string x_htjs_ua = "1.8.0_181 64 bit, sdk-ver=1.0.0";
headerDic.Add("Date", DateTime.UtcNow.ToString());
headerDic.Add("host", host);
headerDic.Add("x-htjs-nonce", x_htjs_nonce);
headerDic.Add("x-htjs-ua", x_htjs_ua);
headerDic.Add("Authorization", $"{GetAuthorization(date, host, x_htjs_nonce, x_htjs_ua)}");
JObject pmsJObject = new JObject();
pmsJObject.Add("requestId", Guid.NewGuid().ToString().Replace("-", "").ToLower());
pmsJObject.Add("accountId", "1");
pmsJObject.Add("busiTypeCode", mainRow["busiTypeCode"] + "");
pmsJObject.Add("qysh", mainRow["qysh"] + "");
pmsJObject.Add("operator", mainRow["operator"] + "");
HttpWebResponse webResponse = HttpTools.Post(url, JsonConvert.SerializeObject(pmsJObject), null, headerDic, HttpTools.Method.POST);
resultRead = new StreamReader(webResponse.GetResponseStream(), Encoding.UTF8).ReadToEnd();
if (webResponse != null && !string.IsNullOrEmpty(resultRead))
{
JObject resultJObject = (JObject)JsonConvert.DeserializeObject(resultRead);
code = resultJObject["code"] + "";
resultMsg = resultJObject["msg"] + "";
}
}
catch (Exception)
{
throw;
}
return code;
}
/// <summary>
/// 同步人员
/// </summary>
public static string Person(out string resultRead, out string resultMsg)