From 356982014b3f6133a56fc03c13a78d2cdfc8dda6 Mon Sep 17 00:00:00 2001 From: wufan Date: Tue, 14 Jan 2025 14:10:38 +0800 Subject: [PATCH] :memo: --- .../ShopifyUsedSaleOrderDto.cs | 162 ++++++++++++++++++ TradeManageNew/TradeManageNew.csproj | 1 + .../Models/DT_ShopifyUsedSaleOrder.cs | 100 +++++++++++ .../Models/DT_ShopifyUsedSaleOrderItem.cs | 33 ++++ TradeUsedSale/TradeUsedSale.csproj | 2 + 5 files changed, 298 insertions(+) create mode 100644 TradeManageNew/Models/ShopifyUsedSale/ShopifyUsedSaleOrderDto.cs create mode 100644 TradeUsedSale/Repositories/Models/DT_ShopifyUsedSaleOrder.cs create mode 100644 TradeUsedSale/Repositories/Models/DT_ShopifyUsedSaleOrderItem.cs diff --git a/TradeManageNew/Models/ShopifyUsedSale/ShopifyUsedSaleOrderDto.cs b/TradeManageNew/Models/ShopifyUsedSale/ShopifyUsedSaleOrderDto.cs new file mode 100644 index 0000000..243f71c --- /dev/null +++ b/TradeManageNew/Models/ShopifyUsedSale/ShopifyUsedSaleOrderDto.cs @@ -0,0 +1,162 @@ +using System; +using System.Collections.Generic; +using System.Globalization; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; + +namespace TradeManageNew.Models.ShopifyUsedSale +{ + public partial class ShopifyUsedSaleOrderDto + { + [JsonProperty("order")] public Order Order { get; set; } + + [JsonProperty("recipient")] public Recipient Recipient { get; set; } + + [JsonProperty("items")] public List Items { get; set; } + + [JsonProperty("financial")] public Financial Financial { get; set; } + + [JsonProperty("customer")] public Customer Customer { get; set; } + + [JsonProperty("remark")] public Remark Remark { get; set; } + } + + public class Customer + { + [JsonProperty("email")] public string Email { get; set; } + + [JsonProperty("phone")] public string Phone { get; set; } + + [JsonProperty("first_name")] public string FirstName { get; set; } + + [JsonProperty("last_name")] public string LastName { get; set; } + + [JsonProperty("customer_id")] public string CustomerId { get; set; } + } + + public class Financial + { + [JsonProperty("currency")] public string Currency { get; set; } + + [JsonProperty("total_price")] public decimal TotalPrice { get; set; } + + [JsonProperty("subtotal_price")] public decimal SubtotalPrice { get; set; } + + [JsonProperty("total_tax")] public decimal TotalTax { get; set; } + + [JsonProperty("total_discounts")] public decimal TotalDiscounts { get; set; } + + [JsonProperty("shipping_price")] public decimal ShippingPrice { get; set; } + + [JsonProperty("payment_method")] public string PaymentMethod { get; set; } + + [JsonProperty("financial_status")] public string FinancialStatus { get; set; } + + [JsonProperty("refunded_amount")] public decimal RefundedAmount { get; set; } + } + + public class Item + { + [JsonProperty("origin_sku")] public string OriginSku { get; set; } + + [JsonProperty("sku")] public string Sku { get; set; } + + [JsonProperty("product_code")] public string ProductCode { get; set; } + + [JsonProperty("quantity")] public int Quantity { get; set; } + + [JsonProperty("price")] public decimal Price { get; set; } + + [JsonProperty("title")] public string Title { get; set; } + + [JsonProperty("variant_title")] public string VariantTitle { get; set; } + + [JsonProperty("product_id")] public string ProductId { get; set; } + + [JsonProperty("variant_id")] public string VariantId { get; set; } + + [JsonProperty("properties")] public List Properties { get; set; } + + [JsonProperty("image")] public string Image { get; set; } + + [JsonProperty("shipping_method")] public string ShippingMethod { get; set; } + } + + public class Order + { + [JsonProperty("order_id")] public string OrderId { get; set; } + + [JsonProperty("order_number")] public string OrderNumber { get; set; } + + [JsonProperty("order_name")] public string OrderName { get; set; } + + [JsonProperty("created_at")] public DateTimeOffset CreatedAt { get; set; } + + [JsonProperty("updated_at")] public DateTimeOffset UpdatedAt { get; set; } + + [JsonProperty("processed_at")] public DateTimeOffset ProcessedAt { get; set; } + } + + public class Recipient + { + [JsonProperty("name")] public string Name { get; set; } + + [JsonProperty("phone")] public string Phone { get; set; } + + [JsonProperty("address")] public Address Address { get; set; } + } + + public class Address + { + [JsonProperty("full")] public string Full { get; set; } + + [JsonProperty("detail")] public string Detail { get; set; } + + [JsonProperty("detail2")] public string Detail2 { get; set; } + + [JsonProperty("city")] public string City { get; set; } + + [JsonProperty("province")] public string Province { get; set; } + + [JsonProperty("province_code")] public string ProvinceCode { get; set; } + + [JsonProperty("zip")] public string Zip { get; set; } + + [JsonProperty("country")] public string Country { get; set; } + + [JsonProperty("country_code")] public string CountryCode { get; set; } + } + + public partial class Remark + { + [JsonProperty("note")] public string Note { get; set; } + + [JsonProperty("tags")] public string Tags { get; set; } + } + + public partial class ShopifyUsedSaleOrderDto + { + public static ShopifyUsedSaleOrderDto FromJson(string json) => + JsonConvert.DeserializeObject(json, + TradeManageNew.Models.ShopifyUsedSale.Converter.Settings); + } + + public static class Serialize + { + public static string ToJson(this ShopifyUsedSaleOrderDto self) => + JsonConvert.SerializeObject(self, TradeManageNew.Models.ShopifyUsedSale.Converter.Settings); + } + + internal static class Converter + { + public static readonly JsonSerializerSettings Settings = new JsonSerializerSettings + { + MetadataPropertyHandling = MetadataPropertyHandling.Ignore, + DateParseHandling = DateParseHandling.None, + Converters = + { + new IsoDateTimeConverter { DateTimeStyles = DateTimeStyles.AssumeUniversal } + }, + }; + } +} \ No newline at end of file diff --git a/TradeManageNew/TradeManageNew.csproj b/TradeManageNew/TradeManageNew.csproj index 8bf2781..30b8669 100644 --- a/TradeManageNew/TradeManageNew.csproj +++ b/TradeManageNew/TradeManageNew.csproj @@ -2920,6 +2920,7 @@ + OrderAPI.ashx diff --git a/TradeUsedSale/Repositories/Models/DT_ShopifyUsedSaleOrder.cs b/TradeUsedSale/Repositories/Models/DT_ShopifyUsedSaleOrder.cs new file mode 100644 index 0000000..f856c14 --- /dev/null +++ b/TradeUsedSale/Repositories/Models/DT_ShopifyUsedSaleOrder.cs @@ -0,0 +1,100 @@ +using System; +using LinqToDB.Mapping; + +namespace TradeUsedSale.Repositories.Models +{ + public class DT_ShopifyUsedSaleOrder + { + [PrimaryKey, Identity] public int Id { get; set; } + + public string OrderId { get; set; } + + public string OrderNumber { get; set; } + + public string OrderName { get; set; } + + public DateTime CreatedAt { get; set; } + + public DateTime UpdatedAt { get; set; } + + public DateTime ProcessedAt { get; set; } + + /// + /// 收件人 + /// + public string Name { get; set; } + + /// + /// 收件人电话 + /// + public string Phone { get; set; } + + /// + /// 完整地址 + /// + public string Full { get; set; } + + /// + /// 地址1 + /// + public string Detail { get; set; } + + /// + /// 地址2 + /// + public string Detail2 { get; set; } + + /// + /// 城市 + /// + public string City { get; set; } + + /// + /// 省 + /// + public string Province { get; set; } + + /// + /// 省编码 + /// + public string ProvinceCode { get; set; } + + /// + /// 邮编 + /// + public string Zip { get; set; } + + /// + /// 国家 + /// + public string Country { get; set; } + + /// + /// 国家编码 + /// + public string CountryCode { get; set; } + + public string Currency { get; set; } + + public decimal TotalPrice { get; set; } + + public decimal SubtotalPrice { get; set; } + + public decimal TotalTax { get; set; } + + public decimal TotalDiscounts { get; set; } + + public decimal ShippingPrice { get; set; } + + public string PaymentMethod { get; set; } + + public string FinancialStatus { get; set; } + + public decimal RefundedAmount { get; set; } + + /// + /// 原始Json + /// + public string OriginJson { get; set; } + } +} \ No newline at end of file diff --git a/TradeUsedSale/Repositories/Models/DT_ShopifyUsedSaleOrderItem.cs b/TradeUsedSale/Repositories/Models/DT_ShopifyUsedSaleOrderItem.cs new file mode 100644 index 0000000..9877285 --- /dev/null +++ b/TradeUsedSale/Repositories/Models/DT_ShopifyUsedSaleOrderItem.cs @@ -0,0 +1,33 @@ +using LinqToDB.Mapping; + +namespace TradeUsedSale.Repositories.Models +{ + public class DT_ShopifyUsedSaleOrderItem + { + [PrimaryKey, Identity] public int Id { get; set; } + + public int DtShopifyUsedSaleOrderId { get; set; } + + public string OriginSku { get; set; } + + public string Sku { get; set; } + + public string ProductCode { get; set; } + + public int Quantity { get; set; } + + public decimal Price { get; set; } + + public string Title { get; set; } + + public string VariantTitle { get; set; } + + public string ProductId { get; set; } + + public string VariantId { get; set; } + + public string Image { get; set; } + + public string ShippingMethod { get; set; } + } +} \ No newline at end of file diff --git a/TradeUsedSale/TradeUsedSale.csproj b/TradeUsedSale/TradeUsedSale.csproj index 66be4d3..d2ca6a4 100644 --- a/TradeUsedSale/TradeUsedSale.csproj +++ b/TradeUsedSale/TradeUsedSale.csproj @@ -57,6 +57,8 @@ + +