feat: 添加媒体资产文件名支持,优化上传和内容获取逻辑
This commit is contained in:
@@ -545,15 +545,38 @@ func (s *creator) GetSettings(ctx context.Context, userID int64) (*creator_dto.S
|
||||
if err != nil {
|
||||
return nil, errorx.ErrRecordNotFound
|
||||
}
|
||||
// Extract from t.Config
|
||||
cfg := t.Config.Data()
|
||||
return &creator_dto.Settings{
|
||||
Name: t.Name,
|
||||
// Bio/Avatar from Config
|
||||
Name: t.Name,
|
||||
Bio: cfg.Bio,
|
||||
Avatar: cfg.Avatar,
|
||||
Cover: cfg.Cover,
|
||||
Description: cfg.Description,
|
||||
}, nil
|
||||
}
|
||||
|
||||
func (s *creator) UpdateSettings(ctx context.Context, userID int64, form *creator_dto.Settings) error {
|
||||
return nil
|
||||
tid, err := s.getTenantID(ctx, userID)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
t, err := models.TenantQuery.WithContext(ctx).Where(models.TenantQuery.ID.Eq(tid)).First()
|
||||
if err != nil {
|
||||
return errorx.ErrRecordNotFound
|
||||
}
|
||||
|
||||
cfg := t.Config.Data()
|
||||
cfg.Bio = form.Bio
|
||||
cfg.Avatar = form.Avatar
|
||||
cfg.Cover = form.Cover
|
||||
cfg.Description = form.Description
|
||||
|
||||
_, err = models.TenantQuery.WithContext(ctx).Where(models.TenantQuery.ID.Eq(tid)).Updates(&models.Tenant{
|
||||
Name: form.Name,
|
||||
Config: types.NewJSONType(cfg),
|
||||
})
|
||||
return err
|
||||
}
|
||||
|
||||
func (s *creator) ListPayoutAccounts(ctx context.Context, userID int64) ([]creator_dto.PayoutAccount, error) {
|
||||
|
||||
@@ -2,6 +2,10 @@ package fields
|
||||
|
||||
// TenantConfig 租户配置
|
||||
type TenantConfig struct {
|
||||
Theme string `json:"theme,omitempty"`
|
||||
Features []string `json:"features,omitempty"`
|
||||
Theme string `json:"theme,omitempty"`
|
||||
Features []string `json:"features,omitempty"`
|
||||
Bio string `json:"bio,omitempty"`
|
||||
Avatar string `json:"avatar,omitempty"`
|
||||
Cover string `json:"cover,omitempty"`
|
||||
Description string `json:"description,omitempty"`
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user