|
@@ -0,0 +1,75 @@
|
|
|
|
|
+using System;
|
|
|
|
|
+using System.Collections.Generic;
|
|
|
|
|
+using System.Linq;
|
|
|
|
|
+using Library;
|
|
|
|
|
+using MySystem.Models;
|
|
|
|
|
+
|
|
|
|
|
+namespace MySystem
|
|
|
|
|
+{
|
|
|
|
|
+ public class Utils
|
|
|
|
|
+ {
|
|
|
|
|
+ public readonly static Utils Instance = new Utils();
|
|
|
|
|
+ private Utils()
|
|
|
|
|
+ { }
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ #region 推送订单信息
|
|
|
|
|
+
|
|
|
|
|
+ public void SendMqOrder(Orders order)
|
|
|
|
|
+ {
|
|
|
|
|
+ string data = 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 == null ? "" : order.SendDate.Value.ToString("yyyy-MM-ddTHH:mm:ss"),
|
|
|
|
|
+ payDate = order.PayDate == null ? "" : order.PayDate.Value.ToString("yyyy-MM-ddTHH:mm:ss"),
|
|
|
|
|
+ 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,
|
|
|
|
|
+ });
|
|
|
|
|
+ function.WriteLog(DateTime.Now.ToString() + "\n" + data, "订单推送MQ日志");
|
|
|
|
|
+ RedisDbconn.Instance.AddList("KxsOrderQueue", data);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ #endregion
|
|
|
|
|
+
|
|
|
|
|
+ #region 推送激活数据信息
|
|
|
|
|
+
|
|
|
|
|
+ public void SendActData(PosMachinesTwo pos)
|
|
|
|
|
+ {
|
|
|
|
|
+ int actType = pos.BrandId != 14 ? 1 : 2;
|
|
|
|
|
+ string data = "{";
|
|
|
|
|
+ data += "\"userId\":\"" + pos.BuyUserId + "\",";
|
|
|
|
|
+ data += "\"brandId\":\"" + pos.BrandId + "\",";
|
|
|
|
|
+ data += "\"actTime\":\"" + pos.ActivationTime.Value.ToString("yyyy-MM-ddTHH:mm:ss") + "\",";
|
|
|
|
|
+ data += "\"bindTime\":\"" + pos.BindingTime.Value.ToString("yyyy-MM-ddTHH:mm:ss") + "\",";
|
|
|
|
|
+ data += "\"sn\":\"" + pos.PosSn + "\",";
|
|
|
|
|
+ data += "\"actType\":\"" + actType + "\"";
|
|
|
|
|
+ data += "}";
|
|
|
|
|
+ function.WriteLog(DateTime.Now.ToString() + "\n" + data, "订单推送MQ日志");
|
|
|
|
|
+ RedisDbconn.Instance.AddList("KxsActQueue", data);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ #endregion
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+}
|