Beispiel #1
0
        private string pay_order(Agent_requestlog reqlog, OrderPayRequestBody body, string organization, Meituan_reqlog mlog)
        {
            var response = new OrderPayResponse();

            response.partnerId = int.Parse(agentinfo.mt_partnerId);

            string mtorderid      = body.orderId.ToString();
            string partnerOrderId = body.partnerOrderId;
            ////如果合作商订单Id不存在,则查询美团订单创建日志
            //if(partnerOrderId=="")
            //{
            //    Meituan_reqlog mtOrderCrateSucLog = new Meituan_reqlogData().GetMtOrderCrateLogByMtorder(body.orderId.ToString(), "200");
            //    partnerOrderId = mtOrderCrateSucLog.ordernum;
            //}

            string      data    = OrderJsonData.agentorder_shoudongchuli(partnerOrderId.ConvertTo <int>(0));
            XmlDocument retdoc  = (XmlDocument)JsonConvert.DeserializeXmlNode("{\"root\":" + data + "}");
            XmlElement  retroot = retdoc.DocumentElement;
            string      type    = retroot.SelectSingleNode("type").InnerText;
            string      msg     = retroot.SelectSingleNode("msg").InnerText;

            if (type == "100")//创建订单成功
            {
                string pno = retroot.SelectSingleNode("pno").InnerText;

                response.code     = 200;
                response.describe = "success";
                response.body     = new OrderPayResponseBody
                {
                    orderId          = body.orderId,
                    partnerOrderId   = partnerOrderId,
                    voucherType      = (int)Meituan_voucherType.multiuse,
                    asyReturnVoucher = false,
                    vouchers         = new string[] { pno },
                    voucherPics      = new string[] {}
                };


                reqlog.Is_dealsuc = 1;
                reqlog.Ordernum   = partnerOrderId;

                mlog.ordernum = partnerOrderId;

                return(EditMTlog_Err(response, mlog, reqlog));
            }
            else//创建订单失败
            {
                if (msg == "预付款不足")
                {
                    response.code     = 501;
                    response.describe = msg;
                }
                else
                {
                    response.code     = 599;
                    response.describe = "支付订单失败:" + msg;
                }
                return(EditMTlog_Err(response, mlog, reqlog));
            }
        }
Beispiel #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            SortedDictionary <string, string> sPara = GetRequestGet();

            if (sPara.Count > 0)//判断是否有带返回参数
            {
                Notify aliNotify    = new Notify();
                bool   verifyResult = aliNotify.Verify(sPara, Request.QueryString["notify_id"], Request.QueryString["sign"]);

                if (verifyResult)//验证成功
                {
                    /////////////////////////////////////////////////////////////////////////////////////////////////////////////
                    //请在这里加上商户的业务逻辑程序代码

                    //——请根据您的业务逻辑来编写程序(以下代码仅作参考)——
                    //获取支付宝的通知返回参数,可参考技术文档中页面跳转同步通知参数列表
                    string  trade_no     = Request.QueryString["trade_no"];                  //支付宝交易号
                    int     order_no     = Int32.Parse(Request.QueryString["out_trade_no"]); //获取订单号
                    decimal total_fee    = decimal.Parse(Request.QueryString["total_fee"]);  //获取总金额
                    string  subject      = Request.QueryString["subject"];                   //商品名称、订单名称
                    string  body         = Request.QueryString["body"];                      //商品描述、订单备注、描述
                    string  buyer_email  = Request.QueryString["buyer_email"];               //买家支付宝账号
                    string  trade_status = Request.QueryString["trade_status"];              //交易状态

                    if (Request.QueryString["trade_status"] == "TRADE_FINISHED" || Request.QueryString["trade_status"] == "TRADE_SUCCESS")
                    {
                        string retunstr = new PayReturnSendEticketData().PayReturnSendEticket(trade_no, order_no, total_fee, trade_status);

                        //对分销充值订单支付返回,对绑定订单进行处理确认
                        var handdata = OrderJsonData.agentorderpay_Hand(order_no);

                        diveticketcode.InnerText = ("您已成功支付" + total_fee.ToString() + "元!");
                    }
                    else
                    {
                        diveticketcode.InnerText = ("支付返回错误:" + Request.QueryString["trade_status"]);
                    }
                }
                else
                {
                    //支付宝验证失败,应该是微信支付返回成功
                    int     out_trade_no = Request["out_trade_no"].ConvertTo <int>(0);
                    B2b_pay wxpay        = new B2bPayData().GetSUCCESSPayById(out_trade_no);
                    if (wxpay != null)
                    {
                        diveticketcode.InnerText = ("您已成功支付" + wxpay.Total_fee + "元!");
                    }
                }
            }
            else
            {
                diveticketcode.InnerText = ("无返回参数");
            }
        }
Beispiel #3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            //获取访问的商户COMID
            if (Domain_def.Domain_yanzheng(RequestUrl))//如果符合shop101.etown.cn的格式,则从多微信商户基本信息表中获取comid
            {
                comid = Int32.Parse(Domain_def.Domain_Huoqu(RequestUrl));
            }
            else
            {
                B2b_company_info companyinfo = B2bCompanyData.GetComId(RequestUrl);
                if (companyinfo != null)
                {
                    comid = companyinfo.Com_id;
                }
            }
            #region 获得财付通支付参数 tenpay_id,tenpay_key
            //根据产品判断商家是否含有自己的财付通支付:
            //a.含有的话支付到商家;
            //b.没有的话支付到平台财付通账户(易城账户,公司id=106)
            string tenpay_id          = "";
            string tenpay_key         = "";
            B2b_finance_paytype model = new B2b_finance_paytypeData().GetFinancePayTypeByComid(comid);
            if (model != null)
            {
                //商家财付通支付的所有参数都存在
                if (model.Tenpay_id != "" && model.Tenpay_key != "")
                {
                    tenpay_id  = model.Tenpay_id;
                    tenpay_key = model.Tenpay_key;
                }
                else
                {
                    model = new B2b_finance_paytypeData().GetFinancePayTypeByComid(106);
                    if (model == null)
                    {
                        Response.Write("商户财付通信息设置不完全!");
                        Response.End();
                        return;
                    }
                    else
                    {
                        //商家财付通支付的所有参数都存在
                        if (model.Tenpay_id != "" && model.Tenpay_key != "")
                        {
                            tenpay_id  = model.Tenpay_id;
                            tenpay_key = model.Tenpay_key;
                        }
                        else
                        {
                            Response.Write("商户财付通信息设置不完全!!");
                            Response.End();
                            return;
                        }
                    }
                }
            }
            else
            {
                model = new B2b_finance_paytypeData().GetFinancePayTypeByComid(106);
                if (model == null)
                {
                    Response.Write("商户财付通信息设置不完全!");
                    Response.End();
                    return;
                }
                else
                {
                    //商家财付通支付的所有参数都存在
                    if (model.Tenpay_id != "" && model.Tenpay_key != "")
                    {
                        tenpay_id  = model.Tenpay_id;
                        tenpay_key = model.Tenpay_key;
                    }
                    else
                    {
                        Response.Write("商户财付通信息设置不完全!!");
                        Response.End();
                        return;
                    }
                }
            }

            #endregion


            //创建ResponseHandler实例
            ResponseHandler resHandler = new ResponseHandler(Context);
            resHandler.setKey(tenpay_key);

            //判断签名
            if (resHandler.isTenpaySign())
            {
                ///通知id
                string notify_id = resHandler.getParameter("notify_id");
                //通过通知ID查询,确保通知来至财付通
                //创建查询请求
                RequestHandler queryReq = new RequestHandler(Context);
                queryReq.init();
                queryReq.setKey(tenpay_key);
                queryReq.setGateUrl("https://gw.tenpay.com/gateway/simpleverifynotifyid.xml");
                queryReq.setParameter("partner", tenpay_id);
                queryReq.setParameter("notify_id", notify_id);

                //通信对象
                TenpayHttpClient httpClient = new TenpayHttpClient();
                httpClient.setTimeOut(5);
                //设置请求内容
                httpClient.setReqContent(queryReq.getRequestURL());
                //后台调用
                if (httpClient.call())
                {
                    //设置结果参数
                    ClientResponseHandler queryRes = new ClientResponseHandler();
                    queryRes.setContent(httpClient.getResContent());
                    queryRes.setKey(tenpay_key);
                    //判断签名及结果
                    //只有签名正确,retcode为0,trade_state为0才是支付成功
                    if (queryRes.isTenpaySign())
                    {
                        //取结果参数做业务处理
                        string out_trade_no = queryRes.getParameter("out_trade_no");
                        //财付通订单号
                        string transaction_id = queryRes.getParameter("transaction_id");
                        //金额,以分为单位
                        string total_fee = queryRes.getParameter("total_fee");
                        //如果有使用折扣券,discount有值,total_fee+discount=原请求的total_fee
                        string discount = queryRes.getParameter("discount");
                        //支付结果
                        string trade_state = resHandler.getParameter("trade_state");
                        //交易模式,1即时到帐 2中介担保
                        string trade_mode = resHandler.getParameter("trade_mode");
                        #region
                        //判断签名及结果
                        if ("0".Equals(queryRes.getParameter("retcode")))
                        {
                            //Response.Write("id验证成功");

                            if ("1".Equals(trade_mode))
                            {       //即时到账
                                if ("0".Equals(trade_state))
                                {
                                    //------------------------------
                                    //即时到账处理业务开始
                                    //------------------------------

                                    //处理数据库逻辑
                                    //注意交易单不要重复处理
                                    //注意判断返回金额

                                    //------------------------------
                                    //即时到账处理业务完毕
                                    //------------------------------
                                    string retunstr = new PayReturnSendEticketData().PayReturnSendEticket(notify_id, Int32.Parse(out_trade_no), total_fee.ConvertTo <decimal>(), "TRADE_SUCCESS");

                                    //对分销充值订单支付返回,对绑定订单进行处理确认
                                    var handdata = OrderJsonData.agentorderpay_Hand(Int32.Parse(out_trade_no));


                                    //给财付通系统发送成功信息,财付通系统收到此结果后不再进行后续通知
                                    Response.Write("success");
                                }
                                else
                                {
                                    Response.Write("即时到账支付失败");
                                }
                            }
                            else if ("2".Equals(trade_mode))
                            { //中介担保
                              //------------------------------
                              //中介担保处理业务开始
                              //------------------------------
                              //处理数据库逻辑
                              //注意交易单不要重复处理
                              //注意判断返回金额

                                int iStatus = Convert.ToInt32(trade_state);
                                switch (iStatus)
                                {
                                case 0:                 //付款成功

                                    break;

                                case 1:                 //交易创建

                                    break;

                                case 2:                 //收获地址填写完毕

                                    break;

                                case 4:                 //卖家发货成功

                                    break;

                                case 5:                 //买家收货确认,交易成功

                                    break;

                                case 6:                 //交易关闭,未完成超时关闭

                                    break;

                                case 7:                 //修改交易价格成功

                                    break;

                                case 8:                 //买家发起退款

                                    break;

                                case 9:                 //退款成功

                                    break;

                                case 10:        //退款关闭

                                    break;
                                }


                                //------------------------------
                                //中介担保处理业务开始
                                //------------------------------


                                //给财付通系统发送成功信息,财付通系统收到此结果后不再进行后续通知
                                Response.Write("success");
                            }
                        }
                        else
                        {
                            //错误时,返回结果可能没有签名,写日志trade_state、retcode、retmsg看失败详情。
                            //通知财付通处理失败,需要重新通知
                            Response.Write("查询验证签名失败或id验证失败");
                            Response.Write("retcode:" + queryRes.getParameter("retcode"));
                        }
                        #endregion
                    }
                    else
                    {
                        Response.Write("通知ID查询签名验证失败");
                    }
                }
                else
                {
                    //通知财付通处理失败,需要重新通知
                    Response.Write("后台调用通信失败");
                    //写错误日志
                    Response.Write("call err:" + httpClient.getErrInfo() + "<br>" + httpClient.getResponseCode() + "<br>");
                }
            }
            else
            {
                Response.Write("签名验证失败");
            }
            Response.End();
        }
Beispiel #4
0
        delegate void AsyncsendEventHandler(string updateurl, string pno, int confirmnum, string confirmtime, int agentcomid, int comid, int validateticketlogid, int aorderid);//发送验证同步发送请求委托

        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                string xml = Request["xml"].ToString();
                //string xml = "rzChHB2sU9ld7U8YJm+ehw3aukqIGDM4BtqU0aUKqsh0Wlv7lE7QY0h+6TyATqOKSH7pPIBOo4pIfuk8gE6jikh+6TyATqOK88GTsYxHp+jxFjUWFoOLabGkQCK4I/78+O3AIZim06QMwlqxUloGSwUMhENjECcrzbztXnARK88eCV0nzDbYTSXGBvHHQSpCtYsGXg/lwRreR77JNU04PrnA/lhi3vGqrkNT1h37aYFq1/tYQ1Xz/ZZH12+3kc7eN5HVgtJCsazTnwU3IXzBtgTaJ2ESK0/X0ncZdJ1sFl4cdnO/KompxrjYGhqFw7FIjsFUOFy3n1dNbNhZIFe8Y78Lir83nuy1W7A/bsAjwDoqCCTzSMhu4i1fpj0wiwQw2BdtiUN3SUQvOPw+mKMgINlGNcH6G0/KSglfJdF6P3DNfmxtL8FfbNt6uk7GCtoKHZD21Lc7H95at7dJ0msz8Y+YwVrIaCGc";
                //string xml = "<?xml version='1.0' encoding='UTF-8'?><Body><type>use_info</type><orderId>22221</orderId><outOrderId>126079</outOrderId><credence>991553361205</credence><useCount>1</useCount><lastCount>0</lastCount><useTime>2015-10-21 17:31:42</useTime><exchangeId>16504001</exchangeId><postTime>2015-10-21 17:33:00</postTime></Body>";
                if (xml == "")
                {
                    TxtHelper.WriteFile("D:\\site\\b2betown\\ETS2.WebApp\\mjldlog.txt", "xml空");

                    Response.Write("fail 接收参数为空");

                    return;
                }
                if (xml != "")
                {
                    TxtHelper.WriteFile("D:\\site\\b2betown\\ETS2.WebApp\\mjldlog.txt", xml);

                    ApiService mapiservice = new ApiServiceData().GetApiservice(3);
                    if (mapiservice == null)
                    {
                        TxtHelper.WriteFile("D:\\site\\b2betown\\ETS2.WebApp\\mjldlog.txt", "获取服务商信息失败-" + xml);

                        Response.Write("fail 获取服务商信息失败");

                        return;
                    }
                    xml = Mjld_TCodeServiceCrypt.Decrypt3DESFromBase64(xml, mapiservice.Deskey);
                    try
                    {
                        XmlDocument doc = new XmlDocument();
                        doc.LoadXml(xml.Trim());
                        XmlElement root = doc.DocumentElement;

                        string type = root.SelectSingleNode("type").InnerText;

                        //验证推送
                        if (type == "use_info")
                        {
                            TxtHelper.WriteFile("D:\\site\\b2betown\\ETS2.WebApp\\mjldlog.txt", "use_info: " + xml);


                            //录入交互日志
                            ApiLog mapilog = new ApiLog
                            {
                                Id            = 0,
                                request_type  = "use_info",
                                Serviceid     = 3,
                                Str           = xml.Trim(),
                                Subdate       = DateTime.Now,
                                ReturnStr     = "",
                                ReturnSubdate = DateTime.Now,
                                Errmsg        = "",
                            };
                            int ins = new ApiLogData().EditLog(mapilog);

                            //平台订单号
                            string MjldorderId = root.SelectSingleNode("orderId").InnerText;
                            //合作伙伴订单号
                            string orderid = root.SelectSingleNode("outOrderId").InnerText;
                            //验证码
                            string credence = root.SelectSingleNode("credence").InnerText;
                            //使用数量
                            string useCount = root.SelectSingleNode("useCount").InnerText;
                            //剩余数量
                            string lastCount = root.SelectSingleNode("lastCount").InnerText;
                            //验证使用时间
                            string useTime = root.SelectSingleNode("useTime").InnerText;
                            //验证ID
                            string exchangeId = root.SelectSingleNode("exchangeId").InnerText;
                            //景区ID
                            //string ScenicId = root.SelectSingleNode("ScenicId").InnerText;
                            string ScenicId = "";
                            //推送时间
                            string postTime = root.SelectSingleNode("postTime").InnerText;

                            //根据验证id判断是否已经成功处理过该验证推送
                            Api_mjld_AsyncUsenotice sucnotice = new Api_mjld_AsyncUsenoticeData().GetSucUseNoticeByExchangeId(exchangeId);
                            if (sucnotice == null)
                            {
                                Api_mjld_AsyncUsenotice usenotice = new Api_mjld_AsyncUsenotice
                                {
                                    id          = 0,
                                    type        = type,
                                    mjldOrderId = MjldorderId,
                                    credence    = credence,
                                    useCount    = useCount.ConvertTo <int>(0),
                                    lastCount   = lastCount.ConvertTo <int>(0),
                                    useTime     = useTime,
                                    exchangeId  = exchangeId,
                                    ScenicId    = ScenicId,
                                    postTime    = postTime,
                                    rcontent    = "",
                                    orderId     = orderid.ConvertTo <int>(0),
                                };
                                int insUsenotice = new Api_mjld_AsyncUsenoticeData().EditUsenotice(usenotice);
                                usenotice.id = insUsenotice;

                                //易城系统订单 处理
                                B2b_order morder = new B2bOrderData().GetOrderById(orderid.ConvertTo <int>(0));
                                if (morder != null)
                                {
                                    if (lastCount.ConvertTo <int>(0) > 0)
                                    {
                                        int usecount = morder.service_usecount + usenotice.useCount;
                                        morder.service_usecount   = usecount;
                                        morder.service_lastcount  = usenotice.lastCount;
                                        morder.Servicepro_v_state = ((int)Product_V_State.PartValidate).ToString(); //验证部分

                                        morder.Order_state = (int)OrderStatus.HasUsed;                              //已消费

                                        new B2bOrderData().InsertOrUpdate(morder);
                                    }
                                    else
                                    {
                                        int usecount = morder.service_usecount + usenotice.useCount;
                                        morder.service_usecount   = usecount;
                                        morder.service_lastcount  = usenotice.lastCount;
                                        morder.Servicepro_v_state = ((int)Product_V_State.AllValidate).ToString(); //验证全部

                                        morder.Order_state = (int)OrderStatus.HasUsed;                             //已消费

                                        new B2bOrderData().InsertOrUpdate(morder);
                                    }

                                    //根据b单判断是否有a单存在
                                    B2b_order aorder = new B2bOrderData().GetOldorderBybindingId(morder.Id);
                                    if (aorder != null)
                                    {
                                        aorder.Order_state = morder.Order_state;

                                        new B2bOrderData().InsertOrUpdate(aorder);
                                    }

                                    usenotice.rcontent = "1";
                                    new Api_mjld_AsyncUsenoticeData().EditUsenotice(usenotice);

                                    //如果是分销订单,则需要给分销发送验证通知
                                    //判断b订单 是否 属于某个a订单
                                    if (aorder != null)
                                    {
                                        //得到a订单的分销信息
                                        if (aorder.Agentid > 0)
                                        {
                                            Agent_company acompany = new AgentCompanyData().GetAgentCompany(aorder.Agentid);
                                            if (acompany != null)
                                            {
                                                //异步发送验证同步请求
                                                AsyncsendEventHandler mydelegate = new AsyncsendEventHandler(AsyncSend);
                                                mydelegate.BeginInvoke(acompany.Agent_updateurl.Trim(), credence, int.Parse(useCount), useTime, aorder.Agentid, aorder.Comid, 0, aorder.Id, new AsyncCallback(Completed), null);
                                            }
                                        }
                                    }
                                    else
                                    {
                                        if (morder.Agentid > 0)
                                        {
                                            Agent_company acompany = new AgentCompanyData().GetAgentCompany(morder.Agentid);
                                            if (acompany != null)
                                            {
                                                //异步发送验证同步请求
                                                AsyncsendEventHandler mydelegate = new AsyncsendEventHandler(AsyncSend);
                                                mydelegate.BeginInvoke(acompany.Agent_updateurl.Trim(), credence, int.Parse(useCount), useTime, morder.Agentid, morder.Comid, 0, morder.Id, new AsyncCallback(Completed), null);
                                            }
                                        }
                                    }



                                    Response.Write("1");


                                    return;
                                }
                                else
                                {
                                    usenotice.rcontent = "fail 获取订单失败";
                                    new Api_mjld_AsyncUsenoticeData().EditUsenotice(usenotice);

                                    Response.Write("fail");

                                    return;
                                }
                            }
                            else
                            {
                                Response.Write("1");

                                return;
                            }
                        }
                        //退票推送
                        if (type == "back_order")
                        {
                            TxtHelper.WriteFile("D:\\site\\b2betown\\ETS2.WebApp\\mjldlog.txt", "back_order: " + xml);


                            //录入交互日志
                            ApiLog mapilog = new ApiLog
                            {
                                Id            = 0,
                                request_type  = "back_order",
                                Serviceid     = 3,
                                Str           = xml.Trim(),
                                Subdate       = DateTime.Now,
                                ReturnStr     = "",
                                ReturnSubdate = DateTime.Now,
                                Errmsg        = "",
                            };
                            int ins = new ApiLogData().EditLog(mapilog);


                            //2为退单成功 3为拒绝
                            string backStatus = root.SelectSingleNode("backStatus").InnerText;
                            //外部退单id
                            string outBackId = root.SelectSingleNode("outBackId").InnerText;
                            //成功退货数量
                            string backCount = root.SelectSingleNode("backCount").InnerText;


                            //本平台退单id
                            string backId = root.SelectSingleNode("backId").InnerText;
                            //推送时间
                            string postTime = root.SelectSingleNode("postTime").InnerText;

                            //根据mjldorderid判断是否成功处理过
                            Api_mjld_AsyncBacknotice sucnotice = new Api_mjld_AsyncBacknoticeData().GetSucApi_mjld_AsyncBacknotice(backId);
                            if (sucnotice == null)
                            {
                                Api_mjld_AsyncBacknotice backnotice = new Api_mjld_AsyncBacknotice
                                {
                                    id          = 0,
                                    mjldorderid = backId,
                                    orderid     = outBackId.ConvertTo <int>(0),
                                    backCount   = backCount.ConvertTo <int>(0),
                                    backStatus  = backStatus.ConvertTo <int>(0),
                                    postTime    = postTime,
                                    rcontent    = "",
                                    type        = type
                                };
                                int insBacknotice = new Api_mjld_AsyncBacknoticeData().EditBacknotice(backnotice);
                                backnotice.id = insBacknotice;

                                //易城系统订单
                                B2b_order morder = new B2bOrderData().GetOrderById(outBackId.ConvertTo <int>(0));
                                if (morder != null)
                                {
                                    //只有订单状态 为"退票处理中",才会进行退款操作
                                    if (morder.Order_state == (int)OrderStatus.WaitQuitOrder)
                                    {
                                        if (backStatus == "2")
                                        {
                                            OrderJsonData.QuitOrder(0, outBackId.ConvertTo <int>(0), morder.Pro_id, backCount.ConvertTo <int>(0), "");
                                        }
                                        //拒绝退款 则还原原来订单状态;订单备注中 提示“拒绝退款”
                                        if (backStatus == "3")
                                        {
                                            //判断是否有订单 绑定传入的订单
                                            B2b_order d_loldorder = new B2bOrderData().GetOldorderBybindingId(outBackId.ConvertTo <int>(0));
                                            if (d_loldorder != null)
                                            {
                                                d_loldorder.Order_state  = (morder.Order_remark).ConvertTo <int>(0);
                                                d_loldorder.Order_remark = "美景联动拒绝退票";

                                                new B2bOrderData().UpOrderStateAndRemark(d_loldorder.Id, d_loldorder.Order_state, d_loldorder.Order_remark);
                                            }

                                            morder.Order_state  = (morder.Order_remark).ConvertTo <int>(0);;
                                            morder.Order_remark = "美景联动拒绝退票";
                                            new B2bOrderData().UpOrderStateAndRemark(morder.Id, morder.Order_state, morder.Order_remark);
                                        }

                                        backnotice.rcontent = "1";
                                        new Api_mjld_AsyncBacknoticeData().EditBacknotice(backnotice);

                                        Response.Write("1");

                                        return;
                                    }
                                    else
                                    {
                                        backnotice.rcontent = "fail 订单状态应该为(退票处理中),可是现在为:" + EnumUtils.GetName((OrderStatus)morder.Order_state);
                                        new Api_mjld_AsyncBacknoticeData().EditBacknotice(backnotice);

                                        Response.Write("fail");

                                        return;
                                    }
                                }
                                else
                                {
                                    backnotice.rcontent = "fail 获取订单失败";
                                    new Api_mjld_AsyncBacknoticeData().EditBacknotice(backnotice);

                                    Response.Write("fail");

                                    return;
                                }
                            }
                            else
                            {
                                Response.Write("1");


                                return;
                            }
                        }
                    }
                    catch
                    {
                        Response.Write("fail");

                        return;
                    }
                }
            }
            catch
            {
                Response.Write("fail 接收参数为空");

                return;
            }
        }
Beispiel #5
0
        protected void Page_Load(object sender, EventArgs e)
        {
            ResponseHandler resHandler = new ResponseHandler(Context);

            resHandler.init();

            string RequestUrl = Request.ServerVariables["SERVER_NAME"].ToLower();

            string u = Request.ServerVariables["HTTP_USER_AGENT"];

            //bool bo = detectmobilebrowser.HttpUserAgent(u);//判断是否是手机访问
            //if (bo)
            //{
            if (Domain_def.Domain_yanzheng(RequestUrl))//如果符合shop101.etown.cn的格式
            {
                //先通过正则表达式获取COMid
                int comid = Int32.Parse(Domain_def.Domain_Huoqu(RequestUrl).ToString());
                B2b_finance_paytype modelfinance = new B2b_finance_paytypeData().GetFinancePayTypeByComid(comid);
                resHandler.setKey(modelfinance.Wx_partnerkey, modelfinance.Wx_paysignkey);
            }
            else
            {
                Response.Write("获取商家支付参数失败");
                return;
            }
            //}



            //判断签名
            if (resHandler.isTenpaySign())
            {
                if (resHandler.isWXsign())
                {
                    //商户在收到后台通知后根据通知ID向财付通发起验证确认,采用后台系统调用交互模式
                    string notify_id = resHandler.getParameter("notify_id");
                    //取结果参数做业务处理
                    string out_trade_no = resHandler.getParameter("out_trade_no");
                    //财付通订单号
                    string transaction_id = resHandler.getParameter("transaction_id");
                    //金额,以分为单位
                    string total_fee = resHandler.getParameter("total_fee");
                    //如果有使用折扣券,discount有值,total_fee+discount=原请求的total_fee
                    string discount = resHandler.getParameter("discount");
                    //支付结果
                    string trade_state = resHandler.getParameter("trade_state");

                    //即时到账
                    if ("0".Equals(trade_state))
                    {
                        //------------------------------
                        //处理业务开始
                        //------------------------------
                        string retunstr = new PayReturnSendEticketData().PayReturnSendEticket(notify_id, int.Parse(out_trade_no), decimal.Parse(total_fee) / 100, "TRADE_SUCCESS", transaction_id);


                        //对分销充值订单支付返回,对绑定订单进行处理确认
                        var handdata = OrderJsonData.agentorderpay_Hand(int.Parse(out_trade_no));


                        //处理数据库逻辑
                        //注意交易单不要重复处理
                        //注意判断返回金额

                        //------------------------------
                        //处理业务完毕
                        //------------------------------

                        //给财付通系统发送成功信息,财付通系统收到此结果后不再进行后续通知
                        Response.Write("success 后台通知成功");
                    }
                    else
                    {
                        Response.Write("支付失败");
                        return;
                    }
                    //回复服务器处理成功
                    Response.Write("success");
                }

                else
                {//SHA1签名失败
                    Response.Write("fail -SHA1 failed");
                    Response.Write(resHandler.getDebugInfo());
                    return;
                }
            }

            else
            {//md5签名失败
                Response.Write("fail -md5 failed");
                Response.Write(resHandler.getDebugInfo());
                return;
            }
        }
Beispiel #6
0
        private string Cancel_order(Agent_requestlog reqlog, OrderCancelRequestBody body, string organization, Meituan_reqlog mlog)
        {
            var response = new OrderCancelResponse();

            response.partnerId = int.Parse(agentinfo.mt_partnerId);

            string mtorderid = body.orderId.ToString();
            string order_num = body.partnerOrderId;
            string num       = body.refundQuantity.ToString();

            mlog.mtorderid = mtorderid;
            mlog.ordernum  = order_num;

            #region 条件判断
            if (order_num.ConvertTo <int>(0) == 0)
            {
                response.code     = 699;
                response.describe = "订单号格式有误";
                return(EditMTlog_Err(response, mlog, reqlog));
            }

            if (num.ConvertTo <int>(0) == 0)
            {
                response.code     = 606;
                response.describe = "退票张数格式有误";
                return(EditMTlog_Err(response, mlog, reqlog));
            }
            //判断订单是否是当前分销的订单
            bool isselforder = new Agent_requestlogData().Getisselforder(organization, order_num);
            if (isselforder == false)
            {
                response.code     = 699;
                response.describe = "订单并非此分销的订单";
                return(EditMTlog_Err(response, mlog, reqlog));
            }
            #endregion
            B2b_order morder = new B2bOrderData().GetOrderById(order_num.ConvertTo <int>(0));
            if (morder != null)
            {
                if (morder.Pro_id > 0)
                {
                    B2b_com_pro pro = new B2bComProData().GetProById(morder.Pro_id.ToString());
                    if (pro == null)
                    {
                        response.code     = 607;
                        response.describe = "产品不存在";
                        return(EditMTlog_Err(response, mlog, reqlog));
                    }
                    else
                    {
                        if (pro.Source_type == 2)//产品来源:1.系统自动生成2.倒码产品
                        {
                            response.code     = 607;
                            response.describe = "倒码产品不支持接口退票";
                            return(EditMTlog_Err(response, mlog, reqlog));
                        }
                        else
                        {
                            //得到订单的验证方式:0(一码多验);1(一码一验),
                            #region 一码多验 退票 按订单号退票,或者外部接口订单
                            if (morder.yanzheng_method == 0 || pro.Source_type == 3)
                            {
                                string      data    = OrderJsonData.QuitOrder(pro.Com_id, order_num.ConvertTo <int>(0), pro.Id, num.ConvertTo <int>(0), "分销外部接口退票");
                                XmlDocument retdoc  = (XmlDocument)JsonConvert.DeserializeXmlNode("{\"root\":" + data + "}");
                                XmlElement  retroot = retdoc.DocumentElement;
                                string      type    = retroot.SelectSingleNode("type").InnerText;
                                string      msg     = retroot.SelectSingleNode("msg").InnerText;

                                if (type == "100")//取消订单成功
                                {
                                    response.code     = 200;
                                    response.describe = "success";
                                    response.body     = new OrderCancelResponseBody
                                    {
                                        orderId        = body.orderId,
                                        refundId       = body.refundId,
                                        partnerOrderId = body.partnerOrderId,
                                        requestTime    = reqlog.Request_time.ToString("yyyy-MM-dd HH:mm:ss"),
                                        responseTime   = reqlog.Return_time.ToString("yyyy-MM-dd HH:mm:ss")
                                    };


                                    reqlog.Ordernum   = order_num;
                                    reqlog.Is_dealsuc = 1;


                                    return(EditMTlog_Err(response, mlog, reqlog));
                                }
                                else//取消订单失败
                                {
                                    response.code     = 606;
                                    response.describe = msg;
                                    return(EditMTlog_Err(response, mlog, reqlog));
                                }
                            }
                            #endregion
                            #region 一码一验 ,或非接口产品
                            else
                            {
                                response.code     = 604;
                                response.describe = "订单验码方式不支持";
                                return(EditMTlog_Err(response, mlog, reqlog));
                            }
                            #endregion
                        }
                    }
                }
                else
                {
                    response.code     = 699;
                    response.describe = "订单中产品不存在";
                    return(EditMTlog_Err(response, mlog, reqlog));
                }
            }
            else
            {
                response.code     = 699;
                response.describe = "订单不存在";
                return(EditMTlog_Err(response, mlog, reqlog));
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            SortedDictionary <string, string> sPara = GetRequestGet();

            if (sPara.Count > 0) //判断是否有带返回参数
            {
                Notify aliNotify    = new Notify();
                bool   verifyResult = aliNotify.Verify(sPara, Request.QueryString["notify_id"], Request.QueryString["sign"]);

                if (verifyResult) //验证成功
                {
                    /////////////////////////////////////////////////////////////////////////////////////////////////////////////
                    //请在这里加上商户的业务逻辑程序代码

                    //——请根据您的业务逻辑来编写程序(以下代码仅作参考)——
                    //获取支付宝的通知返回参数,可参考技术文档中页面跳转同步通知参数列表
                    string  trade_no     = Request.QueryString["trade_no"];                  //支付宝交易号
                    int     order_no     = Int32.Parse(Request.QueryString["out_trade_no"]); //获取订单号
                    decimal total_fee    = decimal.Parse(Request.QueryString["total_fee"]);  //获取总金额
                    string  subject      = Request.QueryString["subject"];                   //商品名称、订单名称
                    string  body         = Request.QueryString["body"];                      //商品描述、订单备注、描述
                    string  buyer_email  = Request.QueryString["buyer_email"];               //买家支付宝账号
                    string  trade_status = Request.QueryString["trade_status"];              //交易状态



                    //获取访问的商户COMID
                    if (Domain_def.Domain_yanzheng(RequestUrl)) //如果符合shop101.etown.cn的格式,则从多微信商户基本信息表中获取comid
                    {
                        comid = Int32.Parse(Domain_def.Domain_Huoqu(RequestUrl));
                    }
                    else
                    {
                        B2b_company_info companyinfo = B2bCompanyData.GetComId(RequestUrl);
                        if (companyinfo != null)
                        {
                            comid = companyinfo.Com_id;
                        }
                    }


                    //获取电话
                    B2b_order orderdate = new B2bOrderData().GetOrderById(order_no);
                    if (orderdate != null)
                    {
                        var saleset = B2bCompanySaleSetData.GetDirectSellByComid(orderdate.Comid.ToString());
                        if (saleset != null)
                        {
                            phone = saleset.Service_Phone;
                        }

                        var comdata = B2bCompanyData.GetCompany(orderdate.Comid);
                        if (saleset != null)
                        {
                            comname = comdata.Com_name;
                        }
                    }


                    if (Request.QueryString["trade_status"] == "TRADE_FINISHED" || Request.QueryString["trade_status"] == "TRADE_SUCCESS")
                    {
                        string retunstr = new PayReturnSendEticketData().PayReturnSendEticket(trade_no, order_no, total_fee, trade_status);
                        //对分销充值订单支付返回,对绑定订单进行处理确认
                        var handdata = OrderJsonData.agentorderpay_Hand(order_no);


                        title = ("您已成功支付" + total_fee.ToString() + "元!");
                    }
                    else
                    {
                        title = ("支付返回错误:" + Request.QueryString["trade_status"]);
                    }
                }
                else
                {
                    title = ("验证错误");
                }
            }
            else
            {
                title = ("无返回参数");
            }
        }
Beispiel #8
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string u = Request.ServerVariables["HTTP_USER_AGENT"];

            bo = detectmobilebrowser.HttpUserAgent(u);


            Dictionary <string, string> sPara = GetRequestGet();

            if (sPara.Count > 0)//判断是否有带返回参数
            {
                Notify aliNotify    = new Notify();
                bool   verifyResult = aliNotify.VerifyReturn(sPara, Request.QueryString["sign"]);

                string trade_no = Request["trade_no"];                  //支付宝交易号
                int    order_no = Int32.Parse(Request["out_trade_no"]); //获取订单号
                orderid = order_no;
                decimal total_fee = 0;                                  //获取总金额
                if (verifyResult)                                       //验证成功
                {
                    /////////////////////////////////////////////////////////////////////////////////////////////////////////////
                    //请在这里加上商户的业务逻辑程序代码


                    //获取访问的商户COMID
                    if (Domain_def.Domain_yanzheng(RequestUrl))//如果符合shop101.etown.cn的格式,则从多微信商户基本信息表中获取comid
                    {
                        comid = Int32.Parse(Domain_def.Domain_Huoqu(RequestUrl));
                    }
                    else
                    {
                        B2b_company_info companyinfo = B2bCompanyData.GetComId(RequestUrl);
                        if (companyinfo != null)
                        {
                            comid = companyinfo.Com_id;
                        }
                    }



                    //——请根据您的业务逻辑来编写程序(以下代码仅作参考)——
                    //获取支付宝的通知返回参数,可参考技术文档中页面跳转同步通知参数列表

                    ////商户订单号
                    //string out_trade_no = Request.QueryString["out_trade_no"];

                    ////支付宝交易号
                    //string trade_no = Request.QueryString["trade_no"];

                    B2bPayData datapay    = new B2bPayData();
                    B2b_pay    modelb2pay = datapay.GetPayByoId(order_no);

                    md5 = EncryptionHelper.ToMD5(order_no.ToString() + "lixh1210", "UTF-8");

                    B2b_order orderdate = new B2bOrderData().GetOrderById(order_no);
                    if (orderdate != null)
                    {
                        order_type = orderdate.Order_type;

                        var saleset = B2bCompanySaleSetData.GetDirectSellByComid(orderdate.Comid.ToString());
                        if (saleset != null)
                        {
                            phone = saleset.Service_Phone;
                        }

                        var comdata = B2bCompanyData.GetCompany(orderdate.Comid);
                        if (saleset != null)
                        {
                            comname = comdata.Com_name;
                        }


                        //根据产品id得到产品信息
                        B2bComProData datapro     = new B2bComProData();
                        B2b_com_pro   modelcompro = datapro.GetProById(orderdate.Pro_id.ToString(), orderdate.Speciid, orderdate.channelcoachid);

                        if (modelcompro != null)
                        {
                            servertype = modelcompro.Server_type;
                        }
                    }

                    if (modelb2pay != null)
                    {
                        total_fee = modelb2pay.Total_fee;
                    }

                    ////交易状态
                    string result = Request.QueryString["result"];


                    //判断是否在商户网站中已经做过了这次通知返回的处理
                    //如果没有做过处理,那么执行商户的业务程序
                    //如果有做过处理,那么不执行商户的业务程序

                    //打印页面
                    //Response.Write("验证成功<br />");订单支付 成功!
                    string retunstr = new PayReturnSendEticketData().PayReturnSendEticket(trade_no, order_no, total_fee, result);
                    title = "订单支付 成功!";

                    //对分销充值订单支付返回,对绑定订单进行处理确认
                    var handdata = OrderJsonData.agentorderpay_Hand(order_no);

                    //——请根据您的业务逻辑来编写程序(以上代码仅作参考)——

                    /////////////////////////////////////////////////////////////////////////////////////////////////////////////
                }
                else//验证失败
                {
                    //Response.Write("验证失败");
                    title = "订单支付 出现错误";
                }
            }
            else
            {
                //Response.Write("无返回参数");
                title = "订单 没有 支付";
            }
        }
Beispiel #9
0
        public void ProcessNotify(WxPayConfig config, B2b_finance_paytype model)
        {
            WxPayData notifyData = new Notify(this).GetNotifyData(config);

            Log.Info(this.GetType().ToString(), "The Pay ResultXml:" + notifyData.ToXml(config));

            //检查支付结果中transaction_id是否存在
            if (!notifyData.IsSet("transaction_id"))
            {
                //若transaction_id不存在,则立即返回结果给微信支付后台
                WxPayData res = new WxPayData();
                res.SetValue("return_code", "FAIL");
                res.SetValue("return_msg", "支付结果中微信订单号不存在");
                Log.Error(this.GetType().ToString(), "The Pay result is error : " + res.ToXml(config), config);
                Response.Write(res.ToXml(config));
                Response.End();
            }

            string transaction_id = notifyData.GetValue("transaction_id").ToString();
            string notify_id      = "1";
            string out_trade_no   = notifyData.GetValue("out_trade_no").ToString();
            string total_fee      = notifyData.GetValue("total_fee").ToString();

            //查询订单,判断订单真实性
            if (!QueryOrder(transaction_id, config))
            {
                //若订单查询失败,则立即返回结果给微信支付后台
                WxPayData res = new WxPayData();
                res.SetValue("return_code", "FAIL");
                res.SetValue("return_msg", "订单查询失败");
                Log.Error(this.GetType().ToString(), "Order query failure : " + res.ToXml(config), config);
                Response.Write(res.ToXml(config));
                Response.End();
            }
            //查询订单成功
            else
            {
                //订单支付信息如果没有,则添加支付信息
                B2b_pay   modelb2pay    = new B2bPayData().GetPayByoId(out_trade_no.ConvertTo <int>(0));
                B2b_order modelb2border = new B2bOrderData().GetOrderById(out_trade_no.ConvertTo <int>(0));
                string    Pay_name      = "";
                string    Pay_phone     = "";
                if (modelb2border != null)
                {
                    Pay_name  = modelb2border.U_name;
                    Pay_phone = modelb2border.U_phone;
                }

                #region 订单提交支付信息

                if (modelb2pay == null)
                {
                    B2b_pay eticket = new B2b_pay()
                    {
                        Id           = 0,
                        Oid          = out_trade_no.ConvertTo <int>(0),
                        Pay_com      = "wx",
                        Pay_name     = Pay_name,
                        Pay_phone    = Pay_phone,
                        Total_fee    = decimal.Parse(total_fee) / 100,
                        Trade_no     = "",
                        Trade_status = "trade_pendpay",
                        Uip          = "",
                        comid        = model.Com_id
                    };
                    int payid = new B2bPayData().InsertOrUpdate(eticket);
                }
                else
                {
                    //对已完成支付的,再次提交支付,跳转到订单也或显示此订单已支付
                    if (modelb2pay.Trade_status != "TRADE_SUCCESS")
                    {
                        //防止金额有所改动
                        modelb2pay.comid     = model.Com_id;
                        modelb2pay.Pay_com   = "wx";
                        modelb2pay.Total_fee = decimal.Parse(total_fee) / 100;
                        new B2bPayData().InsertOrUpdate(modelb2pay);
                    }
                }
                #endregion
                //------------------------------
                //处理业务开始
                //------------------------------
                string retunstr = new PayReturnSendEticketData().PayReturnSendEticket(notify_id, int.Parse(out_trade_no), decimal.Parse(total_fee) / 100, "TRADE_SUCCESS", transaction_id);

                //对分销充值订单支付返回,对绑定订单进行处理确认
                var handdata = OrderJsonData.agentorderpay_Hand(int.Parse(out_trade_no));

                // 赠送保险
                OrderJsonData.ZengsongBaoxian(int.Parse(out_trade_no));

                //给财付通系统发送成功信息,财付通系统收到此结果后不再进行后续通知
                WxPayData res = new WxPayData();
                res.SetValue("return_code", "SUCCESS");
                res.SetValue("return_msg", "OK");
                Log.Info(this.GetType().ToString(), "order query success : " + res.ToXml(config), config);
                Response.Write(res.ToXml(config));
                Response.End();
            }
        }
Beispiel #10
0
        private void ResponseMsg(RequestXML requestXML, WeiXinBasic basic)
        {
            try
            {
                string resxml = "";

                #region 接收事件推送
                if (requestXML.MsgType == "event")
                {
                    #region 关注事件 或者  已关注微信用户 扫描带参数二维码事件
                    if (requestXML.Eevent == "SCAN" || requestXML.Eevent == "subscribe")
                    {
                        lock (lockobj)
                        {
                            //判断是否是并发请求
                            string cretime = requestXML.CreateTime;
                            //获得请求发送的次数
                            int reqnum = new WxSubscribeDetailData().GetReqnum(requestXML.FromUserName, cretime, requestXML.Eevent);
                            if (reqnum == 1)
                            {
                                //如果用户二次扫描的合作单位信息,则显示 当前扫描的合作单位信息
                                int wxsourceid = requestXML.EventKey.Substring(requestXML.EventKey.IndexOf("_") + 1).ConvertTo <int>(0);
                                if (wxsourceid > 0)
                                {
                                    WxSubscribeSource sourcer = new WxSubscribeSourceData().GetWXSourceById(wxsourceid);
                                    if (sourcer != null)
                                    {
                                        if (sourcer.Productid > 0)//扫描产品二维码
                                        {
                                            //根据产品id得到产品信息
                                            B2b_com_pro pro = new B2bComProData().GetProById(sourcer.Productid.ToString());
                                            if (pro != null)
                                            {
                                                //如果是优惠劵产品,生成优惠劵订单
                                                if (pro.Server_type == 3)
                                                {
                                                    var orderdata = OrderJsonData.insertyuohuiquan(sourcer.Productid, requestXML.FromUserName);
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                    #endregion
                    #region 接收事件推送
                    if (requestXML.MsgType == "text")
                    {
                        //判断是否是顾问,1是;0不是
                        int isguwen = new MemberChannelData().IsGuwen(requestXML.FromUserName, basic.Comid);
                        if (isguwen == 1)
                        {
                            if (requestXML.Content != "")
                            {
                                if (requestXML.Content.ToLower().Substring(0, 2) == "qx" || requestXML.Content.ToLower().Substring(0, 2) == "qr")
                                {
                                    string str = "";
                                    //截取前两个字qx,进入确认流程
                                    if (requestXML.Content.ToLower().Substring(2, requestXML.Content.Length - 2) != "")
                                    {
                                        try
                                        {
                                            int orderid = int.Parse(requestXML.Content.ToLower().Substring(2, requestXML.Content.Length - 2));
                                            var snsback = OrderJsonData.UporderPaystate(orderid, requestXML.Content.ToLower().Substring(0, 2), requestXML.Content);//处理订单
                                        }
                                        catch { }

                                        if (requestXML.Content.ToLower().Substring(0, 2) == "qr")
                                        {
                                            str = "订单已确认";
                                        }
                                        if (requestXML.Content.ToLower().Substring(0, 2) == "qx")
                                        {
                                            str = "订单已取消";
                                        }
                                    }

                                    resxml = "<xml><ToUserName><![CDATA[" + requestXML.FromUserName + "]]></ToUserName><FromUserName><![CDATA[" + requestXML.ToUserName + "]]></FromUserName><CreateTime>" + CommonFunc.ConvertDateTimeInt(DateTime.Now) + "</CreateTime><MsgType><![CDATA[text]]></MsgType><Content><![CDATA[" + str + "]]></Content><FuncFlag>1</FuncFlag></xml>";
                                    System.Web.HttpContext.Current.Response.Write(resxml);
                                }
                            }
                        }
                    }
                    #endregion
                }
                #endregion
            }
            catch (Exception ex)
            {
                ////WriteTxt("异常" + ex.Message + "Struck:" + ex.StackTrace.ToString());
                //wx_logs.MyInsert("异常" + ex.Message + "Struck:" + ex.StackTrace.ToString());
                //string emptystr = "<xml><ToUserName><![CDATA[" + requestXML.FromUserName + "]]></ToUserName><FromUserName><![CDATA[" + requestXML.ToUserName + "]]></FromUserName><CreateTime>" + ConvertDateTimeInt(DateTime.Now) + "</CreateTime><MsgType><![CDATA[text]]></MsgType><Content><![CDATA[]]></Content></xml>";
                string emptystr = "";
                System.Web.HttpContext.Current.Response.Write(emptystr);
            }
        }
Beispiel #11
0
        private string Cancel_order(Agent_requestlog reqlog, discard_codemodel body, string organization, Lvmama_reqlog mlog)
        {
            var response = new backRefund();
            // response.partnerId = int.Parse(agentinfo.mt_partnerId);

            string mtorderid = body.lvmmamaorderid;
            string order_num = body.extId;
            int    num       = body.num;

            mlog.mtorderid = mtorderid;
            mlog.ordernum  = order_num;

            #region 条件判断
            if (order_num.ConvertTo <int>(0) == 0)
            {
                response.status = "4";
                response.msg    = "订单号格式有误";
                return(EditLvmamalog_Order(response, mlog, reqlog));
            }

            if (num == 0)
            {
                response.status = "4";
                response.msg    = "退票张数格式有误";
                return(EditLvmamalog_Order(response, mlog, reqlog));
            }
            //判断订单是否是当前分销的订单
            //bool isselforder = new Agent_requestlogData().lvmamaGetisselforder(organization, order_num);
            //if (isselforder == false)
            //{
            //    response.status = "4";
            //    response.msg = "订单信息错误";
            //    return EditLvmamalog_Order(response, mlog, reqlog);

            //}
            #endregion
            B2b_order morder = new B2bOrderData().GetOrderById(order_num.ConvertTo <int>(0));
            if (morder != null)
            {
                if (morder.Pro_id > 0)
                {
                    //判断订单出票单位是否正确
                    if (morder.Agentid != int.Parse(organization))
                    {
                        response.status = "4";
                        response.msg    = "订单信息错误";
                        return(EditLvmamalog_Order(response, mlog, reqlog));
                    }


                    B2b_com_pro pro = new B2bComProData().GetProById(morder.Pro_id.ToString());
                    if (pro == null)
                    {
                        response.status = "4";
                        response.msg    = "此订单对应产品错误";
                        return(EditLvmamalog_Order(response, mlog, reqlog));
                    }
                    else
                    {
                        if (pro.Source_type == 2) //产品来源:1.系统自动生成2.倒码产品3.外部接口产品
                        {
                            response.status = "4";
                            response.msg    = "倒码产品不支持接口退票";
                            return(EditLvmamalog_Order(response, mlog, reqlog));
                        }
                        else
                        {
                            //得到订单的验证方式:0(一码多验);1(一码一验),
                            #region 一码多验 退票 按订单号退票
                            if (morder.yanzheng_method == 0)
                            {
                                string      data    = OrderJsonData.QuitOrder(pro.Com_id, order_num.ConvertTo <int>(0), pro.Id, num, "分销外部接口退票");
                                XmlDocument retdoc  = (XmlDocument)JsonConvert.DeserializeXmlNode("{\"root\":" + data + "}");
                                XmlElement  retroot = retdoc.DocumentElement;
                                string      type    = retroot.SelectSingleNode("type").InnerText;
                                string      msg     = retroot.SelectSingleNode("msg").InnerText;

                                if (type == "100")//取消订单成功
                                {
                                    response.status   = "0";
                                    response.msg      = "success";
                                    reqlog.Ordernum   = order_num;
                                    reqlog.Is_dealsuc = 1;
                                    return(EditLvmamalog_Order(response, mlog, reqlog));
                                }
                                else//取消订单失败
                                {
                                    response.status = "4";
                                    response.msg    = msg;
                                    return(EditLvmamalog_Order(response, mlog, reqlog));
                                }
                            }
                            #endregion
                            #region 一码一验 退票 按电子码退票
                            else
                            {
                                response.status = "2";
                                response.msg    = "订单验码方式不支持";
                                return(EditLvmamalog_Order(response, mlog, reqlog));
                            }
                            #endregion
                        }
                    }
                }
                else
                {
                    response.status = "4";
                    response.msg    = "订单中产品不存在";
                    return(EditLvmamalog_Order(response, mlog, reqlog));
                }
            }
            else
            {
                response.status = "4";
                response.msg    = "订单不存在";
                return(EditLvmamalog_Order(response, mlog, reqlog));
            }
        }
Beispiel #12
0
        ///     产品订单创建
        public string Getordercreate(Meituan_reqlog mlog)
        {
            lock (lockobj)
            {
                var response = new OrderCreateResponse();
                response.partnerId = int.Parse(agentinfo.mt_partnerId);
                try
                {
                    var data = JsonConvert.DeserializeObject <OrderCreateRequest>(_requestParam);
                    if (data.body == null)
                    {
                        response.code     = 499;
                        response.describe = "Body数据解析失败";
                        return(EditMTlog_Order(response, mlog));
                    }
                    else
                    {
                        OrderCreateRequestBody body = data.body;

                        string product_num = body.partnerDealId;
                        string num         = body.quantity.ToString();
                        mlog.mtorderid = body.orderId.ToString();

                        //todo 根据请求参数查询产品返回结果
                        B2b_com_pro pro = new B2bComProData().GetProById(product_num);
                        #region 产品信息
                        if (pro != null)
                        {
                            #region 分销授权信息判断
                            Agent_company agentwarrantinfo = AgentCompanyData.GetAgentWarrant(agentinfo.Id, pro.Com_id);

                            if (agentwarrantinfo != null)
                            {
                                int warrantid     = agentwarrantinfo.Warrantid;
                                int Warrant_type  = agentwarrantinfo.Warrant_type;//支付类型分销 1出票扣款 2验码扣款
                                int Warrant_level = agentwarrantinfo.Warrant_level;
                                if (agentwarrantinfo.Warrant_state == 0)
                                {
                                    response.code     = 499;
                                    response.describe = "商户尚未授权此分销";
                                    return(EditMTlog_Order(response, mlog));
                                }
                            }
                            else
                            {
                                response.code     = 499;
                                response.describe = "分销还没有得到商户授权";
                                return(EditMTlog_Order(response, mlog));
                            }
                            #endregion

                            #region 暂时对外接口只支持票务产品
                            if (pro.Server_type != 1)
                            {
                                response.code     = 499;
                                response.describe = "暂时对外接口只支持票务产品,其他产品请到分销后台提单";
                                return(EditMTlog_Order(response, mlog));
                            }
                            #endregion

                            #region 价格(建议价)效验,保证美团抓到的是最新价格
                            string advice_price = body.unitPrice.ToString("f0");
                            if (pro.Advise_price.ToString("f0") != advice_price)
                            {
                                response.code     = 410;
                                response.describe = "价格(建议价)效验失败,请重新拉取价格库存日历";
                                return(EditMTlog_Order(response, mlog));
                            }
                            #endregion

                            #region 价格(分销价)效验,保证美团抓到的是最新的结算价
                            if (agentwarrantinfo.Warrant_level == 1)
                            {
                                if (body.buyPrice.ToString("f0") != pro.Agent1_price.ToString("f0"))
                                {
                                    response.code     = 410;
                                    response.describe = "价格(分销价)效验失败,请重新拉取价格库存日历";
                                    return(EditMTlog_Order(response, mlog));
                                }
                            }
                            if (agentwarrantinfo.Warrant_level == 2)
                            {
                                if (body.buyPrice.ToString("f0") != pro.Agent2_price.ToString("f0"))
                                {
                                    response.code     = 410;
                                    response.describe = "价格(分销价)效验失败,请重新拉取价格库存日历";
                                    return(EditMTlog_Order(response, mlog));
                                }
                            }
                            if (agentwarrantinfo.Warrant_level == 3)
                            {
                                if (body.buyPrice.ToString("f0") != pro.Agent3_price.ToString("f0"))
                                {
                                    response.code     = 410;
                                    response.describe = "价格(分销价)效验失败,请重新拉取价格库存日历";
                                    return(EditMTlog_Order(response, mlog));
                                }
                            }
                            #endregion

                            #region 多规格产品编码格式验证
                            int speciid = 0;
                            //判断产品编号是否符合多规格产品特点:例如 2503-1
                            if (product_num.IndexOf("-") > -1)
                            {
                                speciid = product_num.Substring(product_num.IndexOf("-") + 1).ConvertTo <int>(0);
                                if (speciid == 0)
                                {
                                    response.code     = 410;
                                    response.describe = "多规格产品编码格式有误";
                                    return(EditMTlog_Order(response, mlog));
                                }
                                product_num = product_num.Substring(0, product_num.IndexOf("-"));
                            }
                            #endregion

                            #region 产品编码格式有误
                            if (product_num.ConvertTo <int>(0) == 0)
                            {
                                response.code     = 410;
                                response.describe = "产品编码格式有误";
                                return(EditMTlog_Order(response, mlog));
                            }
                            #endregion

                            #region  购买数量格式有误
                            if (num.ConvertTo <int>(0) == 0)
                            {
                                response.code     = 410;
                                response.describe = "购买数量格式有误";
                                return(EditMTlog_Order(response, mlog));
                            }
                            #endregion

                            #region  产品限购则需要判断 限购数量 是否足够
                            if (pro.Ispanicbuy != 0)
                            {
                                //最多可购买数量
                                int zuiduo_canbuynum = pro.Limitbuytotalnum;
                                if (int.Parse(num) > zuiduo_canbuynum)
                                {
                                    response.code     = 420;
                                    response.describe = "产品库存不足";
                                    return(EditMTlog_Order(response, mlog));
                                }
                            }
                            #endregion

                            #region 产品已暂停
                            if (pro.Pro_state == 0)
                            {
                                response.code     = 421;
                                response.describe = "产品已暂停";
                                return(EditMTlog_Order(response, mlog));
                            }
                            #endregion

                            #region 产品已过期
                            if (pro.Pro_end < DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd")))
                            {
                                response.code     = 421;
                                response.describe = "产品已过期";
                                return(EditMTlog_Order(response, mlog));
                            }
                            #endregion

                            #region   产品是否需要预约:需要预约则最晚预约时间是 游玩前一天的18点
                            if (pro.isneedbespeak == 1)
                            {
                                if (body.travelDate != "")
                                {
                                    DateTime visitdate = DateTime.Parse(body.travelDate);
                                    DateTime bookdate  = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd"));

                                    //必须提前一天预约
                                    if (bookdate >= visitdate)
                                    {
                                        response.code     = 422;
                                        response.describe = "产品需要提前一天预约";
                                        return(EditMTlog_Order(response, mlog));
                                    }
                                }
                            }
                            #endregion

                            #region  是否有使用限制
                            if (pro.Iscanuseonsameday == 0)//1:当天出票可用 ;2:2小时内出票不可用;0:当天出票不可用
                            {
                                if (body.travelDate != "")
                                {
                                    DateTime visitdate = DateTime.Parse(body.travelDate);//游玩日期:2012-12-12 格式要求:yyyy-MM-dd

                                    DateTime bookdate = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd"));
                                    if (bookdate >= visitdate)
                                    {
                                        response.code     = 422;
                                        response.describe = "预定日期至少在游玩日期之前一天";
                                        return(EditMTlog_Order(response, mlog));
                                    }
                                }
                            }
                            #endregion



                            Meituan_reqlog mtOrderCrateSucLog = new Meituan_reqlogData().GetMtOrderCrateLogByMtorder(body.orderId.ToString(), "200");
                            #region 美团订单成功创建过
                            if (mtOrderCrateSucLog != null)
                            {
                                response.code      = 200;
                                response.describe  = "订单创建成功";
                                response.partnerId = int.Parse(agentinfo.mt_partnerId);
                                response.body      = new OrderCreateResponseBody
                                {
                                    partnerOrderId = mtOrderCrateSucLog.ordernum
                                };

                                mlog.ordernum = mtOrderCrateSucLog.ordernum;
                                return(EditMTlog_Order(response, mlog));
                            }
                            #endregion
                            #region 美团订单没有成功创建过
                            else
                            {
                                int    isInterfaceSub = 1;   //是否是电子票接口提交的订单:0.否;1.是
                                string ordertype      = "1"; //1.出票2.充值
                                int    orderid        = 0;

                                string             real_name   = "";
                                string             mobile      = "";
                                string             use_date    = body.travelDate;
                                List <BaseVisitor> visitorlist = body.visitors;
                                if (visitorlist.Count > 0)
                                {
                                    foreach (BaseVisitor info in visitorlist)
                                    {
                                        if (info != null)
                                        {
                                            real_name = info.name;
                                            mobile    = info.mobile;
                                            break;
                                        }
                                    }
                                }
                                //创建一笔未支付订单
                                string      rdata   = OrderJsonData.CreateNopayOrder(agentinfo.Id, product_num, ordertype, num, real_name, mobile, use_date, isInterfaceSub, out orderid, speciid);
                                XmlDocument retdoc  = (XmlDocument)JsonConvert.DeserializeXmlNode("{\"root\":" + rdata + "}");
                                XmlElement  retroot = retdoc.DocumentElement;
                                string      rtype   = retroot.SelectSingleNode("type").InnerText;
                                string      rmsg    = retroot.SelectSingleNode("msg").InnerText;
                                if (rtype == "100")//创建订单成功
                                {
                                    //针对美团因为创建未支付订单 是单写的,所以同时创建一笔wl订单
                                    #region 万龙接口订单
                                    if (pro.Source_type == 3 && pro.Serviceid == 4)
                                    {
                                        try
                                        {
                                            B2b_company commanage = B2bCompanyData.GetAllComMsg(pro.Com_id);
                                            WlGetProInfoDealRequestData wldata = new WlGetProInfoDealRequestData(commanage.B2bcompanyinfo.wl_PartnerId, commanage.B2bcompanyinfo.wl_userkey);

                                            WlDealResponseBody WlDealinfo = wldata.SelectonegetWlProDealData(pro.Service_proid, pro.Com_id);
                                            if (WlDealinfo == null)
                                            {
                                                response.code     = 499;
                                                response.describe = "订单创建失败1";
                                                return(EditMTlog_Order(response, mlog));
                                            }
                                            double toal     = WlDealinfo.marketPrice * int.Parse(num);
                                            string tavedate = "";


                                            var createwlorder = wldata.wlOrderCreateRequest_json(int.Parse(commanage.B2bcompanyinfo.wl_PartnerId), real_name, mobile, orderid.ToString(), product_num.ToString(), WlDealinfo.proID, WlDealinfo.settlementPrice, WlDealinfo.marketPrice, toal, int.Parse(num), tavedate);//

                                            var wlcreate = wldata.wlOrderCreateRequest_data(createwlorder, pro.Com_id);
                                            if (wlcreate.IsSuccess == true)
                                            {
                                                //wl订单创建成功
                                            }
                                            else
                                            {
                                                //return JsonConvert.SerializeObject(new { type = 1, msg = "wl接口创建订单失败1" });
                                                response.code     = 499;
                                                response.describe = "订单创建失败1";
                                                return(EditMTlog_Order(response, mlog));
                                            }
                                        }
                                        catch (Exception ex)
                                        {
                                            response.code     = 499;
                                            response.describe = "订单创建失败" + ex.Message;
                                            return(EditMTlog_Order(response, mlog));
                                        }
                                    }
                                    #endregion


                                    response.code      = 200;
                                    response.describe  = "订单创建成功";
                                    response.partnerId = int.Parse(agentinfo.mt_partnerId);
                                    response.body      = new OrderCreateResponseBody
                                    {
                                        partnerOrderId = orderid.ToString()
                                    };

                                    mlog.ordernum = orderid.ToString();
                                    return(EditMTlog_Order(response, mlog));
                                }
                                else
                                {
                                    response.code     = 499;
                                    response.describe = "订单创建失败";
                                    return(EditMTlog_Order(response, mlog));
                                }
                            }
                            #endregion
                        }
                        else
                        {
                            response.code     = 421;
                            response.describe = "产品不存在";
                            return(EditMTlog_Order(response, mlog));
                        }
                        #endregion
                    }
                }
                catch (Exception ex)
                {
                    response.code     = 499;
                    response.describe = "异常错误" + ex;

                    return(EditMTlog_Order(response, mlog));
                }
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            SortedDictionary <string, string> sPara = GetRequestPost();

            if (sPara.Count > 0)//判断是否有带返回参数
            {
                Notify aliNotify    = new Notify();
                bool   verifyResult = aliNotify.Verify(sPara, Request.Form["notify_id"], Request.Form["sign"]);

                if (verifyResult)//验证成功
                {
                    /////////////////////////////////////////////////////////////////////////////////////////////////////////////
                    //请在这里加上商户的业务逻辑程序代码


                    //——请根据您的业务逻辑来编写程序(以下代码仅作参考)——
                    //获取支付宝的通知返回参数,可参考技术文档中服务器异步通知参数列表

                    //批次号

                    string batch_no = Request.Form["batch_no"];

                    //批量退款数据中转账成功的笔数

                    string success_num = Request.Form["success_num"];

                    //批量退款数据中的详细信息
                    string result_details = Request.Form["result_details"];


                    //判断是否在商户网站中已经做过了这次通知返回的处理
                    //如果没有做过处理,那么执行商户的业务程序
                    //如果有做过处理,那么不执行商户的业务程序

                    string error_code = "";
                    string error_desc = "";

                    try
                    {
                        error_code = result_details.IndexOf("SUCCESS") > -1 ? "SUCCESS" : result_details;

                        string[] arr = error_code.Split('^');
                        foreach (string carr in arr)
                        {
                            if (carr != "")
                            {
                                if (carr.IndexOf("$") > -1)
                                {
                                    error_code = carr.Substring(0, carr.IndexOf("$"));
                                }
                            }
                        }

                        error_desc = EnumUtils.GetName((RefundErrocode)Enum.Parse(typeof(RefundErrocode), error_code, false));
                    }
                    catch (Exception ex)
                    {
                        error_desc = "获取枚举描述错误(" + ex.Message + ")";
                    }
                    string notify_id   = Request.Form["notify_id"];
                    string notify_type = Request.Form["notify_type"];
                    string notify_time = Request.Form["notify_time"];


                    int uprefundlog = new B2b_pay_alipayrefundlogData().Uprefundlog(batch_no, success_num, result_details, error_code, error_desc, notify_id, notify_type, notify_time);

                    if (error_code == "SUCCESS")
                    {
                        if (uprefundlog == 0)
                        {
                            TxtHelper.WriteFile("D:\\site\\b2betown\\ETS2.WebApp\\alipayrefund_severeerrLog.txt", "退款批次" + batch_no + ";支付宝已经退款,录入退款日志出错,抓紧处理,防止重复给客户退款");
                        }

                        //根据batch_no(退款批次)得到 退款日志
                        B2b_pay_alipayrefundlog malipayrefundlog = new B2b_pay_alipayrefundlogData().Getrefundlogbybatch_no(batch_no);
                        if (malipayrefundlog == null)
                        {
                            //加txt文档记录
                            TxtHelper.WriteFile("D:\\site\\b2betown\\ETS2.WebApp\\alipayrefund_severeerrLog.txt", "退款批次" + batch_no + ";支付宝已经退款,根据batch_no(退款批次)得到 退款日志出错,抓紧处理,防止重复给客户退款");
                        }
                        else
                        {
                            //退押金
                            if (malipayrefundlog.rentserver_refundlogid > 0)
                            {
                                //修改退押金日志表中 退押金状态
                                new B2b_Rentserver_RefundLogData().Upb2b_Rentserver_RefundLogState(malipayrefundlog.rentserver_refundlogid, 1);

                                //需要在易城给特定商户(钱支付到易城的)做一笔支出操作;
                                B2b_order a_orderinfo = new B2bOrderData().GetOrderById(malipayrefundlog.orderid);
                                B2b_pay   mpay        = new B2bPayData().GetSUCCESSPayById(malipayrefundlog.orderid);
                                string    proname     = new B2bComProData().GetProName(a_orderinfo.Pro_id);
                                var       company     = B2bCompanyData.GetCompany(a_orderinfo.Comid);

                                OrderJsonData.ZhichuFromYicheng(mpay, a_orderinfo, proname, company, malipayrefundlog.refund_fee);
                            }
                            //订单退款
                            else
                            {
                                B2b_order oldorder = new B2bOrderData().GetOrderById(malipayrefundlog.orderid);

                                if (oldorder != null)
                                {
                                    if (oldorder.Order_state == 17 || oldorder.Order_state == 18)
                                    {
                                        oldorder.Order_state    = (int)OrderStatus.QuitOrder;//订单退票
                                        oldorder.Ticketinfo     = oldorder.askquitfeereason + "-" + oldorder.askquitfeeexplain;
                                        oldorder.Backtickettime = DateTime.Now;
                                        oldorder.Ticket         = malipayrefundlog.refund_fee;

                                        new B2bOrderData().InsertOrUpdate(oldorder);
                                    }
                                }

                                string data2 = OrderJsonData.Upticket(oldorder);
                                data2 = "{\"root\":" + data2 + "}";
                                XmlDocument xxd2  = JsonConvert.DeserializeXmlNode(data2);
                                string      type2 = xxd2.SelectSingleNode("root/type").InnerText;
                                string      msg2  = xxd2.SelectSingleNode("root/msg").InnerText;


                                if (type2 == "100")
                                {
                                    //data2 = "{\"type\":100,\"msg\":\"退款成功,款项已自动退回给用户!\"}";
                                    Response.Write("success");  //请不要修改或删除
                                    return;
                                }
                                else
                                {
                                    TxtHelper.WriteFile("D:\\site\\b2betown\\ETS2.WebApp\\alipayrefund_severeerrLog.txt", oldorder.Id + "支付宝已经退款,可是出现严重意外错误(" + msg2 + "),抓紧处理,防止重复给客户退款");
                                    Response.Write("fail");  //请不要修改或删除
                                    return;
                                }
                            }
                        }
                    }
                    else
                    {
                        Response.Write("success");  //请不要修改或删除
                    }



                    //——请根据您的业务逻辑来编写程序(以上代码仅作参考)——

                    /////////////////////////////////////////////////////////////////////////////////////////////////////////////
                }
                else//验证失败
                {
                    Response.Write("fail");
                }
            }
            else
            {
                Response.Write("无通知参数");
            }
        }
Beispiel #14
0
    protected void Page_Load(object sender, EventArgs e)
    {
        Dictionary <string, string> sPara = GetRequestPost();

        if (sPara.Count > 0)//判断是否有带返回参数
        {
            Notify aliNotify    = new Notify();
            bool   verifyResult = aliNotify.VerifyNotify(sPara, Request.Form["sign"]);



            if (verifyResult)//验证成功
            {
                //XML解析notify_data数据
                try
                {
                    XmlDocument xmlDoc = new XmlDocument();
                    xmlDoc.LoadXml(sPara["notify_data"]);
                    //商户订单号
                    string order_no = xmlDoc.SelectSingleNode("/notify/out_trade_no").InnerText;
                    //支付宝交易号
                    string trade_no = xmlDoc.SelectSingleNode("/notify/trade_no").InnerText;
                    //交易状态
                    string  trade_status = xmlDoc.SelectSingleNode("/notify/trade_status").InnerText;
                    decimal total_fee    = decimal.Parse(xmlDoc.SelectSingleNode("/notify/total_fee").InnerText);

                    if (trade_status == "TRADE_FINISHED" || trade_status == "TRADE_SUCCESS")
                    {
                        //判断该笔订单是否在商户网站中已经做过处理
                        //如果没有做过处理,根据订单号(out_trade_no)在商户网站的订单系统中查到该笔订单的详细,并执行商户的业务程序
                        //如果有做过处理,不执行商户的业务程序

                        //注意:
                        //该种交易状态只在两种情况下出现
                        //1、开通了普通即时到账,买家付款成功后。
                        //2、开通了高级即时到账,从该笔交易成功时间算起,过了签约时的可退款时限(如:三个月以内可退款、一年以内可退款等)后。
                        //B2bPayData datapay = new B2bPayData();
                        //B2b_pay modelb2pay = datapay.GetPayByoId(Int32.Parse(order_no));
                        //if (modelb2pay != null)
                        //{
                        //    total_fee = modelb2pay.Total_fee;
                        //}

                        string retunstr = new PayReturnSendEticketData().PayReturnSendEticket(trade_no, Int32.Parse(order_no), total_fee, trade_status);

                        Response.Write("success");  //请不要修改或删除

                        #region 赠送保险
                        OrderJsonData.ZengsongBaoxian(Int32.Parse(order_no));
                        #endregion
                    }
                    else
                    {
                        Response.Write(trade_status);
                    }
                }
                catch (Exception exc)
                {
                    Response.Write(exc.ToString());
                }



                //——请根据您的业务逻辑来编写程序(以上代码仅作参考)——

                /////////////////////////////////////////////////////////////////////////////////////////////////////////////
            }
            else//验证失败
            {
                Response.Write("fail");
            }
        }
        else
        {
            Response.Write("无通知参数");
        }
    }
Beispiel #15
0
      public string Getordercreate(Lvmama_reqlog mlog, Agent_company agentinfo)
      {
          lock (lockobj)
          {
              var response = new apply_codeRefund();
              try
              {
                  var data = JsonConvert.DeserializeObject <apply_codemodel>(_requestParam);
                  if (data.contacts == null)
                  {
                      response.uid    = agentinfo.Lvmama_uid;
                      response.status = "2";
                      response.msg    = "数据解析失败";
                      return(EditLvmamalog_Order(response, mlog));
                  }
                  else
                  {
                      contacts body = data.contacts;

                      string num             = data.num;
                      string timestamp       = data.timestamp;
                      string visitTime       = data.visitTime;
                      string supplierGoodsId = data.supplierGoodsId;
                      string settlePrice     = data.settlePrice;
                      string serialNo        = data.serialNo;
                      string idNum           = body.idNum;
                      string name            = body.name;
                      string mobile          = body.mobile;
                      string idType          = body.idType;

                      //结算价核对
                      decimal jiesuanjia = 0;

                      ////todo 根据请求参数查询产品返回结果
                      B2b_com_pro pro = new B2bComProData().GetProById(supplierGoodsId);
                      #region 产品信息
                      if (pro != null)
                      {
                          #region 分销授权信息判断
                          Agent_company agentwarrantinfo = AgentCompanyData.GetAgentWarrant(agentinfo.Id, pro.Com_id);

                          if (agentwarrantinfo != null)
                          {
                              int warrantid     = agentwarrantinfo.Warrantid;
                              int Warrant_type  = agentwarrantinfo.Warrant_type; //支付类型分销 1出票扣款 2验码扣款
                              int Warrant_level = agentwarrantinfo.Warrant_level;

                              if (Warrant_level == 1)
                              {
                                  jiesuanjia = pro.Agent1_price;
                              }
                              if (Warrant_level == 2)
                              {
                                  jiesuanjia = pro.Agent2_price;
                              }

                              if (Warrant_level == 3)
                              {
                                  jiesuanjia = pro.Agent3_price;
                              }



                              if (agentwarrantinfo.Warrant_state == 0)
                              {
                                  response.uid     = agentinfo.Lvmama_uid;
                                  response.orderId = "0";
                                  response.status  = "3";
                                  response.msg     = "商户关闭授权";
                                  return(EditLvmamalog_Order(response, mlog));
                              }
                          }
                          else
                          {
                              response.uid     = agentinfo.Lvmama_uid;
                              response.orderId = "0";
                              response.status  = "3";
                              response.msg     = "商户未授权开通分销";
                              return(EditLvmamalog_Order(response, mlog));
                          }
                          #endregion

                          #region 暂时对外接口只支持票务产品
                          //if (pro.Server_type != 1)
                          //{
                          //    response.status = 300;
                          //    response.msg = "暂时对外接口只支持票务产品,其他产品请到分销后台提单";
                          //    return EditLvmamalog_Order(response, mlog);
                          //}
                          #endregion

                          #region 结算价,保证价格是最新价格
                          decimal advice_price = Convert.ToDecimal(settlePrice);
                          if (jiesuanjia != advice_price)
                          {
                              response.uid     = agentinfo.Lvmama_uid;
                              response.orderId = "0";
                              response.status  = "3";
                              response.msg     = "结算价格不同,请联系供应商要去新的价格。驴妈妈价:" + advice_price + " 系统价:" + jiesuanjia;
                              return(EditLvmamalog_Order(response, mlog));
                          }
                          #endregion



                          #region 产品编码格式有误
                          if (supplierGoodsId.ConvertTo <int>(0) == 0)
                          {
                              response.uid     = agentinfo.Lvmama_uid;
                              response.orderId = "0";
                              response.status  = "3";
                              response.msg     = "产品编码格式有误";
                              return(EditLvmamalog_Order(response, mlog));
                          }
                          #endregion

                          #region  购买数量格式有误
                          if (num.ConvertTo <int>(0) == 0)
                          {
                              response.uid     = agentinfo.Lvmama_uid;
                              response.orderId = "0";
                              response.status  = "3";
                              response.msg     = "购买数量格式有误";
                              return(EditLvmamalog_Order(response, mlog));
                          }
                          #endregion

                          #region  产品限购则需要判断 限购数量 是否足够
                          if (pro.Ispanicbuy != 0)
                          {
                              //最多可购买数量
                              int zuiduo_canbuynum = pro.Limitbuytotalnum;
                              if (int.Parse(num) > zuiduo_canbuynum)
                              {
                                  response.uid     = agentinfo.Lvmama_uid;
                                  response.orderId = "0";
                                  response.status  = "3";
                                  response.msg     = "产品库存不足";
                                  return(EditLvmamalog_Order(response, mlog));
                              }
                          }
                          #endregion

                          #region 产品已暂停
                          if (pro.Pro_state == 0)
                          {
                              response.uid     = agentinfo.Lvmama_uid;
                              response.orderId = "0";
                              response.status  = "3";
                              response.msg     = "产品已下线,请联系商家";
                              return(EditLvmamalog_Order(response, mlog));
                          }
                          #endregion

                          #region 产品已过期
                          if (pro.Pro_end < DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd")))
                          {
                              response.uid     = agentinfo.Lvmama_uid;
                              response.orderId = "0";
                              response.status  = "3";
                              response.msg     = "产品已过期";
                              return(EditLvmamalog_Order(response, mlog));
                          }
                          #endregion

                          #region   产品是否需要预约:需要预约则最晚预约时间是 游玩前一天的18点
                          //if (pro.isneedbespeak == 1)
                          //{
                          //    if (timestamp != "")
                          //    {
                          //        DateTime visitdate = DateTime.Parse(timestamp);
                          //        DateTime bookdate = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd"));

                          //        //必须提前一天预约
                          //        if (bookdate >= visitdate)
                          //        {
                          //             response.orderId = "0";
                          //response.status = "300";
                          //response.msg = "产品未预约产品";
                          //            return EditLvmamalog_Order(response, mlog);
                          //        }
                          //    }
                          //}
                          #endregion

                          #region  是否有使用限制
                          //if (pro.Iscanuseonsameday == 0)//1:当天出票可用 ;2:2小时内出票不可用;0:当天出票不可用
                          //{
                          //    if (body.travelDate != "")
                          //    {
                          //        DateTime visitdate = DateTime.Parse(body.travelDate);//游玩日期:2012-12-12 格式要求:yyyy-MM-dd

                          //        DateTime bookdate = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd"));
                          //        if (bookdate >= visitdate)
                          //        {
                          //            response.code = 300;
                          //            response.describe = "预定日期至少在游玩日期之前一天";
                          //            return EditMTlog_Order(response, mlog);
                          //        }
                          //    }

                          //}
                          #endregion



                          Lvmama_reqlog mtOrderCrateSucLog = new lvmama_reqlogData().GetLvmamaOrderCreateLogByLvmamaorder(serialNo, "0");
                          #region 查询驴妈妈吗 是否 创建订单日志
                          if (mtOrderCrateSucLog != null)
                          {
                              string pno = "";
                              if (pro.Source_type == 3)  //如果是接口产品,按接口方式读码selservice,接口产品只读取了wl的码
                              {
                                  if (pro.Serviceid == 4)
                                  {   //如果是接口产品
                                      B2b_company commanage = B2bCompanyData.GetAllComMsg(pro.Com_id);
                                      WlGetProInfoDealRequestData wldata = new WlGetProInfoDealRequestData(commanage.B2bcompanyinfo.wl_PartnerId, commanage.B2bcompanyinfo.wl_userkey);
                                      var wlorderinfo = wldata.SearchWlOrderData(pro.Com_id, 0, "", int.Parse(mtOrderCrateSucLog.ordernum));
                                      if (wlorderinfo != null)
                                      {
                                          pno = wlorderinfo.vouchers;
                                      }
                                  }
                              }
                              else
                              {  //如果不是借口,则按自己规则读码
                                  SendEticketData sendate = new SendEticketData();
                                  pno = sendate.HuoQuEticketPno(int.Parse(mtOrderCrateSucLog.ordernum));
                              }

                              response.uid      = agentinfo.Lvmama_uid;
                              response.orderId  = mtOrderCrateSucLog.ordernum;
                              response.status   = "0";
                              response.authCode = pno;
                              response.serialNo = serialNo;
                              response.msg      = "订单创建成功";
                              mlog.ordernum     = mtOrderCrateSucLog.ordernum;
                              return(EditLvmamalog_Order(response, mlog));
                          }
                          #endregion
                          #region 此驴妈妈订单号 ,没有成功创建过
                          else
                          {
                              int    isInterfaceSub = 1;   //是否是电子票接口提交的订单:0.否;1.是
                              string ordertype      = "1"; //1.出票2.充值
                              int    orderid        = 0;
                              int    speciid        = 0;
                              //string real_name = "";
                              //string mobile = "";

                              string use_date = timestamp.Substring(0, 4) + "-" + timestamp.Substring(4, 2) + "-" + timestamp.Substring(6, 2);

                              //real_name = name;
                              //mobile = mobile;

                              //创建一笔未支付订单
                              string      rdata   = OrderJsonData.AgentOrder(agentinfo.Id, supplierGoodsId, ordertype, num, name, mobile, use_date, "", isInterfaceSub, out orderid);
                              XmlDocument retdoc  = (XmlDocument)JsonConvert.DeserializeXmlNode("{\"root\":" + rdata + "}");
                              XmlElement  retroot = retdoc.DocumentElement;
                              string      rtype   = retroot.SelectSingleNode("type").InnerText;
                              string      rmsg    = retroot.SelectSingleNode("msg").InnerText;
                              if (rtype == "100")  //创建订单成功
                              {
                                  response.uid      = agentinfo.Lvmama_uid;
                                  response.status   = "0";
                                  response.msg      = "订单创建成功";
                                  response.orderId  = orderid.ToString();
                                  response.serialNo = serialNo;
                                  response.authCode = retroot.SelectSingleNode("pno").InnerText;   //只有成功的订单才有pno项;
                                  mlog.ordernum     = orderid.ToString();
                                  return(EditLvmamalog_Order(response, mlog));
                              }
                              else
                              {
                                  response.uid    = agentinfo.Lvmama_uid;
                                  response.status = "3";
                                  response.msg    = "创建订单失败" + rmsg;
                                  return(EditLvmamalog_Order(response, mlog));
                              }
                          }
                          #endregion
                      }
                      else
                      {
                          response.uid    = agentinfo.Lvmama_uid;
                          response.uid    = "0";
                          response.status = "4";
                          response.msg    = "产品不存在";
                          return(EditLvmamalog_Order(response, mlog));
                      }
                      #endregion
                  }
              }
              catch (Exception ex)
              {
                  response.uid    = agentinfo.Lvmama_uid;
                  response.status = "8";
                  response.msg    = "异常错误" + ex;

                  return(EditLvmamalog_Order(response, mlog));
              }
          }
      }
Beispiel #16
0
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";
            string oper       = context.Request["oper"].ConvertTo <string>("");
            string phone      = context.Request["phone"].ConvertTo <string>("");
            string smscontent = context.Request["smscontent"].ConvertTo <string>("");

            string dxstr = context.Request["dxstr"].ConvertTo <string>("");
            //TxtHelper.WriteFile("D:\\site\\b2betown\\ETS2.WebApp\\BaoxianLog.txt", dxstr);
            string msg = "";

            if (oper == "234908uasdlkfjasdfou234kldfuasfk234u809dsfjasdfu90")
            {
                var snsback = SendSmsHelper.SendSms(phone, smscontent, 106, out msg);

                context.Response.Write(snsback);
            }

            //接收短信上行数据 http://ip:port/MO?dxstr=2,13800138000,0,F165245140224152846,20140428172543;2,15193792747,0,F165246140224152846,20140428172543;
            if (dxstr != "")
            {
                //var OrderData1 = new B2bOrderData();
                //var insertstepm = OrderData1.InsertSmsback(0, "", "", dxstr, "");


                var dxstr_arr = dxstr.Split(';');
                for (int i = 0; i < dxstr_arr.Length; i++) //分解每条消息
                {
                    if (dxstr_arr[i] != "")                //判断消息是否为空
                    {
                        var duanxin_arr = dxstr_arr[i].Split(',');
                        if (duanxin_arr.Length == 5)    //必须含有5个参数,下面读取对应的值,如果不匹配,暂时 不操作
                        {
                            var duanxin_type   = int.Parse(duanxin_arr[0]);
                            var duanxin_mobile = duanxin_arr[1];
                            var duanxin_state  = duanxin_arr[2];
                            var duanxin_con    = duanxin_arr[3];
                            var duanxin_time   = duanxin_arr[4];


                            if (duanxin_type == 0)    //上行消息

                            //上行消息写入记录
                            {
                                var OrderData = new B2bOrderData();
                                var insertsms = OrderData.InsertSmsback(duanxin_type, duanxin_mobile, duanxin_state, duanxin_con, duanxin_time);


                                //对上行消息判定
                                if (duanxin_con != "")
                                {
                                    if (duanxin_con.ToLower().Substring(0, 2) == "qr" || duanxin_con.ToLower().Substring(0, 2) == "qx" || duanxin_con.ToLower().Substring(0, 2) == "tj")
                                    {
                                        //截取前两个字qr,进入确认流程
                                        int orderid = int.Parse(duanxin_con.ToLower().Substring(2, duanxin_con.Length - 2));

                                        var snsback = OrderJsonData.UporderPaystate(orderid, duanxin_con.ToLower().Substring(0, 2), duanxin_mobile);

                                        context.Response.Write(snsback);
                                    }
                                }
                            }

                            if (duanxin_type == 2) //状态报告,未做
                            {
                            }
                        }
                    }
                }
            }
        }
Beispiel #17
0
        protected void Page_Load(object sender, EventArgs e)
        {
            SortedDictionary <string, string> sPara = GetRequestPost();

            if (sPara.Count > 0)//判断是否有带返回参数
            {
                Notify aliNotify    = new Notify();
                bool   verifyResult = aliNotify.Verify(sPara, Request["notify_id"], Request["sign"]);

                if (verifyResult)//验证成功
                {
                    /////////////////////////////////////////////////////////////////////////////////////////////////////////////
                    //请在这里加上商户的业务逻辑程序代码

                    //——请根据您的业务逻辑来编写程序(以下代码仅作参考)——
                    //获取支付宝的通知返回参数,可参考技术文档中服务器异步通知参数列表
                    string  trade_no     = Request["trade_no"];                  //支付宝交易号
                    int     order_no     = Int32.Parse(Request["out_trade_no"]); //获取订单号
                    decimal total_fee    = decimal.Parse(Request["total_fee"]);  //获取总金额
                    string  subject      = Request["subject"];                   //商品名称、订单名称
                    string  body         = Request.Form["body"];                 //商品描述、订单备注、描述
                    string  buyer_email  = Request["buyer_email"];               //买家支付宝账号
                    string  trade_status = Request["trade_status"];              //交易状态

                    if (trade_status == "TRADE_FINISHED" || trade_status == "TRADE_SUCCESS")
                    {
                        //判断该笔订单是否在商户网站中已经做过处理
                        //如果没有做过处理,根据订单号(out_trade_no)在商户网站的订单系统中查到该笔订单的详细,并执行商户的业务程序
                        //如果有做过处理,不执行商户的业务程序
                        #region
                        //查询支付,并修改为支付成功
                        //B2bPayData datapay = new B2bPayData();
                        //B2b_pay modelb2pay = datapay.GetPayByoId(order_no);

                        //if (modelb2pay.Trade_status != "TRADE_SUCCESS")//判断原状态是否为不成功
                        //{
                        //    if (modelb2pay.Total_fee == total_fee)//判断支付金额是否相同
                        //    {
                        //        //B2b_pay payinfo = new B2b_pay()
                        //        //{
                        //        //    Id = modelb2pay.Id,
                        //        //    Trade_no = trade_no,
                        //        //    Trade_status = "TRADE_SUCCESS",
                        //        //};

                        //        modelb2pay.Trade_no = trade_no;
                        //        modelb2pay.Trade_status = "TRADE_SUCCESS";
                        //        int payid = datapay.InsertOrUpdate(modelb2pay);//修改支付状态


                        //        //根据订单id得到订单信息
                        //        B2bOrderData dataorder = new B2bOrderData();
                        //        B2b_order modelb2border = dataorder.GetOrderById(order_no);

                        //        //---------------新增1begin--------------//
                        //        modelb2border.Pay_state = (int)PayStatus.HasPay;
                        //        modelb2border.Order_state = (int)OrderStatus.HasPay;
                        //        //修改此订单的支付状态为“支付成功” ,订单状态为“已付款”
                        //        dataorder.InsertOrUpdate(modelb2border);
                        //        //---------------新增1end--------------//

                        //        //根据产品id得到产品信息
                        //        B2bComProData datapro = new B2bComProData();
                        //        B2b_com_pro modelcompro = datapro.GetProById(modelb2border.Pro_id.ToString());

                        //        //得到商家信息,账户余额
                        //        B2b_company modelcom = B2bCompanyData.GetCompany(modelcompro.Com_id);
                        //        decimal Over_money = modelcom.Imprest + total_fee;

                        //        //得到支付方式,如果是支付到自己的支付宝账户则需要增加退出记录
                        //        B2bFinanceData datefin = new B2bFinanceData();
                        //        B2b_Finance modelfin = datefin.FinancePayType(modelcompro.Com_id);
                        //        int Paytype_int = 1;//支付款到 易城=1 支付到自己=2

                        //        if (modelfin != null)
                        //        {
                        //            Paytype_int = modelfin.Paytype;
                        //        }


                        //        //增加财务记录
                        //        B2bFinanceData Financed = new B2bFinanceData();
                        //        B2b_Finance Financeinfo = new B2b_Finance()
                        //        {

                        //            Id = 0,
                        //            Com_id = modelcompro.Com_id,
                        //            Agent_id = 0,           //分销编号(默认为0)
                        //            Eid = 0,                //易城账户(默认为0,0=没有交易,1=和易城交易)
                        //            Order_id = modelcompro.Id,           //订单号(默认为0)
                        //            Servicesname = modelcompro.Pro_name,       //交易名称/内容
                        //            SerialNumber = DateTime.Now.ToString("yyyyMMddhhmmssfff"),       //财务流水号
                        //            Money = total_fee,              //金额
                        //            Payment = 0,            //收支(0=收款,1=支出)
                        //            Payment_type = "直销收款",       //类型(充值,商家提现,直销收款,消费(验票),商家退款,直销退票,手续费,商家返点)
                        //            Money_come = "支付宝",         //资金来源(网上支付,银行收款等)
                        //            Over_money = Over_money,       //余额(根据商家,分销,易城,编号显示相应余额)
                        //            Paytype = Paytype_int

                        //        };
                        //        int finaceid = Financed.InsertOrUpdate(Financeinfo);


                        //        //如果是支付到商户的支付宝则增加一笔支出操作与上面做平
                        //        if (Paytype_int == 2)
                        //        {
                        //            B2b_Finance Financebackinfo = new B2b_Finance()
                        //            {
                        //                Id = 0,
                        //                Com_id = modelcompro.Com_id,
                        //                Agent_id = 0,           //分销编号(默认为0)
                        //                Eid = 0,                //易城账户(默认为0,0=没有交易,1=和易城交易)
                        //                Order_id = modelcompro.Id,           //订单号(默认为0)
                        //                Servicesname = modelcompro.Pro_name,       //交易名称/内容
                        //                SerialNumber = DateTime.Now.ToString("yyyyMMddhhmmssfff"),       //财务流水号
                        //                Money = 0 - total_fee,              //金额
                        //                Payment = 1,            //收支(0=收款,1=支出)
                        //                Payment_type = "提现-商家支付宝",       //类型(充值,商家提现,直销收款,消费(验票),商家退款,直销退票,手续费,商家返点)
                        //                Money_come = "支付宝",         //资金来源(网上支付,银行收款等)
                        //                Over_money = Over_money - total_fee       //余额(根据商家,分销,易城,编号显示相应余额)
                        //            };
                        //            int finacebackid = Financed.InsertOrUpdate(Financebackinfo);

                        //        }

                        //        //---------------------------生成电子票并发送-------------------------------
                        //        //如果订单“已付款”则执行发码操作,否则跳过
                        //        if ((int)modelb2border.Order_state == (int)OrderStatus.HasPay)
                        //        {

                        //            //生成电子码
                        //            int u_num = modelb2border.U_num;
                        //            int comid = modelcompro.Com_id;
                        //            RandomCodeData datarandomcode = new RandomCodeData();
                        //            RandomCode modelrandomcode = datarandomcode.GetRandomCode();//得到未用随机码对象


                        //            //设置取出的电子码状态为1(已使用)
                        //            modelrandomcode.State = 1;
                        //            int randomcodeid = datarandomcode.InsertOrUpdate(modelrandomcode);
                        //            string eticketcode = "9" + comid.ToString() + modelrandomcode.Code.ToString();
                        //            string sendstr = "";

                        //            //录入电子票列表
                        //            B2bEticketData eticketdata = new B2bEticketData();
                        //            B2b_eticket eticket = new B2b_eticket()
                        //            {

                        //                Id = 0,
                        //                Com_id = comid,
                        //                Pro_id = modelcompro.Id,
                        //                Agent_id = 0,//直销
                        //                Pno = eticketcode,
                        //                E_type = (int)EticketCodeType.ShuZiMa,
                        //                Pnum = modelb2border.U_num,
                        //                Use_pnum = modelb2border.U_num,
                        //                E_proname = modelcompro.Pro_name,
                        //                E_face_price = modelcompro.Face_price,
                        //                E_sale_price = modelcompro.Advise_price,
                        //                E_cost_price = modelcompro.Agentsettle_price,
                        //                V_state = (int)EticketCodeStatus.NotValidate,
                        //                Send_state = (int)EticketCodeSendStatus.NotSend,
                        //                Subdate = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"))
                        //            };
                        //            int eticketid = eticketdata.InsertOrUpdate(eticket);
                        //            if (eticketid > 0)
                        //            {
                        //                //生成电子码短信,稍后可单独写类或写到数据库中
                        //                //diveticketcode.InnerText = "电子码生成成功:" + eticketcode;
                        //                sendstr = "感谢您订购" + modelcompro.Pro_name + modelb2border.U_num + "张" + ",电子码:" + eticketcode + " 有效期至:" + modelcompro.Pro_end.ToString("yyyy-MM-dd") + "二维码:http://" + RequestUrl + "/qr.ashx?p=" + eticketcode + "【微旅行】";

                        //                //电子票发送日志表,创建发送记录
                        //                B2bEticketSendLogData eticketsnedlog = new B2bEticketSendLogData();
                        //                B2b_eticket_send_log eticketlog = new B2b_eticket_send_log()
                        //                {
                        //                    Id = 0,
                        //                    Eticket_id = eticketid,
                        //                    Pnotext = sendstr,
                        //                    Phone = modelb2border.U_phone,
                        //                    Sendstate = 0,
                        //                    Sendtype = 1,
                        //                    Senddate = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"))
                        //                };
                        //                int insertsendEticketid = eticketsnedlog.InsertOrUpdate(eticketlog);


                        //                //发送电子码
                        //                string msg = "";
                        //                int sendstate = 0;//发送状态 1=成功,2=失败 0=未发送
                        //                int sendback = SendSmsHelper.SendSms(modelb2border.U_phone, sendstr, out msg);
                        //                if (sendback > 0)
                        //                {
                        //                    //labelmsg.InnerText = "发送成功" + sendback;
                        //                    sendstate = 1;
                        //                    //修改电子票发送日志表的发码状态为成功
                        //                    B2b_eticket_send_log eticketlogup = new B2b_eticket_send_log()
                        //                    {
                        //                        Id = insertsendEticketid,
                        //                        Sendstate = 1,
                        //                        Senddate = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"))
                        //                    };
                        //                    int upsendEticket = eticketsnedlog.InsertOrUpdate(eticketlogup);
                        //                    //-----------------新增2 begin-------------------------//
                        //                    modelb2border.Send_state = (int)SendCodeStatus.HasSend;
                        //                    modelb2border.Order_state = (int)OrderStatus.HasSendCode;
                        //                    modelb2border.Ticketcode = eticketid;
                        //                    //修改订单中发码状态为“已发码”,订单状态为"已发码",电子码id输入
                        //                    dataorder.InsertOrUpdate(modelb2border);
                        //                    //------------------新增2 end---------------------------//
                        //                }
                        //                else
                        //                {
                        //                    //labelmsg.InnerText = "发送错误" + msg;

                        //                    sendstate = 2;
                        //                }

                        //                //记录短信日志表
                        //                B2bSmsMobileSendDate smsmobilelog = new B2bSmsMobileSendDate();
                        //                B2b_smsmobilesend smslog = new B2b_smsmobilesend()
                        //                {
                        //                    Mobile = modelb2border.U_phone,
                        //                    Content = sendstr,
                        //                    Flag = sendstate,
                        //                    Text = msg,
                        //                    Delaysendtime = "",
                        //                    Realsendtime = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")),
                        //                    Smsid = sendback,
                        //                    Sendeticketid = insertsendEticketid
                        //                };
                        //                int insertsendmobileid = smsmobilelog.InsertOrUpdate(smslog);

                        //            }
                        //            else
                        //            {
                        //                //diveticketcode.InnerText = "电子码生成ERROR";

                        //            }

                        //        }



                        //    }

                        //}
                        #endregion


                        string retunstr = new PayReturnSendEticketData().PayReturnSendEticket(trade_no, order_no, total_fee, trade_status);

                        //对分销充值订单支付返回,对绑定订单进行处理确认
                        var handdata = OrderJsonData.agentorderpay_Hand(order_no);
                    }


                    //——请根据您的业务逻辑来编写程序(以上代码仅作参考)——

                    Response.Write("success");  //请不要修改或删除

                    #region 赠送保险
                    OrderJsonData.ZengsongBaoxian(order_no);
                    #endregion

                    /////////////////////////////////////////////////////////////////////////////////////////////////////////////
                }
                else//验证失败
                {
                    Response.Write("fail");
                }
            }
            else
            {
                Response.Write("无通知参数");
            }
        }