diff --git a/Store.SyncLogistics/Apis/VirtualLogisticsApi.cs b/Store.SyncLogistics/Apis/VirtualLogisticsApi.cs
index b7c8c8f..b3f95ec 100644
--- a/Store.SyncLogistics/Apis/VirtualLogisticsApi.cs
+++ b/Store.SyncLogistics/Apis/VirtualLogisticsApi.cs
@@ -147,6 +147,34 @@ public class VirtualLogisticsApi : ISingletonDependency
});
}
+ ///
+ /// 查询快递订单信息及状态
+ ///
+ public Result> GetOrderStatus(string[] orders)
+ {
+ var res = ServerRequest>(new HttpItem
+ {
+ URL = "/api/lipin/status",
+ Postdata = JsonConvert.SerializeObject(new
+ {
+ show_delivery = 1,
+ order_sn = orders
+ }),
+ Method = MethodType.Post
+ });
+
+ var ret = new Result>()
+ {
+ Code = res.Code,
+ Success = res.Success,
+ Msg = res.Msg,
+ };
+ if (res.Success)
+ {
+ ret.Data = res.Data.Values.ToList();
+ }
+ return ret;
+ }
@@ -165,7 +193,7 @@ public class VirtualLogisticsApi : ISingletonDependency
}
item.Encoding = Encoding.UTF8;
- item.ProxyIp = "127.0.0.1:8080";
+ //item.ProxyIp = "127.0.0.1:8080";
long unix = DateHelper.GetCurrentUnixTimestampInSeconds();
diff --git a/Store.SyncLogistics/Controllers/LogisticsController.cs b/Store.SyncLogistics/Controllers/LogisticsController.cs
index 3ad5178..308393f 100644
--- a/Store.SyncLogistics/Controllers/LogisticsController.cs
+++ b/Store.SyncLogistics/Controllers/LogisticsController.cs
@@ -131,12 +131,30 @@ public class LogisticsController : ApiControllerBase
return Ok(ApiResult.Fail(ex.Message));
}
}
+ //[HttpPost]
+ //public IHttpActionResult GetSyncLogistics(string orderId)
+ //{
+ // try
+ // {
+ // var result = _logisticsService.GetSyncLogistics(orderId);
+ // return Ok(ApiResult.Success(result));
+ // }
+ // catch (Exception ex)
+ // {
+ // return Ok(ApiResult.Fail(ex.Message));
+ // }
+ //}
+ ///
+ /// 查询订单中状态
+ ///
+ ///
+ ///
[HttpPost]
- public IHttpActionResult GetSyncLogistics(string orderId)
+ public IHttpActionResult GetOrderStatus(string orderId)
{
try
{
- var result = _logisticsService.GetSyncLogistics(orderId);
+ var result = _logisticsService.GetOrderStatus([orderId]);
return Ok(ApiResult.Success(result));
}
catch (Exception ex)
diff --git a/Store.SyncLogistics/Dtos/OrderStatusRequest.cs b/Store.SyncLogistics/Dtos/OrderStatusRequest.cs
new file mode 100644
index 0000000..f00564f
--- /dev/null
+++ b/Store.SyncLogistics/Dtos/OrderStatusRequest.cs
@@ -0,0 +1,14 @@
+using Newtonsoft.Json;
+using Store.Framework.Dtos;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Store.SyncLogistics.Dtos;
+
+public class OrderStatusRequest : SignRequestBase
+{
+ public string[] Orders { get; set; }
+}
diff --git a/Store.SyncLogistics/Models/OrderStatusQuery.cs b/Store.SyncLogistics/Models/OrderStatusQuery.cs
index 2672367..f8da0cd 100644
--- a/Store.SyncLogistics/Models/OrderStatusQuery.cs
+++ b/Store.SyncLogistics/Models/OrderStatusQuery.cs
@@ -42,4 +42,26 @@ public class OrderStatusResultItem
///
public string Status { get; set; }
public decimal Price { get; set; }
+
+
+ ///
+ /// 店铺订单号
+ ///
+ public string ShopOrder { get; set; }
+
+
+ ///
+ /// 提示信息
+ ///
+ public string Msg { get; set; }
+
+ ///
+ /// 发货状态:0:无需发货,1:未发货,2:已发货,3:处理中,4:发货失败
+ ///
+ public string DeliveryStatus { get; set; }
+
+ ///
+ /// 发货结果描述
+ ///
+ public string DeliveryResult { get; set; }
}
\ No newline at end of file
diff --git a/Store.SyncLogistics/Services/VirtualLogisticsService.cs b/Store.SyncLogistics/Services/VirtualLogisticsService.cs
index 1c3196d..e61301f 100644
--- a/Store.SyncLogistics/Services/VirtualLogisticsService.cs
+++ b/Store.SyncLogistics/Services/VirtualLogisticsService.cs
@@ -236,4 +236,9 @@ public class VirtualLogisticsService : ITransientDependency
return item;
}
+ public List GetOrderStatus(string[] orders)
+ {
+ return _api.GetOrderStatus(orders).Data;
+ }
+
}
diff --git a/test/WebServiceTest/GiftLogisticsTest.cs b/test/WebServiceTest/GiftLogisticsTest.cs
index 1ea91ca..4ada594 100644
--- a/test/WebServiceTest/GiftLogisticsTest.cs
+++ b/test/WebServiceTest/GiftLogisticsTest.cs
@@ -4,6 +4,7 @@ using KJD_Web;
using KJD_Web.Services.Users;
using MAX.Core.Cryptography;
using MAX.Core.Helpers;
+using Org.BouncyCastle.Ocsp;
using Store.Framework.DependencyInjection;
using Store.VirtualLogistics.Apis;
using Store.VirtualLogistics.Models;
@@ -96,7 +97,7 @@ internal class GiftLogisticsTest
public void BuyTest()
{
var logisticsService = _container.Resolve();
- var ret = logisticsService.Buy("15222220006","260923-573109716621688", "4439363558732480512");
+ var ret = logisticsService.Buy("15222220006", "260923-573109716621688", "4439363558732480512");
if (ret != null)
{
Console.WriteLine(string.Join(" ", ret.Select(a => $"{a.OrderId}:{a.TrackingNumber}")));
@@ -117,10 +118,18 @@ internal class GiftLogisticsTest
}
};
var logisticsService = _container.Resolve();
- var ret = logisticsService.UploadPickup("15222220006","260923-573109716621688","1-2-3");
+ var ret = logisticsService.UploadPickup("15222220006", "260923-573109716621688", "1-2-3");
if (ret)
{
}
}
+
+ [Test]
+ public void GetOrderStatus()
+ {
+ var logisticsService = _container.Resolve();
+ var data = logisticsService.GetOrderStatus(["260923-573109716621688"]);
+ Console.WriteLine(string.Join(" ", data.Select(a => $"{a.OrderSn}:{a.ShopOrder}:{a.DeliveryStatus}")));
+ }
}