123456789101112131415161718192021222324252627282930313233343536373839404142434445 |
- package model
- import (
- "context"
- "icloudapp.cn/tools/entity"
- "icloudapp.cn/tools/service"
- )
- type UserPoster struct {
- ctx context.Context
- }
- func NewUserPoster(ctx context.Context) *UserPoster {
- return &UserPoster{ctx: ctx}
- }
- func (p *UserPoster) Info(posterID int64) (entity.UserPosterInfo, error) {
- sPoster := service.NewUserPoster(p.ctx)
- return sPoster.InfoByID(posterID)
- }
- func (p *UserPoster) InfoByUUID(uuid int64) (entity.UserPosterInfo, error) {
- sPoster := service.NewUserPoster(p.ctx)
- return sPoster.InfoByUUID(uuid)
- }
- func (p *UserPoster) SimpleLists(uid int64) []entity.PostersListForApi {
- sPoster := service.NewUserPoster(p.ctx)
- lists := sPoster.SimpleLists(uid)
- res := make([]entity.PostersListForApi, 0)
- for _, v := range lists {
- var poster entity.PostersListForApi
- poster.Id = v.PosterID
- poster.Name = v.PosterName
- poster.Preview = *v.Preview
- poster.Visits = v.Visits
- poster.Status = v.Status
- poster.CreateAt = v.CreateAt
- res = append(res, poster)
- }
- return res
- }
|