/// <summary> /// 老用户 /// </summary> /// <returns></returns> public ActionResult Share() { var userId = base.UserId; if (userId != 0) { var model = _iMemberInviteService.GetMemberInviteInfo(userId); var rule = _iMemberInviteService.GetInviteRule(); var Integral = _iMemberIntegralService.GetIntegralChangeRule(); if (Integral != null && Integral.IntegralPerMoney > 0) { ViewBag.IntergralMoney = (rule.InviteIntegral.Value / Integral.IntegralPerMoney).ToString("f2"); } string host = Request.Url.Host; host += Request.Url.Port != 80 ? ":" + Request.Url.Port.ToString() : ""; model.InviteLink = String.Format("http://{0}/Register/index/{1}", host, userId); //rule.ShareIcon = string.Format("http://{0}{1}", host, rule.ShareIcon); //var map = Core.Helper.QRCodeHelper.Create(model.InviteLink); //MemoryStream ms = new MemoryStream(); //map.Save(ms, System.Drawing.Imaging.ImageFormat.Gif); //// 将图片内存流转成base64,图片以DataURI形式显示 //string strUrl = "data:image/gif;base64," + Convert.ToBase64String(ms.ToArray()); //ms.Dispose(); //model.QR = strUrl; var m = new Tuple <UserInviteModel, InviteRuleInfo, UserMemberInfo>(model, rule, CurrentUser); return(View(m)); } else { Response.Redirect("/m-Wap/Login/Entrance?returnUrl=" + HttpUtility.UrlEncode(Request.Url.ToString())); return(View()); } }
public ActionResult Index() { var userId = CurrentUser.Id; var model = _iMemberInviteService.GetMemberInviteInfo(userId); var rule = _iMemberInviteService.GetInviteRule(); var Integral = _iMemberIntegralService.GetIntegralChangeRule(); if (Integral != null && Integral.IntegralPerMoney > 0) { ViewBag.IntergralMoney = (rule.InviteIntegral / Integral.IntegralPerMoney).ToString("f2"); } string host = CurrentUrlHelper.CurrentUrlNoPort(); model.InviteLink = String.Format("{0}/Register/index/{1}", host, userId); //rule.ShareIcon = string.Format("http://{0}{1}", host, rule.ShareIcon); rule.ShareIcon = !string.IsNullOrWhiteSpace(rule.ShareIcon) ? HimallIO.GetRomoteImagePath(rule.ShareIcon) : ""; var map = Core.Helper.QRCodeHelper.Create(model.InviteLink); MemoryStream ms = new MemoryStream(); map.Save(ms, System.Drawing.Imaging.ImageFormat.Gif); // 将图片内存流转成base64,图片以DataURI形式显示 string strUrl = "data:image/gif;base64," + Convert.ToBase64String(ms.ToArray()); ms.Dispose(); model.QR = strUrl; ViewBag.WeiXin = PlatformType == PlatformType.WeiXin; var m = new Tuple <UserInviteModel, Entities.InviteRuleInfo, Entities.MemberInfo>(model, rule, CurrentUser); return(View(m)); }
public ActionResult Index() { var userId = CurrentUser.Id; var model = _iMemberInviteService.GetMemberInviteInfo(userId); var rule = _iMemberInviteService.GetInviteRule(); string host = Request.Url.Host; string scheme = Request.Url.Scheme; //host += Request.Url.Port != 80 ? ":"+Request.Url.Port.ToString() : ""; model.InviteLink = String.Format("{0}://{1}/Register/index/{2}", scheme, host, userId); var map = Core.Helper.QRCodeHelper.Create(model.InviteLink); MemoryStream ms = new MemoryStream(); map.Save(ms, System.Drawing.Imaging.ImageFormat.Gif); // 将图片内存流转成base64,图片以DataURI形式显示 string strUrl = "data:image/gif;base64," + Convert.ToBase64String(ms.ToArray()); ms.Dispose(); model.QR = strUrl; var m = new Tuple <UserInviteModel, Entities.InviteRuleInfo, Entities.MemberInfo>(model, rule, CurrentUser); ViewBag.Keyword = string.IsNullOrWhiteSpace(SiteSettings.SearchKeyword) ? SiteSettings.Keyword : SiteSettings.SearchKeyword; ViewBag.Keywords = SiteSettings.HotKeyWords; return(View(m)); }