|
@@ -3,6 +3,10 @@ using Common.Request.Label;
|
|
using Utils;
|
|
using Utils;
|
|
using Common;
|
|
using Common;
|
|
using Newtonsoft.Json.Linq;
|
|
using Newtonsoft.Json.Linq;
|
|
|
|
+using System.IO;
|
|
|
|
+using System;
|
|
|
|
+using System.Text;
|
|
|
|
+using System.Collections.Generic;
|
|
/// <summary>
|
|
/// <summary>
|
|
/// 商家寄件(官方快递)
|
|
/// 商家寄件(官方快递)
|
|
/// </summary>
|
|
/// </summary>
|
|
@@ -66,11 +70,14 @@ public static class LabelV2
|
|
string msg = "";
|
|
string msg = "";
|
|
string data = "";
|
|
string data = "";
|
|
string errorStr = "";
|
|
string errorStr = "";
|
|
|
|
+ Dictionary<string, string> logReq = null;
|
|
try
|
|
try
|
|
{
|
|
{
|
|
param.method = ApiInfoConstant.ORDER;
|
|
param.method = ApiInfoConstant.ORDER;
|
|
var request = ObjectToDictionaryUtils.ObjectToMap(param);
|
|
var request = ObjectToDictionaryUtils.ObjectToMap(param);
|
|
|
|
|
|
|
|
+ logReq = request;
|
|
|
|
+
|
|
if (request == null)
|
|
if (request == null)
|
|
{
|
|
{
|
|
msg = "body参数错误";
|
|
msg = "body参数错误";
|
|
@@ -90,6 +97,23 @@ public static class LabelV2
|
|
msg = "操作失败:" + ex.ToString();
|
|
msg = "操作失败:" + ex.ToString();
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ try
|
|
|
|
+ {
|
|
|
|
+ StringBuilder sb = new StringBuilder();
|
|
|
|
+ sb.AppendLine("----" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
|
|
|
|
+ sb.AppendLine("POST "+ ApiInfoConstant.NEW_TEMPLATE_URL);
|
|
|
|
+ sb.AppendLine("Request Body");
|
|
|
|
+ sb.AppendLine(Newtonsoft.Json.JsonConvert.SerializeObject(logReq));
|
|
|
|
+ sb.AppendLine("Response Body");
|
|
|
|
+ sb.AppendLine(data);
|
|
|
|
+ sb.AppendLine("");
|
|
|
|
+ WriteTxt(sb.ToString());
|
|
|
|
+ }
|
|
|
|
+ catch (Exception)
|
|
|
|
+ {
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
JObject result = new JObject();
|
|
JObject result = new JObject();
|
|
result.Add("code", code);
|
|
result.Add("code", code);
|
|
result.Add("msg", msg);
|
|
result.Add("msg", msg);
|
|
@@ -97,4 +121,22 @@ public static class LabelV2
|
|
|
|
|
|
return result.ToString();
|
|
return result.ToString();
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ #region 将字符串写入txt文档
|
|
|
|
+ private static void WriteTxt(string src)
|
|
|
|
+ {
|
|
|
|
+ string rFilePath = System.Environment.CurrentDirectory + "\\log" + DateTime.Today.ToString("yyyyMMdd");
|
|
|
|
+ FileStream fs = new FileStream(rFilePath, FileMode.Append);
|
|
|
|
+ byte[] data = Encoding.Default.GetBytes(src);
|
|
|
|
+ try
|
|
|
|
+ {
|
|
|
|
+ fs.Write(data, 0, data.Length);
|
|
|
|
+ fs.Flush();
|
|
|
|
+ fs.Close();
|
|
|
|
+ }
|
|
|
|
+ catch (Exception)
|
|
|
|
+ {
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ #endregion
|
|
}
|
|
}
|