コード例 #1
0
ファイル: FaHuoProc.cs プロジェクト: yi724926089/MyWx
        /// <summary>
        /// 发货
        /// </summary>
        /// <param name="paymentInfo"></param>
        /// <param name="orderEntity"></param>
        /// <returns></returns>
        public Dictionary<string, object> fahuomgr(Model.wx_payment_wxpay paymentInfo, Model.orders orderEntity)
        {
            BLL.wx_logs logBll = new BLL.wx_logs();
            string funName = "发货";
            logBll.AddLog(paymentInfo.wid.Value, "微支付", funName, "开始执行fahuomgr方法[otid:" + orderEntity.id + "]");

            WxPayHelper wxPayHelper = new WxPayHelper();
            wx_payment_wxpay payBll = new wx_payment_wxpay();

            //先设置基本信息
            string partnerId = paymentInfo.partnerId; //"1218574001";
            string appId = paymentInfo.appId;// "wxa9b8e33e48ac5e0f";
            string partnerKey = paymentInfo.partnerKey;// "huyuxianghuyuxianghuyuxiang12345";
            //paysignkey(非appkey)
            string appKey = paymentInfo.paySignKey;// "nwRmqgvSG08pe3vU5qzBLb7Bvih0WOABGzUPvqgFqE0iSkJlJ8wh7JlLYy2cXFgFA3v1bM8eTDm1y1UcyeW9IGq2py2qei7J5xDoVR9lfO3cS6fMjFbMQeeqBRit0bKp";

            wxPayHelper.SetAppId(appId);
            wxPayHelper.SetAppKey(appKey);
            wxPayHelper.SetPartnerKey(partnerKey);
            wxPayHelper.SetSignType("sha1");
            //设置请求package信息

            WeiXinCRMComm wxComm = new WeiXinCRMComm();
            string err="";
            string access_token = wxComm.getAccessToken(paymentInfo.wid.Value, out err);

            string param = wxPayHelper.CreateFaHuoPackage(orderEntity.openid, orderEntity.trade_no, orderEntity.order_no);

            string url = "https://api.weixin.qq.com/pay/delivernotify?access_token=" + access_token;
            string ret = Utils.HttpPost(url, param);
            logBll.AddLog(paymentInfo.wid.Value, "微支付", funName, "ret=" + ret);
            Dictionary<string, object> dict = JsonToDictionary(ret);
            logBll.AddLog(paymentInfo.wid.Value, "微支付", funName, "[otid:" + orderEntity.id + "]发货成功");
            //string errcode = dict["errcode"].ToString();
            //string errmsg = dict["errmsg"].ToString();

            //mxAuthFrame.BLL.wxOrderTmpBLL wot = new mxAuthFrame.BLL.wxOrderTmpBLL();
            //ordertmp.fahuoCode = errcode;
            //ordertmp.fahuoMsg = errmsg;
            //wot.Update(ordertmp);

            //Dictionary<string, string> ret_d = new Dictionary<string, string>();
            //ret_d.Add(errcode, errmsg);
            return dict;
        }
コード例 #2
0
ファイル: payResult.aspx.cs プロジェクト: yi724926089/MyWx
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {

                openid = MyCommFun.RequestOpenid();
                otid = MyCommFun.RequestInt("otid");
                int wid = MyCommFun.RequestWid();
                if (openid == "" || otid == 0 || wid == 0)
                {
                    return;
                }

                WeiXinCRMComm wxComm = new WeiXinCRMComm();
                string err = "";
                token = wxComm.getAccessToken(wid, out err);

                BLL.orders otBll = new BLL.orders();
                ordertmp = otBll.GetModel(otid, wid);

            }
        }