增加查询同步物流订单状态
This commit is contained in:
1 parent
ae1949c9c2
commit
e126c6c0ff
6 files changed
+101
-5
No files matched your search
@@ -147,6 +147,34 @@ public class VirtualLogisticsApi : ISingletonDependency
|
||||
});
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查询快递订单信息及状态
|
||||
/// </summary>
|
||||
public Result<List<OrderStatusResultItem>> GetOrderStatus(string[] orders)
|
||||
{
|
||||
var res = ServerRequest<Dictionary<string, OrderStatusResultItem>>(new HttpItem
|
||||
{
|
||||
URL = "/api/lipin/status",
|
||||
Postdata = JsonConvert.SerializeObject(new
|
||||
{
|
||||
show_delivery = 1,
|
||||
order_sn = orders
|
||||
}),
|
||||
Method = MethodType.Post
|
||||
});
|
||||
|
||||
var ret = new Result<List<OrderStatusResultItem>>()
|
||||
{
|
||||
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();
|
||||
|
||||
|
||||
@@ -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));
|
||||
// }
|
||||
//}
|
||||
/// <summary>
|
||||
/// 查询订单中状态
|
||||
/// </summary>
|
||||
/// <param name="orderId"></param>
|
||||
/// <returns></returns>
|
||||
[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)
|
||||
|
||||
@@ -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; }
|
||||
}
|
||||
@@ -42,4 +42,26 @@ public class OrderStatusResultItem
|
||||
/// </summary>
|
||||
public string Status { get; set; }
|
||||
public decimal Price { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 店铺订单号
|
||||
/// </summary>
|
||||
public string ShopOrder { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 提示信息
|
||||
/// </summary>
|
||||
public string Msg { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 发货状态:0:无需发货,1:未发货,2:已发货,3:处理中,4:发货失败
|
||||
/// </summary>
|
||||
public string DeliveryStatus { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 发货结果描述
|
||||
/// </summary>
|
||||
public string DeliveryResult { get; set; }
|
||||
}
|
||||
@@ -236,4 +236,9 @@ public class VirtualLogisticsService : ITransientDependency
|
||||
return item;
|
||||
}
|
||||
|
||||
public List<OrderStatusResultItem> GetOrderStatus(string[] orders)
|
||||
{
|
||||
return _api.GetOrderStatus(orders).Data;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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<VirtualLogisticsService>();
|
||||
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<VirtualLogisticsService>();
|
||||
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<VirtualLogisticsService>();
|
||||
var data = logisticsService.GetOrderStatus(["260923-573109716621688"]);
|
||||
Console.WriteLine(string.Join(" ", data.Select(a => $"{a.OrderSn}:{a.ShopOrder}:{a.DeliveryStatus}")));
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user