2023-08-01 14:47:04 +08:00
|
|
|
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 PublishReqDto struct {
|
|
|
|
//发布后的名称
|
|
|
|
Name string `json:"name" form:"name"`
|
|
|
|
//草稿数据的id
|
2023-08-04 11:54:19 +08:00
|
|
|
DraftId int32 `json:"draftingId" form:"draftingId"`
|
|
|
|
Note string `json:"note" form:"note"`
|
2023-08-01 14:47:04 +08:00
|
|
|
//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"`
|
|
|
|
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,
|
|
|
|
UserID: gi.UserID,
|
|
|
|
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
|
|
|
|
}
|