feat: 添加音乐键位字段,更新相关数据结构和接口
This commit is contained in:
@@ -160,6 +160,7 @@ func (s *content) Get(ctx context.Context, userID int64, id string) (*content_dt
|
||||
Description: item.Description,
|
||||
Body: item.Body,
|
||||
MediaUrls: s.toMediaURLs(accessibleAssets),
|
||||
Meta: content_dto.Meta{Key: item.Key},
|
||||
IsLiked: isLiked,
|
||||
IsFavorited: isFavorited,
|
||||
}
|
||||
|
||||
@@ -98,7 +98,7 @@ func (s *creator) ListContents(
|
||||
ctx context.Context,
|
||||
userID int64,
|
||||
filter *creator_dto.CreatorContentListFilter,
|
||||
) ([]creator_dto.ContentItem, error) {
|
||||
) ([]creator_dto.CreatorContentItem, error) {
|
||||
tid, err := s.getTenantID(ctx, userID)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@@ -122,12 +122,13 @@ func (s *creator) ListContents(
|
||||
return nil, errorx.ErrDatabaseError.WithCause(err)
|
||||
}
|
||||
|
||||
var data []creator_dto.ContentItem
|
||||
var data []creator_dto.CreatorContentItem
|
||||
for _, item := range list {
|
||||
data = append(data, creator_dto.ContentItem{
|
||||
data = append(data, creator_dto.CreatorContentItem{
|
||||
ID: cast.ToString(item.ID),
|
||||
Title: item.Title,
|
||||
Genre: item.Genre,
|
||||
Key: item.Key,
|
||||
Views: int(item.Views),
|
||||
Likes: int(item.Likes),
|
||||
IsPurchased: false,
|
||||
@@ -150,6 +151,7 @@ func (s *creator) CreateContent(ctx context.Context, userID int64, form *creator
|
||||
UserID: uid,
|
||||
Title: form.Title,
|
||||
Genre: form.Genre,
|
||||
Key: form.Key,
|
||||
Status: consts.ContentStatusPublished,
|
||||
}
|
||||
if err := tx.Content.WithContext(ctx).Create(content); err != nil {
|
||||
@@ -214,6 +216,7 @@ func (s *creator) UpdateContent(
|
||||
_, err = tx.Content.WithContext(ctx).Where(tx.Content.ID.Eq(cid)).Updates(&models.Content{
|
||||
Title: form.Title,
|
||||
Genre: form.Genre,
|
||||
Key: form.Key,
|
||||
})
|
||||
if err != nil {
|
||||
return err
|
||||
@@ -318,6 +321,7 @@ func (s *creator) GetContent(ctx context.Context, userID int64, id string) (*cre
|
||||
ID: cast.ToString(c.ID),
|
||||
Title: c.Title,
|
||||
Genre: c.Genre,
|
||||
Key: c.Key,
|
||||
Description: c.Description,
|
||||
Status: string(c.Status),
|
||||
Price: price,
|
||||
|
||||
Reference in New Issue
Block a user