Esempio n. 1
0
        //确定
        protected void Button1_Click(object sender, EventArgs e)
        {
            if (t_caozuo.Text.Trim() == "")
            {
                Label1.Text = "请填写操作类型";
                return;
            }
            if (t_xml.Text.Trim() == "")
            {
                Label1.Text = "请填写发送内容";
                return;
            }

            string data     = HttpUtility.UrlEncode(Mjld_TCodeServiceCrypt.Encrypt3DESToBase64(t_xml.Text.Trim(), des_key));
            string postData = string.Format("businessid={1}&content={0}", HttpUtility.UrlEncode(data), businessid);

            string str = POST(interurl + t_caozuo.Text.Trim(), postData);

            try
            {
                string bstr = Mjld_TCodeServiceCrypt.Decrypt3DESFromBase64(str, des_key);

                Label1.Text = bstr;
            }
            catch
            {
                Label1.Text = str;
            }
        }
Esempio n. 2
0
        private string interurl = "http://outer.mjld.com.cn/Outer/Interface/";//正式接口url

        #region 2.5、	提交订单(SubmitOrder)
        public string SubmitOrder(ApiService mapiservice, Api_Mjld_SubmitOrder_input minput)
        {
            string xml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" +
                         "<Body>" +
                         "<timeStamp>" + minput.timeStamp + "</timeStamp>" +
                         "<user>" + minput.user + "</user>" +
                         "<password>" + minput.password + "</password>" +
                         "<goodsId>" + minput.goodsId + "</goodsId>" +
                         "<num>" + minput.num + "</num>" +       //<!—可以填多个,默认为1 -->
                         "<phone>" + minput.phone + "</phone>" +
                         "<batch>" + minput.batch + "</batch>" + //<!-值填1时一码一票,值填0或不填该字段是一码多票>
                         "<guest_name>" + minput.guest_name + "</guest_name>" +
                         "<identityno>" + minput.identityno + "</identityno>" +
                         "<order_note>" + minput.order_note + "</order_note>" +
                         "<forecasttime>" + minput.forecasttime + "</forecasttime>" + //【产品详情里IsReserve=True时,需传递该时间;IsReserve=False时,必须保留该值为空】
                         "<outOrderId>" + minput.orderId + "</outOrderId>" +
                         "<orderpost>" +                                              //快递信息
                         "<consignee>" + minput.consignee + "</consignee>" +
                         "<address>" + minput.address + "</address>" +
                         "<zipcode>" + minput.zipcode + "</zipcode>" +
                         "</orderpost>" +
                         "</Body>";

            string data     = HttpUtility.UrlEncode(Mjld_TCodeServiceCrypt.Encrypt3DESToBase64(xml, mapiservice.Deskey));
            string postData = string.Format("businessid={1}&content={0}", data, mapiservice.Organization);

            string str = POST(interurl + "SubmitOrder", postData);

            string bstr = "fail";

            try
            {
                bstr = Mjld_TCodeServiceCrypt.Decrypt3DESFromBase64(str, mapiservice.Deskey);
            }
            catch
            {
                bstr += " " + str;
            }

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

            return(bstr);
        }
Esempio n. 3
0
        public string RefundByOrderID(ApiService mapiservice, Api_mjld_RefundByOrderID mrefund)
        {
            string xml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" +
                         "<Body>" +
                         "<timeStamp>" + CommonFunc.ConvertDateTimeInt(DateTime.Now).ToString() + "</timeStamp>" +
                         "<user>" + mrefund.user + "</user>" +
                         "<password>" + mrefund.password + "</password>" +
                         "<RefundPart>" + mrefund.RefundPart + "</RefundPart>" +      //true:允许部分退票,false:不允许部分退票
                         "<outBackId>" + mrefund.orderid + "</outBackId>" +
                         "<orderid>" + mrefund.mjldorderId + "</orderid>" +
                         "</Body>";

            string data     = HttpUtility.UrlEncode(Mjld_TCodeServiceCrypt.Encrypt3DESToBase64(xml, mapiservice.Deskey));
            string postData = string.Format("businessid={1}&content={0}", data, mapiservice.Organization);

            string str = POST(interurl + "RefundByOrderID", postData);

            string bstr = "";

            try
            {
                bstr = Mjld_TCodeServiceCrypt.Decrypt3DESFromBase64(str, mapiservice.Deskey);
            }
            catch
            {
                bstr = "";
            }

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

            return(bstr);
        }
Esempio n. 4
0
        public string ReSendSms(ApiService mapiservice, Api_Mjld_SubmitOrder_output moutput)
        {
            string xml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" +
                         "<Body>" +
                         "<timeStamp>" + CommonFunc.ConvertDateTimeInt(DateTime.Now).ToString() + "</timeStamp>" +
                         "<user>" + mapiservice.Servicername + "</user>" +
                         "<password>" + mapiservice.Password + "</password>" +
                         "<orderId>" + moutput.mjldOrderId + "</orderId>" +
                         "<credenceno>" + moutput.credence + "</credenceno>" +
                         "</Body>";

            string data     = HttpUtility.UrlEncode(Mjld_TCodeServiceCrypt.Encrypt3DESToBase64(xml, mapiservice.Deskey));
            string postData = string.Format("businessid={1}&content={0}", data, mapiservice.Organization);

            string str = POST(interurl + "ReSendSms", postData);

            string bstr = "fail";

            try
            {
                bstr = Mjld_TCodeServiceCrypt.Decrypt3DESFromBase64(str, mapiservice.Deskey);
            }
            catch
            {
                bstr += " " + str;
            }

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

            return(bstr);
        }
Esempio n. 5
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;
            }
        }