package publishedGi import ( "joylink.club/bj-rtsts-server/db/model" "joylink.club/bj-rtsts-server/dto" ) type PublishedGiReqDto struct { dto.PageQueryDto Name string `json:"name" form:"name"` Time dto.JsonTime `json:"time" form:"time" time_format:"2006-01-02 15:04:05"` } type PublishedGiListReqDto struct { Name string `json:"name" form:"name"` Type int32 `json:"type" form:"type"` Category string `json:"category" form:"category"` Time dto.JsonTime `json:"time" form:"time" time_format:"2006-01-02 15:04:05"` } type PublishReqDto struct { //发布后的名称 Name string `json:"name" form:"name"` //草稿数据的id DraftId int32 `json:"draftId" form:"draftId"` Note string `json:"note" form:"note"` //Time dto.JsonTime `json:"time" form:"time"` ////是否覆盖同名数据 //Overwrite bool `json:"overwrite" form:"overwrite"` } type PublishedGiDto struct { ID int32 `json:"id"` Name string `json:"name"` Proto []byte `json:"proto"` UserID int32 `json:"userID"` Note string `json:"note"` Category string `json:"category" form:"category"` PublishAt dto.JsonTime `json:"publishAt" time_format:"2006-01-02 15:04:05"` } func ConvertFrom(gi *model.PublishedGi) *PublishedGiDto { return &PublishedGiDto{ ID: gi.ID, Name: gi.Name, Proto: gi.Proto, Note: gi.Note, UserID: gi.UserID, Category: gi.Category, PublishAt: dto.JsonTime(gi.PublishAt), } } func ConvertFromSlice(giSlice []*model.PublishedGi) []*PublishedGiDto { var result []*PublishedGiDto for _, gi := range giSlice { result = append(result, ConvertFrom(gi)) } return result }