|
@@ -0,0 +1,61 @@
|
|
|
+using System;
|
|
|
+using System.Collections.Generic;
|
|
|
+using System.Linq;
|
|
|
+using Library;
|
|
|
+using MySystem.MpMainModels2;
|
|
|
+
|
|
|
+namespace MySystem
|
|
|
+{
|
|
|
+ public class PosPushDataNewHelper
|
|
|
+ {
|
|
|
+ public readonly static PosPushDataNewHelper Instance = new PosPushDataNewHelper();
|
|
|
+ private PosPushDataNewHelper()
|
|
|
+ { }
|
|
|
+
|
|
|
+ //交易数据
|
|
|
+ public static void Trade(ConsumerOrders trade, string kind)
|
|
|
+ {
|
|
|
+ try
|
|
|
+ {
|
|
|
+ int brand = 18;
|
|
|
+ if(kind.Contains("好哒语音王")) brand = 18;
|
|
|
+ if(kind.Contains("收款王M820")) brand = 19;
|
|
|
+ if(kind.Contains("收款王M826")) brand = 20;
|
|
|
+ if(kind.Contains("S312")) brand = 21;
|
|
|
+ if(kind.Contains("好哒扫码通")) brand = 29;
|
|
|
+ Dictionary<string, object> dataContent = new Dictionary<string, object>();
|
|
|
+ dataContent.Add("pos_sn", trade.SnNo); //机具sn
|
|
|
+ dataContent.Add("mer_no", trade.TradePayNo); //商户号
|
|
|
+ dataContent.Add("request_id", trade.OrderNo); //流水号
|
|
|
+ dataContent.Add("trade_amount", trade.PayMoney); //交易金额
|
|
|
+ dataContent.Add("trade_time", trade.CreateDate.Value.ToString("yyyy-MM-dd HH:mm:ss")); //交易时间
|
|
|
+ dataContent.Add("brand", brand); //品牌
|
|
|
+ dataContent.Add("is_act", trade.IsAct); //品牌
|
|
|
+ dataContent.Add("card_type", 1); //卡类型
|
|
|
+ dataContent.Add("qr_pay_flag", 0); //云闪付标记
|
|
|
+ Push("trade", dataContent);
|
|
|
+ }
|
|
|
+ catch (Exception ex)
|
|
|
+ {
|
|
|
+ function.WriteLog(DateTime.Now.ToString() + "\n" + ex.ToString() + "\n\n", "推送交易数据异常");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ public static void Push(string dataType, Dictionary<string, object> dataContent)
|
|
|
+ {
|
|
|
+ Dictionary<string, object> data = new Dictionary<string, object>();
|
|
|
+ data.Add("data_type", dataType);
|
|
|
+ data.Add("data_content", dataContent);
|
|
|
+ RedisDbconn.Instance.AddList("KxsPosDataQueue", Newtonsoft.Json.JsonConvert.SerializeObject(data));
|
|
|
+ }
|
|
|
+
|
|
|
+ public static string getRequestId(int id, string type)
|
|
|
+ {
|
|
|
+ if(id > 0)
|
|
|
+ {
|
|
|
+ return function.MD5_32(id.ToString() + type);
|
|
|
+ }
|
|
|
+ return DateTime.Now.ToString("yyyyMMddHHmmssfff") + function.get_Random(8);
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|