Esempio n. 1
0
        /// <summary>
        /// 通知cpos
        /// </summary>
        /// <param name="pEntity"></param>
        /// <param name="msg"></param>
        /// <param name="ht">附加参数</param>
        /// <param name="isTonyCard"></param>
        /// <returns></returns>
        public static bool Notify(AppOrderEntity pEntity, out string msg, Hashtable ht, bool isTonyCard = false)
        {
            string content = string.Format("OrderID={0}&OrderStatus={1}&CustomerID={2}&UserID={3}&ChannelID={4}&SerialPay={5}&isTonyCard={6}", pEntity.AppOrderID, pEntity.Status, pEntity.AppClientID, pEntity.AppUserID, pEntity.PayChannelID, pEntity.OrderID, isTonyCard ? 1 : 0);

            // 附加参数
            if (ht.Count > 0)
            {
                foreach (DictionaryEntry item in ht)
                {
                    content += "&" + item.Key + "=" + item.Value;
                }
            }
            var    channelbll = new PayChannelBLL(new JIT.Utility.BasicUserInfo());
            var    channel    = channelbll.GetByID(pEntity.PayChannelID);
            string notifyUrl  = channel.NotifyUrl;

            Loggers.Debug(new DebugLogInfo()
            {
                Message = "wx pay Notify 开始调用通知接口:" + pEntity.ToJSON()
            });
            var    i       = NotifyHandler.Notify(channel.NotifyUrl, content, out msg);
            string message = i ? " wx pay Notify 调用通知接口成功" : " wx pay Notify 调用通知接口失败";

            message += (":" + msg + "::" + notifyUrl + "?" + content);
            Loggers.Debug(new DebugLogInfo()
            {
                Message = message
            });
            return(i);
        }
Esempio n. 2
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="orderId"></param>
 /// <param name="customerId"></param>
 /// <param name="openId"></param>
 /// <returns></returns>
 public static bool NotifyLifePayInfo(string orderId, string customerId, string openId)
 {
     try
     {
         var    notifyUrl = ConfigurationManager.AppSettings["ApiHost"];
         string param     = "{\"common\": { \"isALD\": \"0\", \"customerId\": \"" + customerId + "\", \"locale\": \"zh\",\"openid\":\"" + openId + "\" }, \"special\": { \"orderId\": \"" + orderId + "\"} }";
         string fulParam  = string.Format("OnlineShopping/data/Data.aspx?action=getWxPersonInfoByOpenId&ReqContent={0}", param);
         Loggers.Debug(new DebugLogInfo()
         {
             Message = "NotifyLifePayInfo 开始调用通知接口:" + notifyUrl + "?" + fulParam
         });
         string msg     = string.Empty;
         var    i       = NotifyHandler.Notify(notifyUrl, fulParam, out msg);
         string message = i ? " NotifyLifePayInfo 调用通知接口成功" : " NotifyLifePayInfo 调用通知接口失败";
         message += (":" + notifyUrl + "?" + fulParam + ":" + msg);
         Loggers.Debug(new DebugLogInfo()
         {
             Message = message
         });
         return(i);
     }
     catch (Exception ex)
     {
     }
     return(false);
 }
Esempio n. 3
0
 void bw_DoWork(object sender, DoWorkEventArgs e)
 {
     while (true)
     {
         try
         {
             var bll = new AppOrderBLL(new JIT.Utility.BasicUserInfo());
             //获取未通知的订单信息
             var entitys = bll.GetNotNodify();
             Loggers.Debug(new DebugLogInfo()
             {
                 Message = string.Format("找到{0}条待通知记录", entitys.Length)
             });
             foreach (var item in entitys)
             {
                 string msg;
                 if (NotifyHandler.Notify(item, out msg))
                 {
                     item.IsNotified = true;
                 }
                 else
                 {
                     //设定下次通知时间
                     item.NextNotifyTime = GetNextNotifyTime(item.NotifyCount ?? 0);
                 }
                 //NotifyCount++
                 item.NotifyCount++;
                 //更新数据
                 bll.Update(item);
             }
         }
         catch (Exception ex)
         {
             Loggers.Exception(new ExceptionLogInfo(ex));
         }
         _runCount++;
         if (_runCount % 100 == 0)
         {
             Loggers.Debug(new DebugLogInfo()
             {
                 Message = string.Format("轮循了{0}次", _runCount)
             });
         }
         Thread.Sleep(TimeSpan.FromSeconds(_intval));
     }
 }