protected void Page_Load(object sender, EventArgs e) { string typeStr = Request.QueryString["type"]; if (!string.IsNullOrEmpty(typeStr)) { //识别分享类型 ShareType type = ShareType.Unknown; switch (typeStr) { case "timeline": type = ShareType.Timeline; break; case "friend": type = ShareType.Friend; break; } //构造分享记录 var pageShare = new PageShareEntity() { Id = Guid.NewGuid().ToString(), Url = GetOrigenalUrl(System.Web.HttpContext.Current.Request.QueryString["url"]), ParentShareOpenId = System.Web.HttpContext.Current.Request.QueryString["s"], ShareOpenId = System.Web.HttpContext.Current.Request.QueryString["u"], From = type, ShareTime = DateTime.Now }; //保存分享记录 StatisticsBll.InsertPageShare(pageShare); } }
/// <summary> /// 添加分享记录 /// </summary> /// <param name="entity"></param> /// <returns></returns> public static void InsertPageShare(PageShareEntity entity) { entity.ShareTime = DateTime.Now; _statistics.PageShare.Add(entity); }