private void SetWXShare(CountDownInfo countDown, ProductModel product)
        {
            this.hdAppId.Value = base.site.WeixinAppId;
            Task.Factory.StartNew(delegate
            {
                try
                {
                    string jsApiTicket     = base.GetJsApiTicket(true);
                    string text            = WAPTemplatedWebControl.GenerateNonceStr();
                    string text2           = WAPTemplatedWebControl.GenerateTimeStamp();
                    string absoluteUri     = this.Page.Request.Url.AbsoluteUri;
                    this.hdTimestamp.Value = text2;
                    this.hdNonceStr.Value  = text;
                    this.hdSignature.Value = base.GetSignature(jsApiTicket, text, text2, absoluteUri);
                }
                catch
                {
                }
            });
            this.hdDesc.Value = (string.IsNullOrEmpty(countDown.ShareDetails) ? product.ShortDescription : countDown.ShareDetails);
            string local = string.IsNullOrEmpty(countDown.ShareIcon) ? ((product.ImgUrlList.Count == 0) ? SettingsManager.GetMasterSettings().DefaultProductImage : product.ImgUrlList[0]) : Globals.FullPath(countDown.ShareIcon);

            this.hdImgUrl.Value = Globals.FullPath(local);
            this.hdTitle.Value  = (string.IsNullOrEmpty(countDown.ShareTitle) ? product.ProductName : countDown.ShareTitle);
            this.hdLink.Value   = Globals.FullPath(this.Page.Request.Url.ToString());
        }
        protected override void AttachChildControls()
        {
            this.CheckSendRedEnvelope();
            this.hdAppId         = (HiddenField)this.FindControl("hdAppId");
            this.hdTimestamp     = (HiddenField)this.FindControl("hdTimestamp");
            this.hdNonceStr      = (HiddenField)this.FindControl("hdNonceStr");
            this.hdSignature     = (HiddenField)this.FindControl("hdSignature");
            this.hdTitle         = (HiddenField)this.FindControl("hdTitle");
            this.hdDesc          = (HiddenField)this.FindControl("hdDesc");
            this.hdImgUrl        = (HiddenField)this.FindControl("hdImgUrl");
            this.hdLink          = (HiddenField)this.FindControl("hdLink");
            this.hdSendCode      = (HiddenField)this.FindControl("hdSendCode");
            this.hdRedEnvelopeId = (HiddenField)this.FindControl("hdRedEnvelopeId");
            this.hdOrderId       = (HiddenField)this.FindControl("hdOrderId");
            this.hdAppId.Value   = base.site.WeixinAppId;
            string jsApiTicket = base.GetJsApiTicket(true);
            string text        = WAPTemplatedWebControl.GenerateNonceStr();
            string text2       = WAPTemplatedWebControl.GenerateTimeStamp();
            string absoluteUri = this.Page.Request.Url.AbsoluteUri;

            this.hdTimestamp.Value = text2;
            this.hdNonceStr.Value  = text;
            this.hdSignature.Value = base.GetSignature(jsApiTicket, text, text2, absoluteUri);
            WeiXinRedEnvelopeInfo openedWeiXinRedEnvelope = WeiXinRedEnvelopeProcessor.GetOpenedWeiXinRedEnvelope();
            string text3 = this.orderId;
            int    id    = openedWeiXinRedEnvelope.Id;
            RedEnvelopeSendRecord redEnvelopeSendRecord = WeiXinRedEnvelopeProcessor.GetRedEnvelopeSendRecord(text3, id.ToString());
            Guid guid;

            if (redEnvelopeSendRecord != null)
            {
                this.hdRedEnvelopeId.Value = redEnvelopeSendRecord.RedEnvelopeId.ToString();
                this.hdTitle.Value         = openedWeiXinRedEnvelope.Name;
                this.hdDesc.Value          = openedWeiXinRedEnvelope.ShareDetails;
                this.hdImgUrl.Value        = Globals.FullPath(openedWeiXinRedEnvelope.ShareIcon);
                HiddenField hiddenField = this.hdSendCode;
                guid = redEnvelopeSendRecord.SendCode;
                hiddenField.Value    = guid.ToString();
                this.hdLink.Value    = Globals.FullPath("/Vshop/GetRedEnvelope?SendCode=" + this.hdSendCode.Value + "&OrderId=" + this.orderId);
                this.hdOrderId.Value = this.orderId;
            }
            else
            {
                HiddenField hiddenField2 = this.hdRedEnvelopeId;
                id = openedWeiXinRedEnvelope.Id;
                hiddenField2.Value  = id.ToString();
                this.hdTitle.Value  = openedWeiXinRedEnvelope.Name;
                this.hdDesc.Value   = openedWeiXinRedEnvelope.ShareDetails;
                this.hdImgUrl.Value = Globals.FullPath(openedWeiXinRedEnvelope.ShareIcon);
                HiddenField hiddenField3 = this.hdSendCode;
                guid = Guid.NewGuid();
                hiddenField3.Value   = guid.ToString();
                this.hdLink.Value    = Globals.FullPath("/Vshop/GetRedEnvelope?SendCode=" + this.hdSendCode.Value + "&OrderId=" + this.orderId);
                this.hdOrderId.Value = this.orderId;
            }
        }
        private void SetWXShare(FightGroupInfo fightGroup, ProductInfo product)
        {
            SiteSettings masterSettings = SettingsManager.GetMasterSettings();
            string       jsApiTicket    = base.GetJsApiTicket(true);
            string       text           = WAPTemplatedWebControl.GenerateNonceStr();
            string       text2          = WAPTemplatedWebControl.GenerateTimeStamp();
            string       absoluteUri    = this.Page.Request.Url.AbsoluteUri;

            this.hdAppId.Value     = base.site.WeixinAppId;
            this.hdTimestamp.Value = text2;
            this.hdNonceStr.Value  = text;
            this.hdSignature.Value = base.GetSignature(jsApiTicket, text, text2, absoluteUri);
            FightGroupActivityInfo fightGroupActivitieInfo = TradeHelper.GetFightGroupActivitieInfo(fightGroup.FightGroupActivityId);

            if (fightGroupActivitieInfo == null)
            {
                base.GotoResourceNotFound("活动已结束或者已删除");
            }
            else
            {
                string icon = fightGroupActivitieInfo.Icon;
                this.hdImgUrl.Value = Globals.FullPath(string.IsNullOrEmpty(icon) ? masterSettings.DefaultProductThumbnail8 : icon);
                if (string.IsNullOrEmpty(fightGroupActivitieInfo.ShareTitle))
                {
                    this.hdTitle.Value = (string.IsNullOrEmpty(product.Title) ? product.ProductName : product.Title);
                }
                else
                {
                    this.hdTitle.Value = fightGroupActivitieInfo.ShareTitle.Trim();
                }
                if (string.IsNullOrEmpty(fightGroupActivitieInfo.ShareContent.Trim()))
                {
                    this.hdDesc.Value = product.Meta_Description;
                }
                else
                {
                    this.hdDesc.Value = fightGroupActivitieInfo.ShareContent.Trim();
                }
                if (HiContext.Current.User.IsReferral())
                {
                    this.hdLink.Value = Globals.FullPath(string.Format("/vshop/FightGroupDetails.aspx?fightGroupId={0}&ReferralUserId=" + HiContext.Current.User.UserId, fightGroup.FightGroupId));
                }
                else
                {
                    this.hdLink.Value = Globals.FullPath($"/vshop/FightGroupDetails.aspx?fightGroupId={fightGroup.FightGroupId}");
                }
            }
        }
        private void SetWXShare(FightGroupInfo fightGroup, ProductInfo product)
        {
            SiteSettings           masterSettings          = SettingsManager.GetMasterSettings();
            string                 absoluteUri             = this.Page.Request.Url.AbsoluteUri;
            FightGroupActivityInfo fightGroupActivitieInfo = TradeHelper.GetFightGroupActivitieInfo(fightGroup.FightGroupActivityId);

            if (fightGroupActivitieInfo != null)
            {
                string jsApiTicket = base.GetJsApiTicket(true);
                string text        = WAPTemplatedWebControl.GenerateNonceStr();
                string text2       = WAPTemplatedWebControl.GenerateTimeStamp();
                this.hdAppId.Value     = base.site.WeixinAppId;
                this.hdTimestamp.Value = text2;
                this.hdNonceStr.Value  = text;
                this.hdSignature.Value = base.GetSignature(jsApiTicket, text, text2, absoluteUri);
                string icon = fightGroupActivitieInfo.Icon;
                this.hdImgUrl.Value = Globals.FullPath(string.IsNullOrEmpty(icon) ? masterSettings.DefaultProductThumbnail8 : icon);
                this.hdTitle.Value  = fightGroupActivitieInfo.ShareTitle;
                HtmlInputHidden htmlInputHidden  = this.hdDesc;
                HtmlInputHidden htmlInputHidden2 = this.hdLink;
                string          text5            = htmlInputHidden.Value = (htmlInputHidden2.Value = Globals.FullPath($"/vshop/FightGroupDetails.aspx?fightGroupId={fightGroup.FightGroupId}"));
            }
        }
Beispiel #5
0
        protected override void AttachChildControls()
        {
            this.repeledPanel         = (HtmlGenericControl)this.FindControl("repeledPanel");
            this.repeledTime          = (Literal)this.FindControl("repeledTime");
            this.repeledReason        = (Literal)this.FindControl("repeledReason");
            this.userReferralQRCode   = (System.Web.UI.WebControls.Image) this.FindControl("userReferralQRCode");
            this.imghtmlfxvshop       = (HtmlImage)this.FindControl("imghtmlfxvshop");
            this.imghtmlfxwapshop     = (HtmlImage)this.FindControl("imghtmlfxwapshop");
            this.hdAppId              = (HtmlInputHidden)this.FindControl("hdAppId");
            this.hdTimestamp          = (HtmlInputHidden)this.FindControl("hdTimestamp");
            this.hdNonceStr           = (HtmlInputHidden)this.FindControl("hdNonceStr");
            this.hdSignature          = (HtmlInputHidden)this.FindControl("hdSignature");
            this.divRepeledReason     = (HtmlGenericControl)this.FindControl("divRepeledReason");
            this.hidExtendShareTitle  = (HtmlInputHidden)this.FindControl("hidExtendShareTitle");
            this.hidExtendShareDetail = (HtmlInputHidden)this.FindControl("hidExtendShareDetail");
            this.hidExtendSharePic    = (HtmlInputHidden)this.FindControl("hidExtendSharePic");
            this.hidExtendShareUrl    = (HtmlInputHidden)this.FindControl("hidExtendShareUrl");
            this.posterPanel          = (HtmlGenericControl)this.FindControl("posterPanel");
            this.noreferralPanel      = (HtmlGenericControl)this.FindControl("noreferralPanel");
            MemberInfo user = HiContext.Current.User;

            this.repeledPanel.Visible = false;
            if (user.UserId > 0 && user.IsReferral())
            {
                if (user.Referral.IsRepeled)
                {
                    this.posterPanel.Visible     = false;
                    this.noreferralPanel.Visible = false;
                    this.repeledPanel.Visible    = true;
                    this.repeledTime.Text        = user.Referral.RepelTime.Value.ToString("yyyy-MM-dd HH:mm:ss");
                    if (!string.IsNullOrEmpty(user.Referral.RepelReason.ToNullString()))
                    {
                        this.repeledReason.Text       = user.Referral.RepelReason.ToNullString() + "<br>";
                        this.divRepeledReason.Visible = true;
                    }
                }
                else
                {
                    if (base.ClientType == ClientType.VShop)
                    {
                        this.imghtmlfxwapshop.Visible = false;
                        //本次修改:海报的二维码,直接是商城带邀请码的首页地址,而非带参公众号。注册掉下面的if,只用else里的就可以了。 start
                        //if (base.site.OpenVstore == 1 && !string.IsNullOrEmpty(base.site.WeixinAppId) && !string.IsNullOrEmpty(base.site.WeixinAppSecret))
                        //{
                        //	string accesstoken = AccessTokenContainer.TryGetToken(base.site.WeixinAppId, base.site.WeixinAppSecret, false);
                        //	string qRLIMITSTRSCENETicket = base.GetQRLIMITSTRSCENETicket(accesstoken, "referraluserid:" + HiContext.Current.UserId.ToNullString(), true);
                        //	this.CodeUrl = $"https://mp.weixin.qq.com/cgi-bin/showqrcode?ticket={qRLIMITSTRSCENETicket}";
                        //}
                        //else
                        //{
                        string content = Globals.HostPath(HttpContext.Current.Request.Url) + "/Vshop/ReferralAgreement?ReferralUserId=" + HiContext.Current.User.UserId;
                        this.CodeUrl = Globals.CreateQRCode(content, "/Storage/master/QRCode/" + HiContext.Current.SiteSettings.SiteUrl.Replace(".", "").Replace("https://", "").Replace("http://", "")
                                                            .Replace("/", "")
                                                            .Replace("\\", "") + "_Referral_" + HiContext.Current.User.UserId, false, ImageFormats.Png);
                        //}
                        //本次修改:海报的二维码,直接是商城带邀请码的首页地址,而非带参公众号。注册掉下面的if,只用else里的就可以了。 end
                    }
                    else
                    {
                        this.imghtmlfxvshop.Visible = false;
                        string content2 = Globals.HostPath(HttpContext.Current.Request.Url) + "/WapShop/ReferralAgreement?ReferralUserId=" + HiContext.Current.User.UserId;
                        this.CodeUrl = Globals.CreateQRCode(content2, "/Storage/master/QRCode/" + HiContext.Current.SiteSettings.SiteUrl.Replace(".", "").Replace("https://", "").Replace("http://", "")
                                                            .Replace("/", "")
                                                            .Replace("\\", "") + "_Referral_" + HiContext.Current.User.UserId, false, ImageFormats.Png);
                    }
                    this.SetJson   = File.ReadAllText(HttpRuntime.AppDomainAppPath.ToString() + "Storage/data/Utility/ReferralPoster.js");
                    this.resultObj = (JsonConvert.DeserializeObject(this.SetJson) as JObject);
                    FileInfo fileInfo      = new FileInfo(HttpRuntime.AppDomainAppPath.ToString() + "Storage/data/Utility/ReferralPoster.js");
                    DateTime lastWriteTime = fileInfo.LastWriteTime;
                    FileInfo fileInfo2     = new FileInfo(HttpRuntime.AppDomainAppPath.ToString() + Globals.GetStoragePath() + "/ReferralPoster/Poster_" + ((base.ClientType == ClientType.VShop) ? "Wap_" : "Vshop_") + HiContext.Current.User.UserId + ".jpg");
                    bool     flag          = true;
                    if (fileInfo.Exists && fileInfo2.Exists && fileInfo2.LastWriteTime > lastWriteTime)
                    {
                        this.userReferralQRCode.ImageUrl = Globals.GetStoragePath() + "/ReferralPoster/Poster_" + ((base.ClientType == ClientType.VShop) ? "Wap_" : "Vshop_") + HiContext.Current.User.UserId + ".jpg";
                        flag = false;
                    }
                    if (flag)
                    {
                        if (this.resultObj != null && this.resultObj["writeDate"] != null && this.resultObj["posList"] != null && this.resultObj["DefaultHead"] != null && this.resultObj["myusername"] != null && this.resultObj["shopname"] != null)
                        {
                            this.StoreName  = HiContext.Current.SiteSettings.SiteName;
                            this.UserHead   = user.Picture;
                            this.UserName   = (string.IsNullOrEmpty(user.NickName) ? user.RealName : user.NickName);
                            this.ReferralId = HiContext.Current.User.UserId;
                            this.userId     = HiContext.Current.UserId;
                            string imageUrl = default(string);
                            this.CreatePoster(out imageUrl);
                            this.userReferralQRCode.ImageUrl = imageUrl;
                        }
                        else
                        {
                            this.userReferralQRCode.ImageUrl = "SET Failed";
                        }
                    }
                    string jsApiTicket = base.GetJsApiTicket(true);
                    string text        = WAPTemplatedWebControl.GenerateNonceStr();
                    string text2       = WAPTemplatedWebControl.GenerateTimeStamp();
                    string absoluteUri = this.Page.Request.Url.AbsoluteUri;
                    this.hdAppId.Value              = base.site.WeixinAppId;
                    this.hdTimestamp.Value          = text2;
                    this.hdNonceStr.Value           = text;
                    this.hdSignature.Value          = base.GetSignature(jsApiTicket, text, text2, absoluteUri);
                    this.hidExtendShareTitle.Value  = base.site.ExtendShareTitle.ToNullString();
                    this.hidExtendShareDetail.Value = base.site.ExtendShareDetail.ToNullString();
                    this.hidExtendSharePic.Value    = (string.IsNullOrEmpty(base.site.ExtendSharePic) ? this.userReferralQRCode.ImageUrl : (base.site.ExtendSharePic.ToNullString().Contains("http://") ? base.site.ExtendSharePic.ToNullString() : ("http://" + HttpContext.Current.Request.Url.Host + base.site.ExtendSharePic.ToNullString())));
                    this.hidExtendShareUrl.Value    = Globals.HostPath(HttpContext.Current.Request.Url) + "/vshop/ReferralAgreement.aspx?ReferralUserId=" + HiContext.Current.User.UserId;
                    this.posterPanel.Visible        = true;
                    this.noreferralPanel.Visible    = false;
                }
            }
            else
            {
                this.posterPanel.Visible     = false;
                this.noreferralPanel.Visible = true;
            }
        }