コード例 #1
0
        public ActionResult HotelQRCode()
        {
            string weixinID = HotelCloud.Common.HCRequest.GetString("weixinid");
            int    hid      = HotelCloud.Common.HCRequest.getInt("hid");
            int    id       = HotelCloud.Common.HCRequest.getInt("id");

            if (id <= 0 || hid <= 0)
            {
                return(View());
            }
            ViewData["hid"] = hid;
            //获取酒店信息
            hotel3g.Repository.HotelInfoItem HotelInfo = hotel3g.Repository.MemberHelper.GetHotelInfo(weixinID, hid.ToString());
            ViewData["HotelInfo"] = HotelInfo;

            //获取公众号信息
            string sql = "   SELECT TOP 1 WeiXin2Img,appid,weixintype,WeiXinImg,WeiXinNO FROM dbo.WeiXinNO WITH(NOLOCK) WHERE WeiXinID=@WeiXinID";

            DataTable dt = SQLHelper.Get_DataTable(sql, SQLHelper.GetCon(), new Dictionary <string, DBParam>()
            {
                { "WeiXinID", new DBParam {
                      ParamValue = weixinID
                  } }
            });

            if (dt != null && dt.Rows.Count > 0)
            {
                ViewData["WeiXinNO"]   = dt.Rows[0]["WeiXinNO"].ToString();
                ViewData["WeiXin2Img"] = dt.Rows[0]["WeiXin2Img"].ToString();
                ViewData["QR_Code"]    = dt.Rows[0]["WeiXin2Img"].ToString();

                string weixintype = dt.Rows[0]["weixintype"].ToString();
                if (id > 0)
                {
                    if (weixintype.Equals("4"))
                    {
                        ViewData["QR_Code"] = QR_Code_Url(id, weixinID);
                    }
                    else
                    {
                        //生成跳转链接
                        ViewData["QR_Code"] = "http://qr.liantu.com/api.php?text=" + HttpUtility.UrlEncode(string.Format("http://hotel.weikeniu.com/Promoter/Coupon/{0}?hid={1}", id, hid));
                    }
                }
            }
            return(View());
        }
コード例 #2
0
        public ActionResult CouponDeatil()
        {
            string tel = HCRequest.GetString("tel");
            int    hid = HCRequest.getInt("hid");
            int    id  = HCRequest.getInt("id");;

            ViewData["hid"] = hid;
            ViewData["id"]  = id;

            string weixinid = HCRequest.GetString("weixinid");

            ViewData["weixinid"] = weixinid;
            string sql = @"SELECT id,hid,tel,addtime,[money],promoterid,jifen FROM ShareCouponContent WITH(NOLOCK) WHERE hid=@hid AND tel=@tel";
            Dictionary <string, DBParam> Dic = new Dictionary <string, DBParam>();

            Dic.Add("hid", new DBParam {
                ParamValue = hid.ToString()
            });
            Dic.Add("tel", new DBParam {
                ParamValue = tel
            });
            DataTable dt = SQLHelper.Get_DataTable(sql, SQLHelper.GetCon(), Dic);

            ViewData["CouponDeatil"] = dt;

            //获取酒店信息
            hotel3g.Repository.HotelInfoItem HotelInfo = hotel3g.Repository.MemberHelper.GetHotelInfo(weixinid, hid.ToString());
            ViewData["HotelInfo"] = HotelInfo;



            //获取公众号信息
            sql = "SELECT TOP 1 WeiXin2Img,appid,weixintype,WeiXinImg FROM dbo.WeiXinNO WITH(NOLOCK) WHERE WeiXinID=@WeiXinID";
            dt  = SQLHelper.Get_DataTable(sql, SQLHelper.GetCon(), new Dictionary <string, DBParam>()
            {
                { "WeiXinID", new DBParam {
                      ParamValue = weixinid
                  } }
            });


            if (dt != null && dt.Rows.Count > 0)
            {
                string weixintype = dt.Rows[0]["weixintype"].ToString();
                if (id > 0)
                {
                    if (weixintype.Equals("4"))
                    {
                        ViewData["Logo"] = QR_Code_Url(id, weixinid);
                    }
                    else
                    {
                        //生成跳转链接
                        ViewData["Logo"] = dt.Rows[0]["WeiXin2Img"].ToString();
                    }
                }
            }


            //红包金额
            sql = "SELECT moneys,amountlimit,Remark,scopelimit FROM dbo.CouPon WITH(NOLOCK) WHERE weixinID=@WeiXinID AND s_huodongid>0";

            System.Data.DataTable hongbao = SQLHelper.Get_DataTable(sql, SQLHelper.GetCon(), new Dictionary <string, DBParam>()
            {
                { "WeiXinID", new DBParam {
                      ParamValue = weixinid
                  } }
            });
            if (hongbao != null && hongbao.Rows.Count > 0)
            {
                ViewData["money"]        = hongbao.Rows[0]["moneys"].ToString();
                ViewData["info"]         = hongbao.Rows[0]["Remark"].ToString();
                ViewData["zuiDiXiaoFei"] = hongbao.Rows[0]["amountlimit"].ToString();

                ViewData["scopelimit"] = hongbao.Rows[0]["scopelimit"].ToString();
            }

            return(View());
        }
コード例 #3
0
        public ActionResult Generalize(string id)
        {
            string key = HotelCloud.Common.HCRequest.GetString("key");

            string[] keys = key.Split('@');
            if (keys.Length == 2)
            {
                string weixinID     = keys[0];
                string userWeiXinID = keys[1];

                ViewData["hid"]          = id;
                ViewData["weixinID"]     = weixinID;
                ViewData["userWeiXinID"] = userWeiXinID;

                hotel3g.Repository.MemberCard CurUser = hotel3g.Repository.MemberHelper.GetFXMemberCard(userWeiXinID, weixinID);


                if (string.IsNullOrEmpty(CurUser.photo))
                {
                    AccessToken TokenItem = MemberHelper.GetAccessToken(weixinID);
                    if (TokenItem.error == 1)
                    {
                        try
                        {
                            WeiXinUserInfo UserInfo = MemberHelper.GetUserWeixinInfo(TokenItem.message, userWeiXinID);
                            CurUser.nickname = UserInfo.nickname;
                            if (!string.IsNullOrEmpty(UserInfo.headimgurl))
                            {
                                CurUser.photo = UserInfo.headimgurl;
                                string sql_ = "UPDATE dbo.Member SET photo=@photo WHERE weixinID=@weixinID AND userWeiXinNO=@userWeiXinNO";
                                Dictionary <string, DBParam> Dic = new Dictionary <string, DBParam>();
                                Dic.Add("photo", new DBParam {
                                    ParamValue = CurUser.photo
                                });
                                Dic.Add("weixinID", new DBParam {
                                    ParamValue = weixinID
                                });
                                Dic.Add("userWeiXinNO", new DBParam {
                                    ParamValue = userWeiXinID
                                });
                                int Count = SQLHelper.Run_SQL(sql_, SQLHelper.GetCon(), Dic);
                            }
                        }
                        catch { }
                    }
                }
                if (!string.IsNullOrEmpty(CurUser.photo))
                {
                    CurUser.photo = PromoterDAL.GetPromoterCoverImage(CurUser.photo, "PHOTO_" + userWeiXinID, id);
                }
                else
                {
                    CurUser.photo = "/images/member/wechat.png";
                }
                ViewData["CurUser"] = CurUser;
                //获取酒店信息
                hotel3g.Repository.HotelInfoItem HotelInfo = hotel3g.Repository.MemberHelper.GetHotelInfo(weixinID, id);
                ViewData["HotelLogo"] = PromoterDAL.GetPromoterCoverImage(HotelInfo.hotelLog, "hotelLog", id);
                ViewData["HotelInfo"] = HotelInfo;

                //获取公众号信息
                //string sql = "SELECT TOP 1 WeiXin2Img,appid,weixintype,WeiXinImg FROM dbo.WeiXinNO WITH(NOLOCK) WHERE WeiXinID=@WeiXinID";
                //DataTable dt = SQLHelper.Get_DataTable(sql, SQLHelper.GetCon(), new Dictionary<string, DBParam>() {
                //{"WeiXinID",new DBParam{ParamValue=weixinID}}
                //});

                ViewData["weixintype"] = "0";
                hotel3g.PromoterEntitys.WeiXinPublicInfoResponse WeiXinPublicInfo = PromoterDAL.GetWeiXinPublicInfo(weixinID);
                if (WeiXinPublicInfo != null && !string.IsNullOrEmpty(WeiXinPublicInfo.appid))
                {
                    string weixintype = WeiXinPublicInfo.weixintype.ToString();
                    ViewData["weixintype"] = weixintype;
                    if (int.Parse(CurUser.memberid) > 0)
                    {
                        if (weixintype.Equals("4"))
                        {
                            string logourl = QR_Code_Url(int.Parse(CurUser.memberid), weixinID);
                            string Logo    = PromoterDAL.GetPromoterCoverImage(logourl, "LOGO", id);
                            ViewData["Logo"] = Logo;
                        }
                        else
                        {
                            string logourl = "http://qr.liantu.com/api.php?text=" + HttpUtility.UrlEncode(string.Format("http://hotel.weikeniu.com/Promoter/Coupon/{0}?hid={1}", CurUser.memberid, id));
                            string Logo    = PromoterDAL.GetPromoterCoverImage(logourl, "LOGO", id);
                            //生成跳转链接
                            ViewData["Logo"] = Logo;
                        }

                        if (string.IsNullOrEmpty(HotelInfo.MainPic))
                        {
                            //生成跳转链接
                            string backgroundurl = WeiXinPublicInfo.WeiXinImg;// dt.Rows[0]["WeiXinImg"].ToString();
                            string background    = PromoterDAL.GetPromoterCoverImage(backgroundurl, "BACKGROUND", id);
                            ViewData["background"] = background;
                        }
                        else
                        {
                            //生成跳转链接
                            string backgroundurl = HotelInfo.MainPic.Split(';')[0];
                            string background    = PromoterDAL.GetPromoterCoverImage(backgroundurl, "BACKGROUND", id);
                            ViewData["background"] = background;
                        }
                    }
                    ViewData["appid"] = WeiXinPublicInfo.appid;// dt.Rows[0]["appid"].ToString();
                }

                //获取红包信息
                string sql = "SELECT moneys,Remark,s_JiFen FROM dbo.CouPon WITH(NOLOCK) WHERE weixinID=@WeiXinID AND s_huodongid>0";
                System.Data.DataTable hongbao = SQLHelper.Get_DataTable(sql, SQLHelper.GetCon(), new Dictionary <string, DBParam>()
                {
                    { "WeiXinID", new DBParam {
                          ParamValue = weixinID
                      } }
                });
                var Signature = WeiXinJsSdkDAL.JsApiSignature(weixinID, Request.Url.AbsoluteUri);
                ViewData["timespan"]  = Signature.timestamp;
                ViewData["signature"] = Signature;

                if (hongbao != null && hongbao.Rows.Count > 0)
                {
                    ViewData["Remark"] = hongbao.Rows[0]["Remark"].ToString();
                    ViewData["money"]  = hongbao.Rows[0]["moneys"].ToString();
                    ViewData["info"]   = hongbao.Rows[0]["Remark"].ToString();
                    ViewData["jifen"]  = hongbao.Rows[0]["s_JiFen"].ToString();
                }
            }

            return(View());
        }