Beispiel #1
0
        /// <summary>
        /// 订单通知后的操作
        /// </summary>
        /// <param name="notify">订单通知对象</param>
        /// <param name="success">通知是否成功</param>
        public virtual void AfterSendNotify(OrderNotifyQueueListModel notify, string success)
        {
            var notifySuccess     = success == "success" ? 1 : -1;
            var updateDataSuccess = DbHelperSQL.ExecuteSql("update jmp_order set o_noticestate=" + notifySuccess + ",o_noticetimes=GETDATE(),o_times=" + (notify.q_times + 1) + " where o_id=" + notify.q_o_id) > 0;

            //如果下游返回异步通知成功
            if (Success(success))
            {
                //如果更新数据通知状态失败
                if (!updateDataSuccess)
                {
                    //更新队列表
                    DbHelperSQL.ExecuteSql("update " + notify.q_tablename + " set o_noticestate=1,o_noticetimes=GETDATE(),o_times=" +
                                           (notify.q_times + 1) + " where o_code='" + notify.trade_code + "'");
                }
                if (notifySuccess == 1)
                {
                    DbHelperSQL.ExecuteSql("delete from jmp_queuelist where q_id=" + notify.q_id);
                }
                else
                {
                    //JMP.TOOL.AddLocLog.AddUserLog(0, 5, "", string.Format("异常移除队列数据,订单号:{0}",notify.trade_code), "通知程序异常");//写入报错日志
                    JMP.TOOL.AddLocLog.AddUserLog(0, 5, "", string.Format("异常移除队列数据,订单号:{0},通知次数:{1},通知结果:{2},归档表:{3}", notify.trade_code, notify.q_times + 1, success, notify.q_tablename), "通知程序异常");//写入报错日志
                }
            }
            else
            {
                DbHelperSQL.ExecuteSql("update jmp_queuelist set q_noticestate=0,q_noticetimes=GETDATE() where q_id=" + notify.q_id);
                //更新队列表
                if (!updateDataSuccess)
                {
                    DbHelperSQL.ExecuteSql("update " + notify.q_tablename + " set o_noticestate=" + notifySuccess + ",o_noticetimes=GETDATE(),o_times=" + (notify.q_times + 1) + " where o_code='" + notify.trade_code + "'");
                }
            }
        }
Beispiel #2
0
        private string SendNotify(OrderNotifyQueueListModel notify)
        {
            var mark = notify.q_address.Contains("?") ? "&" : "?";
            var url  = notify.q_address + mark + "trade_md5=" +
                       JMP.TOOL.MD5.md5strGet(notify.trade_no + notify.trade_code + notify.trade_price + notify.q_sign,
                                              true) + "&trade_type=" + notify.trade_type +
                       "&trade_price=" + notify.trade_price + "&trade_paycode=" + notify.trade_paycode + "&trade_code=" +
                       notify.trade_code + "&trade_no=" + notify.trade_no + "&trade_privateinfo=" +
                       System.Web.HttpUtility.UrlEncode(notify.q_privateinfo, System.Text.Encoding.UTF8) + "&trade_sign=" +
                       JMP.TOOL.DESEncrypt.Encrypt(DateTime.Now.ToString(CultureInfo.InvariantCulture) + "," +
                                                   notify.trade_no + "," + notify.q_sign, "hyx") +
                       "&trade_status=TRADE_SUCCESS&trade_time=" + DateTime.Parse(notify.trade_time.ToString()).ToString("yyyy-MM-dd HH:mm:ss");
            var qUersid = notify.q_uersid;
            var success = HttpHelper.OpenReadWithHttps(url, qUersid);

            //message = "正在通知:" + q_id + "," + q_address + "     " + success;
            //sl++;
            return(success);
        }
Beispiel #3
0
        public override void AfterSendNotify(OrderNotifyQueueListModel notify, string success)
        {
            var notifySuccess = success.Trim().ToLower() == "success" ? 1 : -1;

            var _success = DbHelperSQL.ExecuteSql("update jmp_order set o_noticestate=" + notifySuccess + ",o_noticetimes=GETDATE(),o_times=" + (notify.q_times + 1) + " where o_id=" + notify.q_o_id);

            //更新队列表
            if (_success <= 0)
            {
                DbHelperSQL.ExecuteSql("update " + notify.q_tablename + " set o_noticestate=" + notifySuccess + ",o_noticetimes=GETDATE(),o_times=" + (notify.q_times + 1) + " where o_code='" + notify.trade_code + "'");
            }

            //var updateOrder = "update " + notify.q_tablename + " set o_noticestate=" + notifySuccess +",o_noticetimes='" + DateTime.Now.ToString(CultureInfo.InvariantCulture) +"',o_times=" + (notify.q_times + 1) + " where o_id=" + notify.q_o_id;


            //不管通知成功与否,都从订单通知队列表中删除此条记录
            var deleteFromQueueList = "delete from jmp_queuelist where q_id=" + notify.q_id;

            JMP.TOOL.AddLocLog.AddUserLog(0, 5, "", string.Format("永久移除订单通知队列,订单号:{0},通知次数:{1},通知结果:{2},归档表:{3}", notify.trade_code, notify.q_times + 1, success, notify.q_tablename), "通知程序队列移除操作");//写入报错日志
            DbHelperSQL.ExecuteSqlTran(new List <string>
            {
                deleteFromQueueList
            });
        }