918博天堂

Server : Microsoft-IIS/10.0
System : Windows NT EBS-6136 10.0 build 17763 (Windows Server 2016) i586
User : jxgj ( 0)
PHP Version : 7.0.33
Disable Function : passthru,exec,system,shell_exec,proc_open,popen,pcntl_exec,socket_bind,stream_socket_server
Directory :  D:/tmp_aspnet/root/cae6aa2e/15328683/
Upload File :
Current Directory [ Writeable ] Root Directory [ Writeable ]


Current File : D:/tmp_aspnet/root/cae6aa2e/15328683/App_Code.vywp5zcy.58.cs
?#pragma checksum "D:\wwwroot\anlian2025\wwwroot\App_Code\wxshaoma\ResultNotify.cs" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "92666B92EC5E5371F5EC8CEE2625ACC0A6516438"

#line 1 "D:\wwwroot\anlian2025\wwwroot\App_Code\wxshaoma\ResultNotify.cs"
using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data.SqlClient;
using basic;
using System.IO;

namespace WxPayAPI
{
    /// <summary>
    /// 支付了局通知回调处置类
    /// 掌管接管微信支付后盾发送的支付了局并对订单有效性进行验证,将验证了局反馈给微信支付后盾
    /// </summary>
    public class ResultNotify : Notify
    {
        public ResultNotify(Page page)
            : base(page)
        {
        }


        public override void ProcessNotify()
        {

try{
            WxPayData notifyData = GetNotifyData();
            //查抄支付了局中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());
                page.Response.Write(res.ToXml());
                page.Response.End();
            }
            string transaction_id = notifyData.GetValue("transaction_id").ToString();
            string total_fee = notifyData.GetValue("total_fee").ToString();

            //查问订单,判断订单真实性
            if (!QueryOrder(transaction_id))
            {
                //若订单查问失败,则当即返回了局给微信支付后盾
                WxPayData res = new WxPayData();
                res.SetValue("return_code", "FAIL");
                res.SetValue("return_msg", "订单查问失败");
                Log.Error(this.GetType().ToString(), "Order query failure : " + res.ToXml());
                page.Response.Write(res.ToXml());
                page.Response.End();
            }
            //查问订单成功
            else
            {
                //起头处置订单支付了局
                BasicPage bp = new BasicPage();
                //商户订单号
                string out_trade_no = notifyData.GetValue("out_trade_no").ToString();


                //处置订单起头
                SqlDataReader myreader = bp.getRead("select * from tborder where Bianhao='" + out_trade_no + "'");
                if (myreader.Read())
                {
                    if (myreader["zhuangtai"].ToString() == "未付款")
                    {

                            float money = float.Parse(myreader["money"].ToString());


                            //支付成功
                            bp.doExecute("Update tborder set zhuangtai='已微信付款' where Bianhao='" + out_trade_no + "'");
                            
                            //bll.SendMessagePay(strdmobil, out_trade_no, total_fee);//向订货人手机发送支付成功提醒
                        }
                    

                }
                myreader.Close();


                //订单了局处置实现
                WxPayData res = new WxPayData();
                res.SetValue("return_code", "SUCCESS");
                res.SetValue("return_msg", "OK");
                Log.Info(this.GetType().ToString(), "order query success : " + res.ToXml());
                page.Response.Write(res.ToXml());
                page.Response.End();
            }
}
catch(Exception ex){ WriteLog(ex.Message.ToString()); }
        }

        /// <summary>
        /// 写入日志
        /// </summary>
        /// <param name="readme"></param>
        public void WriteLog(string readme)
        {
            
        }
        //查问订单
        private bool QueryOrder(string transaction_id)
        {
            WxPayData req = new WxPayData();
            req.SetValue("transaction_id", transaction_id);
            WxPayData res = WxPayApi.OrderQuery(req);
            if (res.GetValue("return_code").ToString() == "SUCCESS" &&
                res.GetValue("result_code").ToString() == "SUCCESS")
            {
                return true;
            }
            else
            {
                return false;
            }
        }
    }
}

#line default
#line hidden