Exemple #1
0
        private void SetPushInfo()
        {
            LoggingSessionInfo loggingSessionInfo = new LoggingSessionInfo();

            loggingSessionInfo = new CLoggingSessionService().GetLoggingSessionInfo("f6a7da3d28f74f2abedfc3ea0cf65c01", "17e02a6dd0094de9b18da1ca73d37027");

            string       strOrderId = "1b4c3bfb63884f0b86bd4b5c771bccaf";
            cUserService userServer = new cUserService(loggingSessionInfo);

            userServer.SendOrderMessage(strOrderId);
        }
        /// <summary>
        /// 处理订单支付之后业务标识
        /// </summary>
        /// <param name="OrderCustomerInfo"></param>
        /// <param name="strResult"></param>
        /// <param name="strOutTradeNo"></param>
        private void SetPayOrderInfo(string OrderCustomerInfo, string strResult, string strOutTradeNo)
        {
            //order_id:  订单号
            //result:    success(交易成功)  或者   fail(交易失败)
            //out_trade_no:  与订单号对应的外部交易号(方便日后查询交易中的详细信息)
            try
            {
                #region check
                if (OrderCustomerInfo == null || OrderCustomerInfo.Equals(""))
                {
                    Loggers.Debug(new DebugLogInfo()
                    {
                        Message = string.Format("SetPayOrderInfo: {0}", "返回订单号为空")
                    });
                    return;
                }
                if (strResult == null || strResult.Equals("fail"))
                {
                    Loggers.Debug(new DebugLogInfo()
                    {
                        Message = string.Format("SetPayOrderInfo: {0}", "支付失败")
                    });
                    return;
                }
                #endregion

                #region 处理业务
                var infos = OrderCustomerInfo.Split(',');
                if (infos.Length != 2)
                {
                    Loggers.Debug(new DebugLogInfo()
                    {
                        Message = string.Format("SetPayOrderInfo-OrderCustomerInfo: {0}", "长度错误")
                    });
                    return;
                }
                string customerId         = infos[0].ToString().Trim();
                string orderCode          = infos[1].ToString().Trim();
                var    loggingSessionInfo = Default.GetBSLoggingSession(customerId, "1");

                InoutService   service   = new InoutService(loggingSessionInfo);
                SetOrderEntity orderInfo = new SetOrderEntity();
                orderInfo.OrderCode     = orderCode;
                orderInfo.PaymentTypeId = "BB04817882B149838B19DE2BDDA5E91B";
                //orderInfo.PaymentAmount = Convert.ToDecimal(reqObj.special.paymentAmount);
                //orderInfo.LastUpdateBy = ToStr(reqObj.common.userId);
                orderInfo.PaymentTime = System.DateTime.Now;
                orderInfo.Status      = "2";
                orderInfo.StatusDesc  = "已支付";
                orderInfo.OutTradeNo  = strOutTradeNo;
                string strError = string.Empty;
                bool   bReturn  = service.SetOrderPayment(orderInfo, out strError);
                if (!bReturn)
                {
                    Loggers.Debug(new DebugLogInfo()
                    {
                        Message = string.Format("SetPayOrderInfo: {0}", "提交失败")
                    });
                }
                else
                {
                    string openId  = string.Empty;
                    string amount  = string.Empty;
                    string orderId = string.Empty;
                    //支付成功,发送邮件与短信
                    cUserService userServer = new cUserService(loggingSessionInfo);
                    userServer.SendOrderMessage(orderCode);

                    bool bReturnx = service.GetOrderOpenId(orderCode, out openId, out amount, out orderId);
                    //推送消息
                    if (bReturnx)
                    {
                        string dataStr = "{ \"OpenID\":\"" + openId + "\", \"" + amount + "\":2877 }";

                        //bool bReturnt = SetVipIntegral(loggingSessionInfo, dataStr);
                        VipIntegralBLL vipIntegralBLL = new VipIntegralBLL(loggingSessionInfo);
                        bool           bReturnt       = vipIntegralBLL.SetPushIntegral(orderId
                                                                                       , ConfigurationManager.AppSettings["push_weixin_msg_url"].Trim()
                                                                                       , out strError);
                        if (!bReturnt)
                        {
                            Loggers.Debug(new DebugLogInfo()
                            {
                                Message = string.Format("SetPayOrderInfo-失败: {0}", "发送失败")
                            });
                        }
                    }
                    else
                    {
                        Loggers.Debug(new DebugLogInfo()
                        {
                            Message = string.Format("SetPayOrderInfo-失败: {0}", "获取信息失败")
                        });
                    }
                }
                #endregion
            }
            catch (Exception ex) {
                Loggers.Debug(new DebugLogInfo()
                {
                    Message = string.Format("SetPayOrderInfo-失败: {0}", ex.ToString())
                });
            }
        }