浏览代码

Merge branch 'feat-lcl-推送订单到MQ' of kxs-end/main-server into test-mainserver

lichunlei 1 年之前
父节点
当前提交
c48e96ee96
共有 3 个文件被更改,包括 118 次插入0 次删除
  1. 4 0
      AppStart/Helper/AlipayPayBack2Service.cs
  2. 75 0
      AppStart/Tables/MqOrder.cs
  3. 39 0
      Util/Utils.cs

+ 4 - 0
AppStart/Helper/AlipayPayBack2Service.cs

@@ -72,6 +72,7 @@ namespace MySystem
                             order.SendStatus = 1;
                             order.SendDate = DateTime.Now;
                             db.SaveChanges();
+                            Utils.Instance.SendMqOrder(order);
                         }
                     }
                 }
@@ -89,6 +90,9 @@ namespace MySystem
                 order.PayDate = DateTime.Now;
                 order.PayStatus = 1;
                 db.SaveChanges();
+
+                Utils.Instance.SendMqOrder(order);
+
                 if(order.ParentOrderId > 0)
                 {
                     int total = db.Orders.Count(m => m.ParentOrderId == order.ParentOrderId);

+ 75 - 0
AppStart/Tables/MqOrder.cs

@@ -0,0 +1,75 @@
+using System;
+namespace MySystem
+{
+    public class MqOrder
+    {
+        //订单Id
+        public int id { get; set; }
+
+        //订单状态(0待付款,1已付款,2已完成,3已发货,4已退款)
+        public int status { get; set; }
+
+        //创建时间
+        public DateTime? createDate { get; set; }
+
+        //发货的机具券码
+        public string snNos { get; set; }
+
+        //备注
+        public string remark { get; set; }
+
+        //购买数量
+        public int buyCount { get; set; }
+
+        //支付状态
+        public int payStatus { get; set; }
+
+        //商品id
+        public int productId { get; set; }
+
+        //发货状态
+        public int sendStatus { get; set; }
+
+        //提货方式(1邮寄到付,2上门自提)
+        public int deliveryType { get; set; }
+
+        //退款状态
+        public int refundStatus { get; set; }
+
+        //支付方式(1支付宝,3余额,4储蓄金)
+        public int payMode { get; set; }
+
+        //发货时间
+        public DateTime? sendDate { get; set; }
+
+        //支付时间
+        public DateTime? payDate { get; set; }
+
+        //邮政编码
+        public string postalCode { get; set; }
+
+        //详细地址
+        public string address { get; set; }
+
+        //所在省市区
+        public string areas { get; set; }
+
+        //支付总金额
+        public decimal totalPrice { get; set; }
+
+        //联系手机号
+        public string mobile { get; set; }
+
+        //联系人姓名
+        public string realName { get; set; }
+
+        //订单号
+        public string orderNo { get; set; }
+
+        //创客Id
+        public int userId { get; set; }
+
+        //父级订单Id(拆单用)
+        public int parentOrderId { get; set; }
+    }
+}

+ 39 - 0
Util/Utils.cs

@@ -284,5 +284,44 @@ namespace MySystem
             function.WriteLog("3\n\n", "运营中心额度变更测试");
         }
         #endregion
+    
+
+        #region 推送订单信息
+
+        public void SendMqOrder(Orders order)
+        {
+            RedisDbconn.Instance.AddList("KxsOrderQueue", Newtonsoft.Json.JsonConvert.SerializeObject(new MqOrder()
+            {
+                id = order.Id,
+                status = order.Status,
+                createDate = order.CreateDate,
+                snNos = order.SnNos,
+                remark = order.Remark,
+                buyCount = order.BuyCount,
+                payStatus = order.PayStatus,
+                productId = order.ProductId,
+                sendStatus = order.SendStatus,
+                deliveryType = order.DeliveryType,
+                refundStatus = order.RefundStatus,
+                payMode = order.PayMode,
+                sendDate = order.SendDate,
+                payDate = order.PayDate,
+                postalCode = order.PostalCode,
+                address = order.Address,
+                areas = order.Areas,
+                totalPrice = order.TotalPrice,
+                mobile = order.Mobile,
+                realName = order.RealName,
+                orderNo = order.OrderNo,
+                userId = order.UserId,
+                parentOrderId = order.ParentOrderId,
+            }));
+        }
+
+        #endregion 
+    
+    
+    
+    
     }
 }