Ejemplo n.º 1
0
        public void GetLsDt()
        {
            LogisticBLL           OptLogistic = new LogisticBLL();
            ProductReceiveAddress objPRA      = null;
            string ExpressCode = string.Empty;

            try
            {
                objPRA = OptLogistic.getProductReceiveAddressByOrderId(orderId.ToString());

                listLsDt = OptLogistic.getListLogisticDetailbyOrderId(orderId.ToString());

                ExpressCode = OptLogistic.getExpressCodeByExpress(objPRA.Express);

                if (string.IsNullOrEmpty(objPRA.Express) || string.IsNullOrEmpty(objPRA.ExpressNumber) || string.IsNullOrEmpty(ExpressCode))
                {
                    return;
                }

                List <BusinessDll.Trace> LSTrace = null;
                if (listLsDt != null)
                {
                    foreach (var li in listLsDt)
                    {
                        if (!string.IsNullOrWhiteSpace(li.Express))
                        {
                            Express = li.Express;
                        }
                        if (!string.IsNullOrWhiteSpace(li.ExpressNumber))
                        {
                            ExpressNumber = li.ExpressNumber;
                        }
                    }

                    LSTrace = new KdApiSearch().getOrderTracesByJson(ExpressCode, objPRA.ExpressNumber);
                    if (LSTrace != null && LSTrace.Count > 0)
                    {
                        LogisticDetail objLsDt = null;
                        foreach (Trace item in LSTrace)
                        {
                            objLsDt             = new LogisticDetail();
                            objLsDt.Description = item.AcceptStation;
                            objLsDt.CreateDate  = item.AcceptTime;
                            listLsDt.Insert(0, objLsDt);
                        }
                    }
                    else
                    {
                        LogisticDetail objLsDt = new LogisticDetail();
                        objLsDt.Description = "如有疑问请至物流公司官网查询详情!";
                        objLsDt.CreateDate  = DateTime.Now;
                        listLsDt.Insert(0, objLsDt);
                    }
                }
            }
            catch (Exception ex)
            {
                NetLog.WriteTraceLogHandler("获取物流信息失败_GetLsDt()", ex.Message + "|" + ex.StackTrace);
                LogisticDetail objLsDt = new LogisticDetail();
                objLsDt.Description = "领取成功,获取不到更多的物流信息!";
                objLsDt.CreateDate  = DateTime.Now;
                if (listLsDt == null)
                {
                    listLsDt = new List <LogisticDetail>();
                }
                listLsDt.Insert(0, objLsDt);
            }
        }
Ejemplo n.º 2
0
    protected void Page_Load(object sender, EventArgs e)
    {
        WebSettingInfo webSetting = new WebSettingBLL().GetWebSettingInfo("E27798C9-9301-4176-AC0B-6F3916F389EA");

        partnerConfig = new PartnerConfig(webSetting.Param1Value, webSetting.Param2Value, webSetting.Param3Value, webSetting.Param5Value);
        SortedDictionary <string, string> sPara = GetRequestPost();

        if (null == sPara)
        {
            Response.End();
        }

        if (sPara.Count > 0)//判断是否有带返回参数
        {
            NetLog.WriteBatchwithdrawHandler("接收连连支付异步通知数据", string.Concat("【", "签名:", sPara["sign"].ToString(), "签名方式:", sPara["sign_type"].ToString(), "我方订单号:", sPara["no_order"].ToString(), "充值金额:", sPara["money_order"].ToString(), "连连订单号:", sPara["oid_paybill"].ToString(), "】"));

            if (!PaymentUtil.CheckSign(sPara, partnerConfig.YTPublicKey, //验证失败
                                       partnerConfig.MD5Key))
            {
                var out_trade_no   = sPara["no_order"].ToString();
                var rechargeMoney  = sPara["money_order"].ToString();
                var transaction_id = sPara["oid_paybill"].ToString();

                //ObjectParameter outStatus = new ObjectParameter("outStatus", "0");
                //db.p_OnLineRechargeHandler(1, out_trade_no, decimal.Parse(rechargeMoney), transaction_id, outStatus);
                //int result = int.Parse(outStatus.Value.ToString());

                NetLog.WriteBatchwithdrawHandler("连连验签失败", string.Concat("签名:", sPara["sign"].ToString(), "签名方式:", sPara["sign_type"].ToString(), "连连处理状态:9999"));

                Response.Write(@"{""ret_code"":""9999"",""ret_msg"":""验签失败""}");
                Response.End();
            }
            else
            {
                var out_trade_no   = sPara["no_order"].ToString();
                var rechargeMoney  = sPara["money_order"].ToString();
                var transaction_id = sPara["oid_paybill"].ToString();

                string            strSQL   = "p_OnLineRechargeHandler";
                DynamicParameters dyParams = new DynamicParameters();
                dyParams.Add("@orderno", out_trade_no);
                dyParams.Add("@MediumMoney", decimal.Parse(rechargeMoney));
                dyParams.Add("@MediumOrderNo", transaction_id);
                dyParams.Add("@outStatus", 0, DbType.Int32, ParameterDirection.Output, 20);

                if (sPara["result_pay"].ToString().ToLower() == "success".ToLower())
                {
                    dyParams.Add("@handlerStatus", 2);
                }
                else
                {
                    dyParams.Add("@handlerStatus", 1);
                }
                PublicConn.ExecuteTD(PublicConn.DBWriteType.FundWrite, strSQL, ref dyParams, CommandType.StoredProcedure);
                int result = dyParams.Get <int>("@outStatus");

                AccountRechareInfo accountRechare = getAccountRechare(out_trade_no);
                if (accountRechare != null)
                {
                    var para = new DynamicParameters();
                    para.Add("@UserId", accountRechare.UserId);
                    var count = PublicConn.QuerySingleWrite <int>("select count(0) from AccountRechare with(nolock) where UserId=@UserId and Status =2   and type in (2, 3, 4, 6, 8, 12)", ref para);
                    if (count == 1)
                    {
                        TuanDai.PortalSystem.BLL.VipGetWorthBLL.AddGetWorth(accountRechare.UserId, (int)ConstString.UserGrowthType.FirstReCharge, null, 0);
                    }

                    UserBasicInfoInfo userBasicInfo = new UserBLL().GetUserBasicInfoModelById(accountRechare.UserId);
                    if (userBasicInfo != null)
                    {
                        var isNewSmsRequest = ConfigHelper.getConfigString("IsNewSmsRequest", "0");
                        if (isNewSmsRequest == "0")
                        {
                            var parameters = new Dictionary <string, object>();
                            parameters.Add("User", userBasicInfo);
                            parameters.Add("CurrentDate", DateTime.Now);
                            parameters.Add("RechargeMoney", rechargeMoney);
                            parameters.Add("Host", GlobalUtils.WebURL);

                            var messageSender = new BusinessDll.MessageSend();
                            messageSender.SendMessage2(eventCode: MessageTemplates.RechargeSuccess, parameters: parameters,
                                                       mobile: userBasicInfo.TelNo, email: userBasicInfo.Email, userId: userBasicInfo.Id);
                        }
                        else
                        {
                            SmsRequest rechargeSuccessSmsRequest = new SmsRequest();
                            rechargeSuccessSmsRequest.EventCode      = MsgTemplatesType.RechargeSuccess;
                            rechargeSuccessSmsRequest.PlatformSource = PlatformSource.Pc;
                            rechargeSuccessSmsRequest.UserId         = userBasicInfo.Id;
                            rechargeSuccessSmsRequest.EmailAddress   = userBasicInfo.Email;
                            rechargeSuccessSmsRequest.Mobile         = userBasicInfo.TelNo;
                            rechargeSuccessSmsRequest.Parameters     = new Dictionary <string, object>();
                            rechargeSuccessSmsRequest.Parameters.Add("RechargeMoney", rechargeMoney);

                            string errorMessage = string.Empty;
                            SmsClient.SendMessage(rechargeSuccessSmsRequest, ref errorMessage);
                        }



                        //第三方渠道回调
                        try
                        {
                            TuanDai.PortalSystem.BLL.ThirdPartyChannel.RechargeCallBack(accountRechare.Id, accountRechare.UserId);
                        }
                        catch (Exception ex)
                        {
                            new TuanDai.LogSystem.LogClient.LogClients().WriteErrorLog(
                                "TuanDai.PortalSystem.BLL.ThirdPartyChannel.RechargeCallBack",
                                "", "", ex.Message);
                        }
                    }
                }

                NetLog.WriteTraceLogHandler("交易成功", string.Concat("签名:", sPara["sign"].ToString(), "签名方式:", sPara["sign_type"].ToString(), "我方处理状态:", result.ToString().Trim(), "连连处理状态:", sPara["result_pay"].ToString()));
                Response.Write(@"{""ret_code"":""0000"",""ret_msg"":""交易成功""}");
                Response.End();
            }
        }
        else
        {
            //var out_trade_no = sPara["no_order"].ToString();
            //var rechargeMoney = sPara["money_order"].ToString();
            //var transaction_id = sPara["oid_paybill"].ToString();

            //ObjectParameter outStatus = new ObjectParameter("outStatus", "0");
            //db.p_OnLineRechargeHandler(1, out_trade_no, decimal.Parse(rechargeMoney), transaction_id, outStatus);
            ////Response.Write(@"{""ret_code"":""9999"",""ret_msg"":""验签失败""}");

            //int result = int.Parse(outStatus.Value.ToString());

            NetLog.WriteBatchwithdrawHandler("连连交易参数为空失败", "连连处理状态:9999");
            Response.Write(@"{""ret_code"":""9999"",""ret_msg"":""交易失败""}");
            Response.End();
        }

        // 解析异步通知对象
        // sPara 字典对象
        // TODO:更新订单,发货等后续处理
    }