77 lines
1.8 KiB
Go
77 lines
1.8 KiB
Go
package serializer
|
|
|
|
import (
|
|
"fonchain-artshow/cmd/model"
|
|
"fonchain-artshow/pb/artShow"
|
|
"fonchain-artshow/pkg/m"
|
|
)
|
|
|
|
func BuildArtShowM(in *artShow.SaveShowReq) (out *model.ArtShow) {
|
|
out = new(model.ArtShow)
|
|
|
|
out.ShowUID = in.ShowUID
|
|
out.ShowName = in.ShowName
|
|
out.ArtistName = in.ArtistName
|
|
out.ArtistUID = in.ArtistUID
|
|
out.ShowSeq = in.ShowSeq
|
|
out.ArtworkNum = in.ArtworkNum
|
|
out.Price = in.Price
|
|
out.Ruler = in.Ruler
|
|
out.Reward = in.Reward
|
|
out.CreateTime = in.CreateTime
|
|
out.Operator = in.Operator
|
|
if in.IsShow == 0 {
|
|
out.IsShow = m.ARTSHOW_INSIDE
|
|
} else {
|
|
out.IsShow = int8(in.IsShow)
|
|
}
|
|
|
|
return
|
|
}
|
|
|
|
func BuildArtShowListRes(artShows []*model.ArtShowRes) (out []*artShow.ShowDetail) {
|
|
out = make([]*artShow.ShowDetail, 0)
|
|
for i := 0; i < len(artShows); i++ {
|
|
artShowM := BuildArtShowRpc(artShows[i])
|
|
out = append(out, artShowM)
|
|
}
|
|
return
|
|
}
|
|
|
|
func BuildArtShowRpc(artShowM *model.ArtShowRes) (out *artShow.ShowDetail) {
|
|
out = new(artShow.ShowDetail)
|
|
out.ShowUID = artShowM.ShowUID
|
|
out.ShowSeq = artShowM.ShowSeq
|
|
out.ShowName = artShowM.ShowName
|
|
out.ArtistName = artShowM.ArtistName
|
|
out.ArtistUID = artShowM.ArtistUID
|
|
out.ArtworkNum = artShowM.ArtworkNum
|
|
out.Ruler = artShowM.Ruler
|
|
out.Price = artShowM.Price
|
|
out.Reward = artShowM.Reward
|
|
out.CreateTime = artShowM.CreateTime
|
|
out.Operator = artShowM.Operator
|
|
out.IsShow = int32(artShowM.IsShow)
|
|
out.Address = artShowM.Address
|
|
out.ShowTime = artShowM.ShowTime
|
|
return
|
|
}
|
|
|
|
func BuildArtShowIsShowM(show_uid string, isShow int8) (out *model.ArtShow) {
|
|
out = new(model.ArtShow)
|
|
out.ShowUID = show_uid
|
|
out.IsShow = isShow
|
|
return
|
|
}
|
|
|
|
func BuildShowStatusRpc(in []*model.ArtShowRes) (out []*artShow.ShowStatus) {
|
|
out = make([]*artShow.ShowStatus, 0)
|
|
for i := 0; i < len(in); i++ {
|
|
out = append(out, &artShow.ShowStatus{
|
|
ShowUID: in[i].ShowUID,
|
|
IsShow: int32(in[i].IsShow),
|
|
})
|
|
}
|
|
return out
|
|
}
|