/// <summary> /// 详细页面地址 /// </summary> /// <param name="itemId">推荐内容Id</param> /// <returns></returns> public string RecommendItemDetail(long itemId) { PointGift pointGift = new PointMallService().GetGift(itemId); if (pointGift == null) { return(string.Empty); } return(SiteUrls.Instance().GiftDetail(itemId)); }
/// <summary> /// 获取被评论对象名称 /// </summary> /// <param name="commentedObjectId">被评论对象Id</param> /// <param name="tenantTypeId">租户类型Id</param> /// <returns></returns> public string GetCommentedObjectName(long commentedObjectId, string tenantTypeId) { if (tenantTypeId == TenantTypeIds.Instance().PointGift()) { PointGift pointGift = new PointMallService().GetGift(commentedObjectId); if (pointGift != null) { return(pointGift.Name); } } return(string.Empty); }
/// <summary> /// 获取被评论对象(部分) /// </summary> /// <param name="commentedObjectId"></param> /// <returns></returns> public CommentedObject GetCommentedObject(long commentedObjectId) { PointGift pointGift = new PointMallService().GetGift(commentedObjectId); if (pointGift != null) { IUser user = DIContainer.Resolve <UserService>().GetUser(pointGift.UserId); CommentedObject commentedObject = new CommentedObject(); commentedObject.DetailUrl = SiteUrls.Instance().GiftDetail(commentedObjectId); commentedObject.Name = pointGift.Name; commentedObject.Author = user.DisplayName; commentedObject.UserId = pointGift.UserId; return(commentedObject); } return(null); }
/// <summary> /// 转化为PointGift /// </summary> /// <returns>PointGift</returns> public PointGift AsPointGift() { PointGift gift = null; if (this.GiftId > 0) { gift = new PointMallService().GetGift(this.GiftId); } else { gift = PointGift.New(); gift.UserId = UserContext.CurrentUser.UserId; } gift.Description = this.Description; gift.FeaturedImage = this.FeaturedImage ?? string.Empty; gift.IsEnabled = this.IsEnabled; gift.LastModified = DateTime.UtcNow; gift.Name = this.Name; gift.Price = this.Price; gift.FeaturedImageIds = this.FeaturedImageIds ?? string.Empty; if (!string.IsNullOrEmpty(this.FeaturedImageIds)) { gift.FeaturedImageAttachmentId = long.Parse(FeaturedImageIds.Split(',').First()); } else { gift.FeaturedImageAttachmentId = 0; } var attachment = new AttachmentService(TenantTypeIds.Instance().PointGift()).Get(gift.FeaturedImageAttachmentId); gift.FeaturedImage = attachment != null?attachment.GetRelativePath() + "\\" + attachment.FileName : string.Empty; gift.LastModified = DateTime.UtcNow; return(gift); }
/// <summary> /// 删除用户在应用中的数据 /// </summary> /// <param name="userId">用户Id</param> /// <param name="takeOverUserName">用于接管删除用户时不能删除的内容(例如:用户创建的群组)</param> /// <param name="isTakeOver">是否接管被删除用户可被接管的内容</param> protected override void DeleteUser(long userId, string takeOverUserName, bool isTakeOver) { PointMallService pointMallService = new PointMallService(); pointMallService.DeleteUser(userId, takeOverUserName, isTakeOver); }