增加同步物流模块
修改现有架构,改为分模块( 简易版)
This commit is contained in:
1 parent
15e11618c9
commit
fa03add754
120 files changed
+9438
-299
No files matched your search
@@ -0,0 +1,153 @@
|
||||
using Autofac;
|
||||
using Autofac.Integration.WebApi;
|
||||
using KJD_Web;
|
||||
using KJD_Web.Services.Users;
|
||||
using MAX.Core.Cryptography;
|
||||
using MAX.Core.Helpers;
|
||||
using Store.Framework.DependencyInjection;
|
||||
using Store.VirtualLogistics.Apis;
|
||||
using Store.VirtualLogistics.Models;
|
||||
using Store.VirtualLogistics.Services;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using System.Security.Cryptography;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Web.Http;
|
||||
|
||||
namespace WebServiceTest;
|
||||
|
||||
internal class GiftLogisticsTest
|
||||
{
|
||||
private static NUnitDebugListener? _listener;
|
||||
private IContainer _container;
|
||||
private VirtualLogisticsApi logisticsApi;
|
||||
|
||||
[SetUp]
|
||||
public void Setup()
|
||||
{
|
||||
_listener = new NUnitDebugListener();
|
||||
Debug.Listeners.Add(_listener);
|
||||
var config = new HttpConfiguration();
|
||||
_container = ContainerConfig.BuildContainer();
|
||||
config.DependencyResolver = new AutofacWebApiDependencyResolver(_container);
|
||||
WebApiConfig.Register(config);
|
||||
logisticsApi = _container.Resolve<VirtualLogisticsApi>();
|
||||
}
|
||||
[TearDown]
|
||||
public void TearDown()
|
||||
{
|
||||
_container?.Dispose();
|
||||
_listener.Dispose();
|
||||
}
|
||||
[Test]
|
||||
public void TestSign()
|
||||
{
|
||||
//new GiftLogisticsApi().GetSign();
|
||||
long sid = 1574769204;
|
||||
string UserName = "liang";
|
||||
string Passworkd = "123456";
|
||||
string pwd = MD5Helper.Md5_Lower32(MD5Helper.Md5_Lower32(Passworkd));
|
||||
string s = $"{UserName}{pwd}{sid}";
|
||||
string sign = MD5Helper.Md5_Lower32(s);
|
||||
Console.Write(sign);
|
||||
|
||||
}
|
||||
[Test]
|
||||
public void GetUserMoneyTest()
|
||||
{
|
||||
var user = logisticsApi.GetUserMoney();
|
||||
Console.WriteLine(user.Money);
|
||||
}
|
||||
[Test]
|
||||
public void GetExpressListTest()
|
||||
{
|
||||
var user = logisticsApi.GetExpressList();
|
||||
Console.WriteLine(string.Join(" ", user.Select(a => a.Name)));
|
||||
}
|
||||
[Test]
|
||||
public void GetCangListTest()
|
||||
{
|
||||
var list = logisticsApi.GetCangList();
|
||||
Console.WriteLine(string.Join(" ", list.Select(a => $"{a.CangId}:{a.SendProvince}{a.SendCity}{a.SendDistrict}{a.SendAddress}")));
|
||||
}
|
||||
[Test]
|
||||
public void GetGoodsListTest()
|
||||
{
|
||||
var list = logisticsApi.GetGoodsList();
|
||||
Console.WriteLine(string.Join(" ", list.Select(a => $"{a.GoodsId}:{a.GoodsName}({a.Price})")));
|
||||
}
|
||||
[Test]
|
||||
public void QueryOrderStatus()
|
||||
{
|
||||
try
|
||||
{
|
||||
var ret = logisticsApi.QueryOrderStatus(["260705-168736857712823"]);
|
||||
Console.WriteLine(string.Join(" ", ret.Data.Select(a => $"{a.OrderSn}:{a.KuaidiSn}({a.Status})")));
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine(ex.Message);
|
||||
}
|
||||
}
|
||||
[Test]
|
||||
public void BuyTest()
|
||||
{
|
||||
//var request = new BuyRequest
|
||||
//{
|
||||
// KuaidiId = "874",
|
||||
// GoodsId = "8473",
|
||||
// CangId = "914",
|
||||
// Platform = 6,
|
||||
// Auth = 1,
|
||||
// SendName = "张三",
|
||||
// SendMobile = "18255185853",
|
||||
// SendProvince = "辽宁省",
|
||||
// SendCity = "大连市",
|
||||
// SendDistrict = "甘井子区",
|
||||
// SendAddress = "革镇堡幸福家园2栋",
|
||||
// RecList = new List<RecItem>
|
||||
// {
|
||||
// new RecItem
|
||||
// {
|
||||
// OrderSn = "3739252814971847936",
|
||||
// RecName = "李四",
|
||||
// RecMobile = "18255185853",
|
||||
// RecProvince = "湖南省",
|
||||
// RecCity = "衡阳市",
|
||||
// RecDistrict = "雁峰区",
|
||||
// RecAddress = "和谐小区 1栋",
|
||||
// OtherKuaidiSn="315097997688420"
|
||||
// }
|
||||
// }
|
||||
//};
|
||||
//var ret = logisticsApi.Buy(request);
|
||||
var userService = _container.Resolve<VirtualLogisticsService>();
|
||||
var ret = userService.Buy("260705-168736857712823", "4439341152678214144");
|
||||
if (ret != null)
|
||||
{
|
||||
Console.WriteLine(string.Join(" ", ret.Select(a => $"{a.OrderId}:{a.TrackingNumber}")));
|
||||
}
|
||||
}
|
||||
[Test]
|
||||
public void UploadPickupTest()
|
||||
{
|
||||
var data = new List<PickupItem>
|
||||
{
|
||||
new PickupItem
|
||||
{
|
||||
BufaSn = "SF1234567890",
|
||||
PickupCode = "1-2-3",
|
||||
Address = "菜鸟驿站"
|
||||
}
|
||||
};
|
||||
var ret = logisticsApi.UploadPickup(data);
|
||||
Console.WriteLine($"{ret.Code} {ret.Msg}");
|
||||
if (ret.Data != null)
|
||||
{
|
||||
Console.WriteLine(string.Join(" ", ret.Data.Select(a => $"{a.BufaSn}:{a.Success}")));
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user