优化礼物单问题
This commit is contained in:
1 parent
2295b0df48
commit
b8674a11c5
5 files changed
+101
-151
No files matched your search
@@ -0,0 +1,87 @@
|
||||
using _29WxOrderWpf.BaseWindows;
|
||||
using AllBase;
|
||||
using AllBase.Helper;
|
||||
using AllBase.Model.DBModel;
|
||||
using NaiBa.Util.Extension;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Work;
|
||||
|
||||
namespace _29WxOrderWpf.Ctrls.OrderCtrls;
|
||||
|
||||
public class OrderGetOrderListHelper
|
||||
{
|
||||
/// <summary>
|
||||
/// 读取订单详情信息
|
||||
/// </summary>
|
||||
/// <param name="orderIds"></param>
|
||||
/// <returns></returns>
|
||||
static async Task<List<oms_wei_order_info>> GetOrderInfoBase(string orderIds, string shopIds = null, DateTime? beginUpdateTime = null, DateTime? endUpdateTime = null)
|
||||
{
|
||||
if (string.IsNullOrEmpty(orderIds))
|
||||
return new List<oms_wei_order_info>();
|
||||
|
||||
Thread.Sleep(100);
|
||||
try
|
||||
{
|
||||
var url = BaseClass.Build29WxObjString("order/get_erp_order_list");
|
||||
var data = UserLogin.GetSignaturex();
|
||||
data += "&erp_order_id_in=" + orderIds;
|
||||
data += "&page_size=" + 100;
|
||||
if (!string.IsNullOrWhiteSpace(shopIds))
|
||||
data += "&erp_shop_id_in=" + shopIds;
|
||||
if (beginUpdateTime != null && beginUpdateTime != DateTime.MinValue)
|
||||
{
|
||||
var startTime = BaseClass.DateTimeToTimestampSeconds(beginUpdateTime.Value);
|
||||
data += "&start_time=" + startTime;
|
||||
}
|
||||
if (endUpdateTime != null && endUpdateTime != DateTime.MinValue)
|
||||
{
|
||||
var endTime = BaseClass.DateTimeToTimestampSeconds(endUpdateTime.Value);
|
||||
data += "&end_time=" + endTime;
|
||||
}
|
||||
var html = GetHtml.PostUtf8(url, data);
|
||||
if (string.IsNullOrEmpty(html) || !html.Contains("\"code\":200"))
|
||||
html = GetHtml.PostUtf8(url, data);
|
||||
if (string.IsNullOrEmpty(html) || !html.Contains("\"code\":200"))
|
||||
{
|
||||
throw new Exception("订单读取失败 " + BaseRegex.GetStringJson(ref html, "msg"));
|
||||
}
|
||||
List<oms_wei_order_info> orders = new List<oms_wei_order_info>();
|
||||
orders = JsonHelper.DeserializeJsonToList<oms_wei_order_info>(JObject.Parse(html)["data"].ParseToString());
|
||||
if (orders == null)
|
||||
orders = new List<oms_wei_order_info>();
|
||||
|
||||
var orderItems = await OrderListCtrl.GetOrderItemInfo(orderIds);
|
||||
foreach (var orderItem in orderItems)
|
||||
{
|
||||
var order = orders.FirstOrDefault(o => o.order_id == orderItem.order_id);
|
||||
orderItem.ItemOrder = order;
|
||||
order.orderItems.Add(orderItem);
|
||||
}
|
||||
return orders;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
BaseMsgWindow.ShowAnimateMessage(ex.Message, "Error", 6);
|
||||
return new List<oms_wei_order_info>();
|
||||
}
|
||||
}
|
||||
|
||||
public static async Task<List<oms_wei_order_info>> GetOrderInfo(string order_ids)
|
||||
{
|
||||
return await GetOrderInfoBase(order_ids, null, null);
|
||||
}
|
||||
|
||||
public static async Task<List<oms_wei_order_info>> GetWxOrderIncrementAsync()
|
||||
{
|
||||
|
||||
|
||||
return new List<oms_wei_order_info>();
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user