Пример #1
0
        public ActionResult RedPacket()
        {
            //用户必须关注公众号之后才可访问
            WxAPI.AutoSync(Request.RawUrl);
            M_UserAPP uaMod = uaBll.SelModelByUid(mu.UserID, "wechat");

            ViewBag.state = uaMod == null ? "0" : "1";
            return(View());
        }
Пример #2
0
 protected void GetHeadImg(M_UserInfo mu)
 {
     if (mu == null || mu.IsNull || mu.UserID < 1)
     {
     }
     else
     {
         uappMod = uappBll.SelModelByUid(mu.UserID, "wechat");
         M_WX_User wuserMod = new M_WX_User();
         if (uappMod != null)
         {
             try
             {
                 wuserMod = wxapi.GetWxUserModel(uappMod.OpenID);
             }
             catch (Exception ex)
             {
                 wxapi.GetToken();
                 wuserMod = wxapi.GetWxUserModel(uappMod.OpenID);
                 throw ex;
             }
             if (wuserMod != null)
             {
                 Response.Write("{\"nickname\":\"" + wuserMod.Name + "\",\"headimgurl\":\"" + wuserMod.HeadImgUrl + "\"}");
             }
         }
     }
 }
Пример #3
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         B_User.CheckIsLogged(Request.RawUrl);
         M_UserInfo mu    = buser.GetLogin();
         int        appid = DataConverter.CLng(Request.QueryString["appid"]);
         string     err   = "";
         if (!B_User.CheckUserStatus(mu, ref err))
         {
             function.WriteErrMsg(err);
         }
         uappMod = uappBll.SelModelByUid(mu.UserID, "wechat");
         if (uappMod != null)
         {
             function.WriteErrMsg("您已经绑定了微信公众号,不能重复绑定!");
         }
         else
         {
             if (appid > 0)
             {
                 bind_img.Src = "/Common/Common.ashx?url=" + HttpUtility.UrlEncode("http://www.zhichongw.com/wxpromo.aspx?bindid=" + mu.UserID + "&appid=" + appid);
             }
             else
             {
                 bind_img.Src = "/Common/Common.ashx?url=" + SiteConfig.SiteInfo.SiteUrl + "/wxpromo.aspx?bindid=" + mu.UserID;
             }
         }
     }
 }
Пример #4
0
    //支付成功时执行的操作
    private void PayOrder_Success(WxPayData result)
    {
        ZLLog.L(ZLEnum.Log.pay, PayPlat + " 支付单:" + result.GetValue("out_trade_no") + " 金额:" + result.GetValue("total_fee"));
        try
        {
            M_Order_PayLog paylogMod = new M_Order_PayLog();
            M_Payment      pinfo     = payBll.SelModelByPayNo(result.GetValue("out_trade_no").ToString());
            if (pinfo == null)
            {
                throw new Exception("支付单不存在");
            }                                                    //支付单检测合为一个方法
            if (pinfo.Status != (int)M_Payment.PayStatus.NoPay)
            {
                throw new Exception("支付单状态不为未支付");
            }
            pinfo.Status       = (int)M_Payment.PayStatus.HasPayed;
            pinfo.PlatformInfo = PayPlat;
            pinfo.SuccessTime  = DateTime.Now;
            pinfo.PayTime      = DateTime.Now;
            pinfo.CStatus      = true;
            //1=100,
            double tradeAmt = Convert.ToDouble(result.GetValue("total_fee")) / 100;
            pinfo.MoneyTrue = tradeAmt;
            payBll.Update(pinfo);
            DataTable orderDT = orderBll.GetOrderbyOrderNo(pinfo.PaymentNum);
            foreach (DataRow dr in orderDT.Rows)
            {
                M_OrderList orderMod = orderBll.SelModelByOrderNo(dr["OrderNo"].ToString());
                OrderHelper.FinalStep(pinfo, orderMod, paylogMod);
                //if (orderMod.Ordertype == (int)M_OrderList.OrderEnum.Purse)
                //{

                //    M_UserInfo mu = buser.SelReturnModel(orderMod.Userid);
                //    new B_Shop_MoneyRegular().AddMoneyByMin(mu, orderMod.Ordersamount, ",订单号[" + orderMod.OrderNo + "]");
                //}
                orderCom.SendMessage(orderMod, paylogMod, "payed");
                //orderCom.SaveSnapShot(orderMod);
                //发送微信消息
                B_UserAPP  userappBll = new B_UserAPP();
                M_UserAPP  userappMod = new M_UserAPP();
                M_UserInfo mu         = buser.GetUserByUserID(orderMod.Userid);
                userappMod = userappBll.SelModelByUid(mu.UserID, "wechat");
                if (userappMod != null)
                {
                    WxAPI  wxapi = WxAPI.Code_Get(1);
                    string json  = "{\"first\":{\"value\":\"您已成功支付" + orderMod.Ordersamount.ToString("0.00") + "元\",\"color\":\"#000\"},\"DateTime\":{\"value\":\"" + DateTime.Now.ToString("yyyy年MM月dd日 HH:mm:ss") + "\",\"color\":\"#173177\"},\"PayAmount\":{\"value\":\"" + orderMod.Ordersamount.ToString("0.00") + "元\",\"color\":\"#173177\"},\"remark\":{\"value\":\"您的订单已成功付款!订单号:" + orderMod.OrderNo + "\",\"color\":\"#173177\"}}";
                    wxapi.Tlp_SendTlpMsg(userappMod.OpenID, "jAP4eGIOPvCdg33KBVDcClxRGYNNgcUpmHlVdO_FRV0", SiteConfig.SiteInfo.SiteUrl + "/User/Order/OrderProList?OrderNo=" + orderMod.OrderNo, json);
                }
            }
            ZLLog.L(ZLEnum.Log.pay, PayPlat + "成功!支付单:" + result.GetValue("out_trade_no").ToString());
        }
        catch (Exception ex)
        {
            ZLLog.L(ZLEnum.Log.pay, new M_Log()
            {
                Action  = "支付回调报错",
                Message = PayPlat + ",支付单:" + result.GetValue("out_trade_no").ToString() + ",原因:" + ex.Message
            });
        }
    }
Пример #5
0
    protected void Page_Init(object sender, EventArgs e)
    {
        M_UserInfo mu1 = buser.GetLogin();

        if (mu1 == null || mu1.IsNull || mu1.UserID < 1)
        {
            Response.Redirect("/wxpromo.aspx?appid=2&r=/User/Default2.aspx");
        }
        else if (mu1.Status != 0)
        {
            function.WriteErrMsg("你的帐户未通过验证或被锁定,请与网站管理员联系", "/wxpromo.aspx?appid=2&r=/User/Default2.aspx");
        }

        if (buser.CheckLogin())
        {
            uappMod = uappBll.SelModelByUid(mu1.UserID, "wechat");
            if (uappMod != null)
            {
                M_WX_User wxuserMod = wxuserBll.SelForOpenid(2, uappMod.OpenID);
                if (wxuserMod == null)
                {
                    WxAPI   wxapi  = WxAPI.Code_Get(2);
                    string  apiurl = "https://api.weixin.qq.com/cgi-bin/";
                    string  result = APIHelper.GetWebResult(apiurl + "user/info?access_token=" + wxapi.AccessToken + "&openid=" + uappMod.OpenID);
                    JObject obj    = JsonConvert.DeserializeObject <JObject>(result);
                    if (obj["errcode"].ToString() == "40003")
                    {
                        buser.ClearCookie();
                        Response.Redirect("/wxpromo.aspx?appid=2&r=/User/Default2.aspx");
                    }
                }
            }
        }
        else if (badmin.CheckLogin())
        {
            M_AdminInfo adminMod = badmin.GetAdminLogin();
            M_UserInfo  mu       = buser.GetUserByName(adminMod.AdminName, adminMod.AdminPassword);
            if (mu == null || mu.IsNull || mu.UserID < 1)
            {
                Response.Redirect("/User/Login.aspx");
            }
            else if (mu.Status != 0)
            {
                function.WriteErrMsg("你的帐户未通过验证或被锁定,请与网站管理员联系", "/wxpromo.aspx?appid=2&r=/User/Default2.aspx");
            }
            else
            {
                buser.SetLoginState(mu);
            }
        }
        else
        {
            B_User.CheckIsLogged(Request.RawUrl);
        }
    }
Пример #6
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            M_UserInfo mu    = buser.GetLogin();
            int        appid = DataConverter.CLng(Request.QueryString["appid"]);

            if (mu != null && mu.UserID > 0)
            {
                try
                {
                    TimeSpan ts = DateTime.UtcNow - new DateTime(1970, 1, 1, 0, 0, 0, 0);
                    timestr = Convert.ToInt64(ts.TotalSeconds).ToString();
                    if (appid == 0)
                    {
                        appid = 1;
                    }
                    WxAPI wxapi = WxAPI.Code_Get(appid);
                    appMod = appBll.SelReturnModel(appid);

                    uappMod  = uappBll.SelModelByUid(mu.UserID, "wechat");
                    wuserMod = wxapi.GetWxUserModel(uappMod.OpenID);

                    userface.Src  = wuserMod.HeadImgUrl;
                    userface.Alt  = wuserMod.Name;
                    NickName.Text = wuserMod.Name;

                    string  jsapi_ticket = APIHelper.GetWebResult("https://api.weixin.qq.com/cgi-bin/ticket/getticket?access_token=" + wxapi.AccessToken + "&type=jsapi");
                    JObject jsapi_obj    = (JObject)JsonConvert.DeserializeObject(jsapi_ticket);
                    string  stringA      = "jsapi_ticket=" + jsapi_obj["ticket"].ToString() + "&noncestr=" + nonceStr + "&timestamp=" + timestr + "&url=" + Request.Url.AbsoluteUri;
                    paySign = EncryptHelper.SHA1(stringA).ToLower();

                    string jsapi_ticket1 = APIHelper.GetWebResult("https://api.weixin.qq.com/cgi-bin/qrcode/create?access_token=" + wxapi.AccessToken + "&type=jsapi", "POST", "{\"action_name\":\"QR_LIMIT_STR_SCENE\",\"action_info\":{\"scene\":{\"scene_str\":\"" + mu.UserID + "\"}}}");
                    if (jsapi_ticket1 != "")
                    {
                        JObject jsapi_obj1 = (JObject)JsonConvert.DeserializeObject(jsapi_ticket1);
                        Image1.ImageUrl = "https://mp.weixin.qq.com/cgi-bin/showqrcode?ticket=" + jsapi_obj1["ticket"];
                    }
                }
                catch (Exception ex)
                {
                }
            }
            else
            {
                Response.Redirect("/wxpromo.aspx?r=/User");
            }
        }
    }
Пример #7
0
    protected void GetHeadImg(M_UserInfo mu)
    {
        int appid = 1;

        if (AppID > 0)
        {
            appid = AppID;
        }
        WxAPI wxapi = WxAPI.Code_Get(appid);

        if (mu == null || mu.IsNull || mu.UserID < 1)
        {
        }
        else
        {
            uappMod = uappBll.SelModelByUid(mu.UserID, "wechat");
            M_WX_User wuserMod = new M_WX_User();
            if (uappMod != null)
            {
                try
                {
                    wuserMod = wxapi.GetWxUserModel(uappMod.OpenID);
                    if (string.IsNullOrEmpty(wuserMod.Name))
                    {
                        wxapi.GetToken();
                        wuserMod = wxapi.GetWxUserModel(uappMod.OpenID);
                    }
                }
                catch (Exception ex)
                {
                    wxapi.GetToken();
                    wuserMod = wxapi.GetWxUserModel(uappMod.OpenID);
                    throw ex;
                }
                if (wuserMod != null)
                {
                    Response.Write("{\"nickname\":\"" + wuserMod.Name + "\",\"headimgurl\":\"" + wuserMod.HeadImgUrl + "\"}");
                }
            }
        }
    }
Пример #8
0
        //https://mp.weixin.qq.com/cgi-bin/showqrcode?ticket=TICKET
        //或可直接使用返回的URL字段
        #endregion
        /// <summary>
        /// 用户是否绑定微信并关注你的公众号
        /// </summary>
        /// <returns></returns>
        public bool IsFollow(int uid)
        {
            B_UserAPP appBll = new B_UserAPP();
            M_UserAPP appMod = appBll.SelModelByUid(uid, "wechat");

            if (appMod == null || string.IsNullOrEmpty(appMod.OpenID))
            {
                return(false);
            }
            string  result = APIHelper.GetWebResult(apiurl + "user/info?access_token=" + AccessToken + "&openid=" + appMod.OpenID);
            JObject jobj   = JsonConvert.DeserializeObject <JObject>(result);

            if (jobj["subscribe"] != null && jobj["subscribe"].ToString() == "1")
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Пример #9
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         M_Design_Album albumMod = albumBll.SelReturnModel(Mid);
         M_UserInfo     mu       = buser.GetSelect(albumMod.UserID);
         string         username = mu.UserName;
         appMod = appBll.SelModelByUid(mu.UserID, "wechat");
         if (appMod != null)
         {
             wxMod = wxBll.SelForOpenid(1, appMod.OpenID);
             if (wxMod != null)
             {
                 username = wxMod.Name;
             }
         }
         albumMod.AlbumName += "-来自[" + username + "]的动力逐浪微相册";
         string html = SafeSC.ReadFileStr("/design/album/tlps/" + albumMod.UseTlp + "/photo.html");
         html = html.Replace("\"{album}\"", JsonConvert.SerializeObject(albumMod));
         Response.Clear(); Response.Write(html); Response.End();
     }
 }
Пример #10
0
 protected void Page_Init(object sender, EventArgs e)
 {
     if (buser.CheckLogin())
     {
         M_UserInfo mu = buser.GetLogin();
         if (mu == null || mu.IsNull || mu.UserID < 1)
         {
             Response.Redirect("/wxpromo.aspx?r=" + Request.RawUrl);
             //Response.Redirect("/User/Login.aspx");
         }
         else if (mu.Status != 0)
         {
             function.WriteErrMsg("你的帐户未通过验证或被锁定,请与网站管理员联系", "/User/Login.aspx");
         }
         uappMod = uappBll.SelModelByUid(mu.UserID, "wechat");
         if (uappMod != null)
         {
             M_WX_User wxuserMod1 = wxuserBll.SelForOpenid(1, uappMod.OpenID);
             M_WX_User wxuserMod2 = wxuserBll.SelForOpenid(2, uappMod.OpenID);
             if (wxuserMod1 != null)
             {
                 footer_div1.Visible = true;
             }
             if (wxuserMod2 != null)
             {
                 footer_div2.Visible = true;
             }
             if (wxuserMod1 == null && wxuserMod2 == null)
             {
                 footer_div1.Visible = true;
             }
         }
     }
     else
     {
         B_User.CheckIsLogged(Request.RawUrl);
     }
 }
Пример #11
0
    //支付成功时执行的操作
    private void PayOrder_Success(WxPayData result)
    {
        ZLLog.L(ZLEnum.Log.pay, "微信:微信支付 支付单:" + result.GetValue("out_trade_no") + " 金额:" + result.GetValue("total_fee"));
        try
        {
            M_Order_PayLog paylogMod = new M_Order_PayLog();
            M_Payment      pinfo     = payBll.SelModelByPayNo(result.GetValue("out_trade_no").ToString());
            if (pinfo == null)
            {
                throw new Exception("支付单不存在");
            }                                                    //支付单检测合为一个方法
            if (pinfo.Status != (int)M_Payment.PayStatus.NoPay)
            {
                throw new Exception("支付单状态不为未支付");
            }
            pinfo.Status       = (int)M_Payment.PayStatus.HasPayed;
            pinfo.PlatformInfo = "微信扫码|公众号支付";
            pinfo.SuccessTime  = DateTime.Now;
            pinfo.PayTime      = DateTime.Now;
            pinfo.CStatus      = true;
            //1=100,
            double tradeAmt = Convert.ToDouble(result.GetValue("total_fee")) / 100;
            pinfo.MoneyTrue = tradeAmt;
            payBll.Update(pinfo);
            DataTable orderDT = orderBll.GetOrderbyOrderNo(pinfo.PaymentNum);
            foreach (DataRow dr in orderDT.Rows)
            {
                M_OrderList orderMod = orderBll.SelModelByOrderNo(dr["OrderNo"].ToString());
                OrderHelper.FinalStep(pinfo, orderMod, paylogMod);
                if (orderMod.Ordertype == (int)M_OrderList.OrderEnum.Purse)
                {
                    M_UserInfo mu = buser.SelReturnModel(orderMod.Userid);
                    new B_Shop_MoneyRegular().AddMoneyByMin(mu, orderMod.Ordersamount, ",订单号[" + orderMod.OrderNo + "]");
                }
                orderCom.SendMessage(orderMod, paylogMod, "payed");
                //orderCom.SaveSnapShot(orderMod);

                if (orderMod.Ordertype != 6)
                {
                    buser.ChangeVirtualMoney(orderMod.Userid, new M_UserExpHis()
                    {
                        score     = orderMod.Ordersamount,
                        ScoreType = 3,
                        detail    = "在线消费赠送积分:" + orderMod.Ordersamount
                    });
                }
                //订单返利
                OrderRebates(orderMod.Userid, orderMod.Ordersamount);
                //订单打印
                int orderID  = DataConvert.CLng(dr["ID"].ToString());
                int StoreID  = DataConvert.CLng(dr["StoreID"].ToString());
                int devID    = GetPrintDevice(StoreID);  //设备ID
                int tlpID    = GetPrintModelID(StoreID); //模板ID
                int printnum = GetPrintNum(StoreID);
                //------------------------------
                DataTable          orderDT1 = DBCenter.Sel("ZL_OrderInfo", "ID=" + orderID);
                M_Shop_PrintTlp    tlpMod   = tlpBll.SelReturnModel(tlpID);
                M_Shop_PrintDevice devMod   = devBll.SelReturnModel(devID);
                string             msg      = orderCOM.TlpDeal(tlpMod.Content, orderDT1);
                ZLLog.L(ZLEnum.Log.pay, msg);
                msgBll.Insert(msg, tlpMod.ID, devMod, printnum);
                //function.WriteSuccessMsg("信息已发送", "MessageList.aspx");

                //发送微信通知
                try
                {
                    userappMod = userappBll.SelModelByUid(DataConvert.CLng(dr["UserID"]), "wechat");
                    if (userappMod != null)
                    {
                        WxAPI wxapi = WxAPI.Code_Get(1);
                        if (dr["Ordertype"].ToString() == "6")
                        {
                            M_UserInfo userMod = buser.GetUserByUserID(DataConvert.CLng(dr["UserID"]));
                            wxapi.Tlp_SendTlpMsg(userappMod.OpenID, "vRUiDj-k6EGjwQC2GO4oU1G37CJjiu2fZ-ePBj1jJ60", "http://v.wodian8.com/User/Order/OrderList1.aspx", "{\"first\": {\"value\":\"您好,您已经充值成功。\",\"color\":\"#173177\"},\"keyword1\":{\"value\":\"" + DataConvert.CDouble(dr["Ordersamount"]).ToString("0.00") + "\",\"color\":\"#173177\"},\"keyword2\": {\"value\":\"" + DateTime.Now.ToString("yyyy年MM月dd日 HH:mm:ss") + "\",\"color\":\"#173177\"},\"keyword3\": {\"value\":\"" + userMod.Purse.ToString("0.00") + "\",\"color\":\"#173177\"},\"remark\":{\"value\":\"感谢您对我们的信任,我们将为您提供更优质的服务。\",\"color\":\"#173177\"}}");
                        }
                        else
                        {
                            wxapi.Tlp_SendTlpMsg(userappMod.OpenID, "E-yWv8GVKeJHymtTB0zOGKnEv6LXodjr-M6tj1sLzfM", "http://v.wodian8.com/User/Order/OrderList1.aspx", "{\"first\": {\"value\":\"您的订单支付成功!\",\"color\":\"#173177\"},\"keyword1\":{\"value\":\"" + dr["OrderNo"].ToString() + "\",\"color\":\"#173177\"},\"keyword2\": {\"value\":\"" + GetProname(DataConvert.CLng(dr["ID"])) + "\",\"color\":\"#173177\"},\"keyword3\": {\"value\":\"" + DataConvert.CDouble(dr["Ordersamount"]).ToString("0.00") + "\",\"color\":\"#173177\"},\"keyword4\": {\"value\":\"" + DateTime.Now.ToString("yyyy年MM月dd日 HH:mm:ss") + "\",\"color\":\"#173177\"},\"remark\":{\"value\":\"点击查看订单详情!\",\"color\":\"#173177\"}}");
                        }
                    }
                }
                catch (Exception ex)
                {
                    ZLLog.L(ZLEnum.Log.pay, new M_Log()
                    {
                        Action  = "发送微信通知报错",
                        Message = "原因:" + ex.Message
                    });
                    throw;
                }
            }
            ZLLog.L(ZLEnum.Log.pay, "微信支付成功!支付单:" + result.GetValue("out_trade_no").ToString());
        }
        catch (Exception ex)
        {
            ZLLog.L(ZLEnum.Log.pay, new M_Log()
            {
                Action  = "支付回调报错",
                Message = "平台:微信,支付单:" + result.GetValue("out_trade_no").ToString() + ",原因:" + ex.Message
            });
        }
    }
Пример #12
0
    //提交订单
    protected void AddOrder_Btn_Click(object sender, EventArgs e)
    {
        if (Address_Div.Visible && DataConvert.CLng(Request.Form["address_rad"]) < 1)
        {
            function.WriteErrMsg("尚未选定收货地址");
        }
        //1,生成订单,2,关联购物车中商品为已绑定订单
        M_UserInfo  mu      = buser.GetLogin(false);
        M_UserRecei receMod = receBll.GetSelect(Convert.ToInt32(Request.Form["address_rad"]), mu.UserID);
        DataTable   cartDT  = cartBll.SelByCookID(CartCookID, ProClass, ids);//需要购买的商品

        if (cartDT.Rows.Count < 1)
        {
            function.WriteErrMsg("你尚未选择商品,<a href='/User/Order/OrderList.aspx'>查看我的订单</a>");
        }
        //------生成订单前检测区
        foreach (DataRow dr in cartDT.Rows)
        {
            if (!HasStock(dr["Allowed"], DataConvert.CLng(dr["stock"]), Convert.ToInt32(dr["Pronum"])))
            {
                function.WriteErrMsg("购买失败," + dr["proname"] + "的库存数量不足");
            }
        }
        //------检测End
        //按店铺生成订单,统一存ZL_Orderinfo
        DataTable storeDT = cartDT.DefaultView.ToTable(true, "StoreID");
        M_Payment payMod  = new M_Payment();

        payMod.PayNo = payBll.CreatePayNo();
        List <M_OrderList> orderList = new List <M_OrderList>();//用于生成临时订单,统计计算(Disuse)

        foreach (DataRow dr in storeDT.Rows)
        {
            #region 暂不使用字段
            //Odata.province = this.DropDownList1.SelectedValue;
            //Odata.city = this.DropDownList2.SelectedValue;//将地址省份与市ID存入,XML数据源
            //Odata.Guojia = "";//国家
            //Odata.Chengshi = DropDownList2.SelectedItem.Text;//城市
            //Odata.Diqu = DropDownList3.SelectedItem.Text;//地区
            //Odata.Delivery = DataConverter.CLng(Request.Form["Delivery"]);
            //Odata.Deliverytime = DataConverter.CLng(this.Deliverytime.Text);
            //Odata.Mobile = receMod.MobileNum;
            #endregion
            M_OrderList Odata = new M_OrderList();
            Odata.Ordertype = OrderHelper.GetOrderType(ProClass);
            Odata.OrderNo   = B_OrderList.CreateOrderNo((M_OrderList.OrderEnum)Odata.Ordertype);
            Odata.StoreID   = Convert.ToInt32(dr["StoreID"]);
            cartDT.DefaultView.RowFilter = "StoreID=" + Odata.StoreID;
            DataTable storeCartDT = cartDT.DefaultView.ToTable();
            switch (ProClass)//旅游机票等,以联系人信息为地址
            {
            case 7:
            case 8:
                M_Cart_Travel   model = JsonConvert.DeserializeObject <M_Cart_Travel>(storeCartDT.Rows[0]["Additional"].ToString());
                M_Cart_Contract user  = model.Contract[0];
                Odata.Receiver  = user.Name;
                Odata.Reuser    = user.Name;
                Odata.Phone     = user.Mobile;
                Odata.MobileNum = user.Mobile;
                Odata.Email     = user.Email;
                break;

            default:    //普通订单
                Odata.Receiver  = receMod.ReceivName;
                Odata.Reuser    = receMod.ReceivName;
                Odata.Phone     = receMod.phone;
                Odata.MobileNum = receMod.MobileNum;
                Odata.Email     = receMod.Email;
                Odata.Shengfen  = receMod.Provinces;
                Odata.Jiedao    = receMod.Street;
                Odata.ZipCode   = receMod.Zipcode;
                break;
            }
            Odata.Invoiceneeds    = DataConverter.CLng(Request.Form["invoice_rad"]);//是否需开发票
            Odata.Invoice         = Odata.Invoiceneeds == 0 ? "" : InvoTitle_T.Text + "||" + Invoice_T.Text;
            Odata.Rename          = mu.UserName;
            Odata.Outstock        = 0;              //缺货处理
            Odata.Ordermessage    = ORemind_T.Text; //订货留言
            Odata.Merchandiser    = "";             //跟单员
            Odata.Internalrecords = "";             //内部记录
            Odata.IsCount         = false;
            //-----金额计算
            Odata.Balance_price     = GetTotalMoney(storeCartDT);
            Odata.Freight           = GetFarePrice(storeCartDT, Odata.StoreID); //运费计算
            Odata.Ordersamount      = Odata.Balance_price + Odata.Freight;      //订单金额
            Odata.AllMoney_Json     = orderCom.GetTotalJson(storeCartDT);       //附加需要的虚拟币
            Odata.Specifiedprice    = Odata.Ordersamount;                       //订单金额;
            Odata.Receivablesamount = 0;                                        //收款金额
            Odata.Developedvotes    = 0;
            Odata.OrderStatus       = (int)M_OrderList.StatusEnum.Normal;       //订单状态
            Odata.Paymentstatus     = (int)M_OrderList.PayEnum.NoPay;           //付款状态
            Odata.StateLogistics    = 0;                                        //物流状态
            Odata.Signed            = 0;                                        //签收
            Odata.Settle            = 0;                                        //结清
            Odata.Aside             = 0;                                        //作废
            Odata.Suspended         = 0;                                        //暂停
            Odata.AddTime           = DateTime.Now;
            Odata.AddUser           = mu.UserName;;
            Odata.Userid            = mu.UserID;
            Odata.Integral          = DataConverter.CLng(Request.QueryString["jifen"]);
            Odata.Freight_remark    = " ";
            Odata.Balance_remark    = "";
            Odata.Promoter          = 0;
            Odata.id = orderBll.Adds(Odata);
            cartProBll.CopyToCartPro(mu, storeCartDT, Odata.id);
            orderList.Add(Odata);
            orderCom.SendMessage(Odata, null, "ordered");
            userappMod = userappBll.SelModelByUid(buser.GetLogin().UserID, "wechat");
            if (userappMod != null)
            {
                //function.WriteErrMsg(Odata.AddTime.ToString("yyyy年MM月dd日 HH:mm:ss"));
                WxAPI  wxapi = WxAPI.Code_Get(1);
                string json  = "{ \"touser\":\"" + userappMod.OpenID + "\",\"template_id\":\"6kw4rUCX3IpE7k8_kn3ocmaaQBZF4blWq25ualnz1qw\",\"url\":\"http://www.wodian8.com/User/Order/OrderList1.aspx\",\"data\":{\"first\": {\"value\":\"订单提交成功!\",\"color\":\"#173177\"},\"keyword1\":{\"value\":\"" + Odata.AddTime.ToString("yyyy年MM月dd日 HH:mm:ss") + "\",\"color\":\"#173177\"},\"keyword2\": {\"value\":\"" + Odata.Ordersamount.ToString("0.00") + "元\",\"color\":\"#173177\"},\"keyword3\": {\"value\":\"" + GetProname(Odata.id) + "\",\"color\":\"#173177\"},\"keyword4\": {\"value\":\"" + Odata.Shengfen + Odata.Jiedao + "\",\"color\":\"#173177\"},\"remark\":{\"value\":\"您好,订单提交成功,请尽快付款!\",\"color\":\"#173177\"}}}";
                wxapi.SendTlpMsg(json);
                //wxapi.SendMsg(userappMod.OpenID, "你已下订单,订单号为:" + Odata.OrderNo);
            }
        }
        cartBll.DelByids(ids);
        //-----------------订单生成后处理
        //进行减库存等操作
        foreach (DataRow dr in cartDT.Rows)
        {
            M_Product model = proBll.GetproductByid(Convert.ToInt32(dr["Proid"]));
            model.Stock = model.Stock - DataConvert.CLng(dr["Pronum"]);
            SqlHelper.ExecuteSql("Update ZL_Commodities Set Stock=" + model.Stock + " Where ID=" + model.ID);
        }
        //生成支付单,处理优惠券,并进入付款步骤
        foreach (M_OrderList model in orderList)
        {
            payMod.PaymentNum += model.OrderNo + ",";
            payMod.MoneyPay   += model.Ordersamount;
        }
        //优惠券
        if (!string.IsNullOrEmpty(Arrive_T.Text))
        {
            double arriveAmount = arriveBll.UserArrive(Arrive_T.Text, Arrive_Pwd.Text);
            payMod.MoneyPay     = payMod.MoneyPay - arriveAmount;
            payMod.ArriveMoney  = arriveAmount;
            payMod.ArriveDetail = Arrive_T.Text + "|" + Arrive_Pwd.Text;
        }
        //积分处理
        if (point_body.Visible && DataConvert.CLng(Point_T.Text) > 0)
        {
            int point    = DataConvert.CLng(Point_T.Text);
            int maxPoint = (int)((SiteConfig.ShopConfig.PointRatiot * 0.01) * (double)payMod.MoneyPay / SiteConfig.ShopConfig.PointRate);
            //if (point <= 0) { function.WriteErrMsg("积分数值不正确"); }
            if (point > mu.UserExp)
            {
                function.WriteErrMsg("您的积分不足!");
            }
            if (point > maxPoint)
            {
                function.WriteErrMsg("积分不能大于可兑换金额!");
            }
            //生成支付单时扣除用户积分
            buser.ChangeVirtualMoney(mu.UserID, new M_UserExpHis()
            {
                ScoreType = (int)M_UserExpHis.SType.Point, score = -point, detail = "积分抵扣,支付单号:" + payMod.PayNo
            });
            payMod.MoneyPay = payMod.MoneyPay - (point * SiteConfig.ShopConfig.PointRate);
            payMod.UsePoint = point;
        }
        if (payMod.MoneyPay <= 0)
        {
            payMod.MoneyPay = 0.01;
        }
        payMod.PaymentNum = payMod.PaymentNum.TrimEnd(',');
        payMod.Remark     = cartDT.Rows.Count > 1 ? "[" + cartDT.Rows[0]["ProName"] as string + "]等" : cartDT.Rows[0]["ProName"] as string;
        payMod.UserID     = mu.UserID;
        payMod.Status     = 1;
        payMod.PaymentID  = payBll.Add(payMod);

        string redirect_uri = HttpUtility.UrlEncode("http://www.wodian8.com/Payonline/wxpayonline.aspx?PayNo=" + payMod.PayNo);
        string url          = "https://open.weixin.qq.com/connect/oauth2/authorize?appid=wx8c5c2dc7b10a36f3&redirect_uri=" + redirect_uri + "&response_type=code&scope=snsapi_userinfo&state=STATE#wechat_redirect";
        //Response.Redirect(url);
        Response.Redirect("/PayOnline/Orderpay.aspx?PayNo=" + payMod.PayNo);
    }
Пример #13
0
    public void MyBind()
    {
        DataTable  dt = new DataTable();
        M_UserInfo mu = buser.GetLogin();

        switch (SType)
        {
        case 0:    //订单
            orderMod = orderBll.SelModelByOrderNo(OrderNo);

            //Total_L.Text = orderMod.Balance_price.ToString("f2") + "+" + orderMod.Freight.ToString("f2") + "=" + orderMod.Ordersamount.ToString("f2") + "元 (金额+运费)";

            labelmoney01.Text      = orderMod.Receivablesamount.ToString("f2");
            ExpressNum_T.Text      = orderMod.ExpressNum;
            ExpressDelivery_T.Text = orderMod.ExpressDelivery;
            if (orderMod == null || orderMod.id == 0)
            {
                function.WriteErrMsg("订单不存在");
            }
            if (orderMod.Userid != mu.UserID)
            {
                function.WriteErrMsg("该订单不属于你,无法查看");
            }
            dt        = SelByOrderID(orderMod.id);
            price     = orderMod.Balance_price;
            fare      = orderMod.Freight;
            allamount = orderMod.Ordersamount;
            DataTable dt1 = SqlHelper.ExecuteTable("select * from ZL_Payment where PaymentNum='" + orderMod.OrderNo + "' order by PayTime DESC");
            if (dt1.Rows.Count > 0)
            {
                payMod    = payBll.SelModelByPayNo(dt1.Rows[0]["PayNo"].ToString());
                allamount = (double)payMod.MoneyPay;
                arrive    = payMod.ArriveMoney;
                point     = payMod.UsePoint;
            }
            Total_L.Text = price.ToString("f2") + " + " + fare.ToString("f2") + " - " + arrive.ToString("f2") + "-" + (point * 0.01).ToString("f2") + "(" + point + ")" + " = " + allamount.ToString("f2");
            Total_L.Text = Total_L.Text + " (商品总价+运费-优惠券-积分兑换=总额)";
            break;

        case 1:    //购物车
            dt = cartBll.GetCarProList(OrderNo);
            break;
        }
        if (orderMod.Paymentstatus != (int)M_OrderList.PayEnum.HasPayed)
        {
            PayUrl_A.Visible = true;
            DataTable dt1    = SqlHelper.ExecuteTable("select * from ZL_Payment where PaymentNum='" + orderMod.OrderNo + "' order by PayTime DESC");
            string    payurl = "&OrderCode=" + orderMod.OrderNo;
            if (dt1.Rows.Count > 0)
            {
                payurl = "&PayNo=" + dt1.Rows[0]["PayNo"];
            }
            uappMod = uappBll.SelModelByUid(buser.GetLogin().UserID, "wechat");
            if (uappMod != null)
            {
                M_WX_User wxuserMod1 = wxuserBll.SelForOpenid(1, uappMod.OpenID);
                M_WX_User wxuserMod2 = wxuserBll.SelForOpenid(2, uappMod.OpenID);
                if (wxuserMod1 != null && wxuserMod2 == null)
                {
                    PayUrl_A.HRef = "/PayOnline/OrderPay.aspx?appid=1" + payurl;
                }
                else if (wxuserMod2 != null && wxuserMod1 == null)
                {
                    PayUrl_A.HRef = "/PayOnline/OrderPay.aspx?appid=2" + payurl;
                }
                else if (wxuserMod1 == null && wxuserMod2 == null)
                {
                    PayUrl_A.HRef = "/PayOnline/OrderPay.aspx?" + payurl;
                }
            }
            else
            {
                PayUrl_A.HRef = "/PayOnline/OrderPay.aspx?" + payurl;
            }
        }
        if (dt.Rows.Count > 0 && !string.IsNullOrEmpty(dt.Rows[0]["Additional"].ToString()))
        {
            User_Div.Visible = true;
            M_Cart_Travel          model     = JsonConvert.DeserializeObject <M_Cart_Travel>(dt.Rows[0]["Additional"].ToString());
            List <M_Cart_Contract> modelList = new List <M_Cart_Contract>();
            modelList.AddRange(model.Guest);
            modelList.AddRange(model.Contract);
            UserRPT.DataSource = modelList;
            UserRPT.DataBind();
        }
        pronum         = dt.Rows.Count;
        RPT.DataSource = dt;
        RPT.DataBind();
    }
Пример #14
0
    //进入该页即开始推广,自动创建用户,关联APPID
    protected void Page_Load(object sender, EventArgs e)
    {
        int       AppID  = DataConverter.CLng(Request.QueryString["appid"]);
        B_User    buser  = new B_User();
        B_UserAPP appBll = new B_UserAPP();
        int       bindid = DataConverter.CLng(Session["WX_BindID"]);
        int       puid   = DataConverter.CLng(Session["WX_PUserID"]);
        string    rurl   = DataConvert.CStr(Session["WX_R"]);

        //if (puid < 1) { function.WriteErrMsg("推荐用户不存在"); }
        M_WX_APPID appMod = new M_WX_APPID();//自行置入缓存,使用时取出

        appMod = WxPayApi.Pay_GetByID(AppID);

        if (string.IsNullOrEmpty(rurl))
        {
            string url = HttpUtility.UrlEncode(SiteConfig.SiteInfo.SiteUrl + "/User/");
            rurl = "https://open.weixin.qq.com/connect/oauth2/authorize?appid=" + appMod.APPID + "&redirect_uri=" + url + "&response_type=code&scope=snsapi_userinfo&state=STATE#wechat_redirect";
        }

        string     code         = Request["code"];
        string     access_token = APIHelper.GetWebResult("https://api.weixin.qq.com/sns/oauth2/access_token?appid=" + appMod.APPID + "&secret=" + appMod.Secret + "&code=" + code + "&grant_type=authorization_code");
        JObject    obj          = (JObject)JsonConvert.DeserializeObject(access_token);
        JObject    userobj      = (JObject)JsonConvert.DeserializeObject(APIHelper.GetWebResult("https://api.weixin.qq.com/sns/userinfo?access_token=" + obj["access_token"] + "&openid=" + obj["openid"] + "&lang=zh_CN"));
        string     openID       = obj["openid"].ToString();
        M_UserAPP  umod         = appBll.SelModelByOpenID(openID, "wechat");
        M_UserInfo mu           = new M_UserInfo();

        if (umod != null)
        {
            if (bindid > 0)
            {
                function.WriteErrMsg("您的公众号已绑定了用户[" + umod.UserID + "]!", "/User/");
            }
            mu = buser.SelReturnModel(umod.UserID);
            try
            {
                string vpath = SiteConfig.SiteOption.UploadDir + "User/" + mu.UserName + "/wxheadimg.jpg";
                HttpHelper.DownFile(userobj["headimgurl"].ToString(), vpath);
                mu.UserFace = vpath;
                buser.UpdateByID(mu);
            }
            catch (Exception ex)
            {
                function.WriteErrMsg(ex.Message);
            }
            buser.SetLoginState(mu);
            Response.Redirect(rurl);
        }
        else //新用户则注册
        {
            if (bindid > 0)
            {
                M_UserInfo bindMod = buser.GetUserByUserID(bindid);
                if (bindMod != null && bindMod.UserID > 0)
                {
                    umod = appBll.SelModelByUid(bindMod.UserID, "wechat");
                    if (umod != null)
                    {
                        function.WriteErrMsg("该用户已经绑定了微信号,不能重复绑定!");
                    }
                    else
                    {
                        umod            = new M_UserAPP();
                        umod.UserID     = bindMod.UserID;
                        umod.SourcePlat = "wechat";
                        umod.OpenID     = openID;
                        appBll.Insert(umod);
                        try
                        {
                            string vpath = SiteConfig.SiteOption.UploadDir + "User/" + bindMod.UserName + "/wxheadimg.jpg";
                            HttpHelper.DownFile(userobj["headimgurl"].ToString(), vpath);
                            bindMod.UserFace = vpath;
                        }
                        catch (Exception ex)
                        {
                        }
                        bindMod.TrueName = userobj["nickname"].ToString();
                        buser.UpdateByID(bindMod);
                        buser.SetLoginState(bindMod);
                        function.WriteSuccessMsg("绑定成功,即将进入会员中心!", "/User/");
                    }
                }
            }
            else
            {
                umod            = new M_UserAPP();
                mu.UserName     = "******" + DateTime.Now.ToString("yyyyMMddHHmmss") + function.GetRandomString(2).ToLower();
                mu.UserPwd      = StringHelper.MD5(function.GetRandomString(6));
                mu.Email        = function.GetRandomString(10) + "@wx.com";
                mu.Question     = function.GetRandomString(5);
                mu.Answer       = function.GetRandomString(5);
                mu.ParentUserID = puid.ToString();
                mu.TrueName     = userobj["nickname"].ToString();
                try
                {
                    string vpath = SiteConfig.SiteOption.UploadDir + "User/" + mu.UserName + "/wxheadimg.jpg";
                    HttpHelper.DownFile(userobj["headimgurl"].ToString(), vpath);
                    mu.UserFace = vpath;
                }
                catch (Exception ex)
                {
                }
                mu.GroupID = 1;
                mu.UserID  = buser.Add(mu);

                umod.UserID     = mu.UserID;
                umod.SourcePlat = "wechat";
                umod.OpenID     = openID;
                appBll.Insert(umod);
                M_Uinfo mubase = new M_Uinfo();
                mubase.UserId = mu.UserID;
                buser.AddBase(mubase);
                //推广人得积分
                if (puid > 0)
                {
                    M_UserInfo pmu = buser.SelReturnModel(puid);
                    if (!pmu.IsNull)
                    {
                        buser.ChangeVirtualMoney(pmu.UserID, new M_UserExpHis()
                        {
                            score     = 20,
                            ScoreType = (int)M_UserExpHis.SType.Point,
                            detail    = "新用户[" + mu.UserName + "]注册,获得推广积分:" + 20
                        });
                    }
                }
                buser.SetLoginState(mu);
                Response.Redirect(rurl);
            }
        }
    }
Пример #15
0
        protected void RPT_ItemCommand(object source, RepeaterCommandEventArgs e)
        {
            WxAPI       wxapi    = WxAPI.Code_Get();
            int         oid      = DataConvert.CLng(e.CommandArgument);
            M_OrderList orderMod = orderBll.SelReturnModel(oid);
            M_UserAPP   appMod   = appBll.SelModelByUid(orderMod.Userid, "wechat");
            M_UserAPP   appMod2  = appBll.SelModelByUid(storeMod.UserID, "wechat");
            string      tlpid    = "dlAIEAkV0lgDfc7-RYsdLVFMyP9UF7gHi_9kjPblVAU";

            switch (e.CommandName)
            {
            case "return":    //确认归还
            {
                Unbrealla.FinalOrder(orderMod);
                if (appMod != null && !string.IsNullOrEmpty(appMod.OpenID))
                {
                    string json = "{\"first\": {\"value\":\"还伞成功通知\",\"color\":\"#173177\"},\"keyword1\":{\"value\":\"" + orderMod.OrderNo + "\",\"color\":\"#173177\"},\"keyword2\":{\"value\":\"" + orderMod.AddTime.ToString("yyyy年MM月dd日 HH:mm:ss") + "\",\"color\":\"#173177\"},\"keyword3\": {\"value\":\"" + orderMod.Ordersamount.ToString("0.00") + "元\",\"color\":\"#173177\"},\"remark\":{\"value\":\"您已还伞成功,如需继续借伞,请扫描借伞点二维码进行借伞!\",\"color\":\"#173177\"}}";
                    string r    = wxapi.Tlp_SendTlpMsg(appMod.OpenID, tlpid, ZoomLa.Components.SiteConfig.SiteInfo.SiteUrl + "/BU/UE/MyLend.aspx", json);
                }
                if (appMod2 != null && !string.IsNullOrEmpty(appMod2.OpenID))
                {
                    string json1 = "{\"first\": {\"value\":\"还伞成功通知\",\"color\":\"#173177\"},\"keyword1\":{\"value\":\"" + orderMod.OrderNo + "\",\"color\":\"#173177\"},\"keyword2\":{\"value\":\"" + orderMod.AddTime.ToString("yyyy年MM月dd日 HH:mm:ss") + "\",\"color\":\"#173177\"},\"keyword3\": {\"value\":\"" + orderMod.Ordersamount.ToString("0.00") + "元\",\"color\":\"#173177\"},\"remark\":{\"value\":\"用户已还伞成功!\",\"color\":\"#173177\"}}";
                    wxapi.Tlp_SendTlpMsg(appMod2.OpenID, tlpid, ZoomLa.Components.SiteConfig.SiteInfo.SiteUrl + "/Class_2/NodePage.aspx", json1);
                }

                //更新库存
                string    sql = "select * from ZL_Commodities where UserShopID=" + orderMod.StoreID;
                DataTable dt  = SqlHelper.ExecuteTable(CommandType.Text, sql);
                if (dt.Rows.Count > 0)
                {
                    M_Product proMod = proBll.GetproductByid(DataConvert.CLng(dt.Rows[0]["ID"]));
                    proMod.Stock = proMod.Stock + 1;
                    proBll.UpdateByID(proMod);
                }
            }
            break;

            case "cancel":    //取消归还
            {
                DBCenter.UpdateSQL(orderMod.TbName, "OrderStatus=0", "ID=" + oid + " AND OrderStatus=-1");
            }
            break;

            case "repair":    //坏伞回收
            {
                Unbrealla.FinalOrder(orderMod);
                string json = "{\"first\": {\"value\":\"还伞成功通知\",\"color\":\"#173177\"},\"keyword1\":{\"value\":\"" + orderMod.OrderNo + "\",\"color\":\"#173177\"},\"keyword2\":{\"value\":\"" + orderMod.AddTime.ToString("yyyy年MM月dd日 HH:mm:ss") + "\",\"color\":\"#173177\"},\"keyword3\": {\"value\":\"" + orderMod.Ordersamount.ToString("0.00") + "元\",\"color\":\"#173177\"},\"remark\":{\"value\":\"您已还伞成功,如需继续借伞,请扫描借伞点二维码进行借伞!\",\"color\":\"#173177\"}}";
                Unbrealla.SendWXNotify(appMod, tlpid, "/BU/UE/MyLend.aspx", json);
                json = "{\"first\": {\"value\":\"还伞成功通知\",\"color\":\"#173177\"},\"keyword1\":{\"value\":\"" + orderMod.OrderNo + "\",\"color\":\"#173177\"},\"keyword2\":{\"value\":\"" + orderMod.AddTime.ToString("yyyy年MM月dd日 HH:mm:ss") + "\",\"color\":\"#173177\"},\"keyword3\": {\"value\":\"" + orderMod.Ordersamount.ToString("0.00") + "元\",\"color\":\"#173177\"},\"remark\":{\"value\":\"用户已还伞成功,请等待公司工作人员收取坏伞!\",\"color\":\"#173177\"}}";
                Unbrealla.SendWXNotify(appMod2, tlpid, "/Class_2/NodePage.aspx", json);
            }
            break;

            case "cancel_repair":    //取消报修申请,返还余额
            {
                double money = orderMod.Specifiedprice;
                orderMod.IsCount         = false;
                orderMod.Internalrecords = "";
                orderMod.Specifiedprice  = 0;
                orderMod.OrderStatus     = 0;
                orderBll.UpdateByID(orderMod);
                buser.AddMoney(orderMod.Userid, money, M_UserExpHis.SType.Purse, "取消报修,返还预扣余额[" + orderMod.id + "]");
            }
            break;
            }
            MyBind();
        }
Пример #16
0
    //获取订单操作按钮,分为已下单(未付款),已下单(已付款),已完结(显示)
    public string Getoperator(DataRowView dr)
    {
        M_OrderList orderMod    = new M_OrderList();
        string      result      = "";
        int         orderStatus = DataConverter.CLng(dr["OrderStatus"]);
        int         payStatus   = DataConverter.CLng(dr["Paymentstatus"]);
        int         oid         = Convert.ToInt32(dr["ID"]);
        int         aside       = Convert.ToInt32(dr["Aside"]);
        string      orderNo     = dr["OrderNo"].ToString();

        //----------如果已经删除,则不执行其余的判断
        if (aside != 0)//如果已删除,则不进行其余的判断
        {
            result += "<div><a href='javascript:;' data-oid='" + oid + "' onclick='ConfirmAction(this,\"reconver\");'>还原订单</a></div>";
            result += "<div><a href='javascript:;' data-oid='" + oid + "' onclick='ConfirmAction(this,\"realdel\");'>彻底删除</a></div>";
            return(result);
        }
        if (payStatus == (int)M_OrderList.PayEnum.NoPay)//未付款,显示倒计时和付款链接
        {
            bool isnormal = true;
            //订单过期判断
            if (SiteConfig.ShopConfig.OrderExpired > 0)
            {
                int seconds = GetOrderUnix(dr);
                if (seconds <= 0)
                {
                    result += "<span class='gray9'>订单关闭</span>"; isnormal = false;
                }
                else
                {
                    result += "<span class='ordertime' data-time='" + seconds + "'></span>";
                }
            }
            DataTable dt     = SqlHelper.ExecuteTable("select * from ZL_Payment where PaymentNum='" + orderNo + "' order by PayTime DESC");
            string    payurl = "&OrderCode=" + orderNo;
            if (dt.Rows.Count > 0)
            {
                payurl = "&PayNo=" + dt.Rows[0]["PayNo"];
            }
            //订单未完成,且为正常状态,显示付款
            if (isnormal && OrderHelper.IsCanPay(dr.Row))
            {
                uappMod = uappBll.SelModelByUid(buser.GetLogin().UserID, "wechat");
                if (uappMod != null)
                {
                    M_WX_User wxuserMod1 = wxuserBll.SelForOpenid(1, uappMod.OpenID);
                    M_WX_User wxuserMod2 = wxuserBll.SelForOpenid(2, uappMod.OpenID);
                    if (wxuserMod1 != null && wxuserMod2 == null)
                    {
                        result += "<br/><a href='/Payonline/OrderPay.aspx?appid=1" + payurl + "' class='btn btn-danger btn-sm'> 前往付款</a> ";
                    }
                    else if (wxuserMod2 != null && wxuserMod1 == null)
                    {
                        result += "<br/><a href='/Payonline/OrderPay.aspx?appid=2" + payurl + "' class='btn btn-danger btn-sm'> 前往付款</a> ";
                    }
                    else if (wxuserMod1 == null && wxuserMod2 == null)
                    {
                        result += "<br/><a href='/Payonline/OrderPay.aspx?" + payurl + "' class='btn btn-danger btn-sm'> 前往付款</a> ";
                    }
                }
                else
                {
                    result += "<br/><a href='/Payonline/OrderPay.aspx?" + payurl + "' class='btn btn-danger btn-sm'> 前往付款</a> ";
                }
                //DataTable dt = SqlHelper.ExecuteTable(CommandType.Text, "select * from ZL_Payment where PaymentNum='" + orderNo + "'", null);
                //if (dt.Rows.Count > 0)
                //{
                //    string redirect_uri = HttpUtility.UrlEncode("http://www.wodian8.com/Payonline/wxpayonline.aspx?PayNo=" + dt.Rows[0]["PayNo"].ToString());
                //    string url = "https://open.weixin.qq.com/connect/oauth2/authorize?appid=wx8c5c2dc7b10a36f3&redirect_uri=" + redirect_uri + "&response_type=code&scope=snsapi_userinfo&state=STATE#wechat_redirect";
                //    result += "<br/><a href='" + url + "' class='btn btn-danger btn-sm'> 前往付款</a> ";
                //}
                //else
                //    result += "<br/><a href='/Payonline/OrderPay.aspx?OrderCode=" + orderNo + "' class='btn btn-danger btn-sm'> 前往付款</a> ";
            }
            result += "<span><a href='javascript:;' data-oid='" + oid + "' class='btn btn-warning btn-sm' onclick='ConfirmAction(this,\"del\");'><i class='fa fa-close'></i> 取消订单</a></span>";
        }
        else
        {
            //---物流
            switch (Convert.ToInt32(dr["StateLogistics"]))
            {
            case 1:
                result += "<div><a href='javascript:;' class='btn btn-primary' data-oid='" + oid + "' onclick='ConfirmAction(this,\"receive\");'>确认收货</a></div>";
                break;
            }
            //已付款,但处理申请退款等状态
            if (orderStatus < (int)M_OrderList.StatusEnum.Normal)
            {
                //result += "<a href='AddShare.aspx?CartID=" + dr["CartID"] + "'>取消退款</a><br />";
            }
            //已付款未完结,可申请退款
            if (orderStatus >= (int)M_OrderList.StatusEnum.Normal && orderStatus < (int)M_OrderList.StatusEnum.OrderFinish)
            {
                result += "<a href='javascript:;' onclick='ShowDrawback(" + oid + ");'>取消订单</a>";
            }
            //已付款已完结,可评价晒单
            if (orderStatus >= (int)M_OrderList.StatusEnum.OrderFinish)//已完结
            {
                if (!(dr["AddStatus"].ToString().Contains("comment")))
                {
                    result += "<a href='AddShare.aspx?OrderID=" + dr["ID"] + "'><i class='fa fa-edit'></i> 评价晒单</a>";
                }
                //result += "<a href='/Shop/" + dr["ProID"] + ".aspx' target='_blank' class='btn btn-primary'>立即购买</a>";
            }
        }
        return(result);
    }