update
This commit is contained in:
@ -70,7 +70,7 @@ func (s *articleService) List(ctx context.Context, q dto.ArticleQuery) ([]dto.Pu
|
||||
for _, r := range rows {
|
||||
ids = append(ids, r.ID)
|
||||
list = append(list, dto.PublicArticle{
|
||||
UID: hashid.EncodeTyped(hashid.TypeRunway, r.ID),
|
||||
UID: hashid.EncodeWithType(r.ID, hashid.TypeRunway),
|
||||
BrandUID: hashid.Encode(r.BrandID),
|
||||
Title: pickLocale(r.TitleEn, r.TitleCn, q.Locale),
|
||||
Cover: s.img.ComposeThumb(r.Cover), // 列表封面走缩略图样式(小尺寸省流量)
|
||||
@ -98,7 +98,7 @@ func (s *articleService) AdminList(ctx context.Context, q dto.ArticleQuery) ([]d
|
||||
list := make([]dto.AdminRunway, 0, len(rows))
|
||||
for _, r := range rows {
|
||||
list = append(list, dto.AdminRunway{
|
||||
UID: hashid.EncodeTyped(hashid.TypeRunway, r.ID),
|
||||
UID: hashid.EncodeWithType(r.ID, hashid.TypeRunway),
|
||||
BrandUID: hashid.Encode(r.BrandID),
|
||||
BrandName: pickLocale(r.BrandNameEn, r.BrandNameCn, "en"),
|
||||
Title: pickLocale(r.TitleEn, r.TitleCn, q.Locale),
|
||||
@ -190,7 +190,7 @@ func (s *articleService) Detail(ctx context.Context, id string, locale string) (
|
||||
}
|
||||
|
||||
return &dto.PublicArticleDetail{
|
||||
UID: hashid.EncodeTyped(hashid.TypeRunway, row.ID),
|
||||
UID: hashid.EncodeWithType(row.ID, hashid.TypeRunway),
|
||||
BrandUID: hashid.Encode(row.BrandID),
|
||||
Title: pickLocale(row.TitleEn, row.TitleCn, locale),
|
||||
Description: pickLocale(row.DescriptionEn, row.DescriptionCn, locale),
|
||||
@ -274,7 +274,7 @@ func (s *articleService) toPublicImages(imgs []model.BrandRunwayImage) []dto.Pub
|
||||
out := make([]dto.PublicArticleImage, 0, len(imgs))
|
||||
for _, im := range imgs {
|
||||
out = append(out, dto.PublicArticleImage{
|
||||
ID: hashid.EncodeTyped(hashid.TypeRunwayImage, im.ID),
|
||||
ID: hashid.EncodeWithType(im.ID, hashid.TypeRunwayImage),
|
||||
Image: s.img.Compose(im.Image),
|
||||
Thumb: s.img.ComposeThumb(im.Image),
|
||||
Name: im.Name,
|
||||
@ -294,7 +294,7 @@ func (s *articleService) toThumbImages(imgs []model.BrandRunwayImage) []dto.Publ
|
||||
out := make([]dto.PublicArticleImage, 0, len(imgs))
|
||||
for _, im := range imgs {
|
||||
out = append(out, dto.PublicArticleImage{
|
||||
ID: hashid.EncodeTyped(hashid.TypeRunwayImage, im.ID),
|
||||
ID: hashid.EncodeWithType(im.ID, hashid.TypeRunwayImage),
|
||||
Image: s.img.ComposeThumb(im.Image),
|
||||
Name: im.Name,
|
||||
IsDetail: im.IsDetail,
|
||||
|
||||
Reference in New Issue
Block a user