2022-09-21 06:30:52 +00:00
|
|
|
package serializer
|
|
|
|
|
|
|
|
import (
|
|
|
|
"fonchain-artshow/cmd/model"
|
2022-09-22 06:23:56 +00:00
|
|
|
"fonchain-artshow/pb/artShow"
|
2022-09-21 06:30:52 +00:00
|
|
|
"fonchain-artshow/pkg/m"
|
|
|
|
)
|
|
|
|
|
2022-09-22 06:23:56 +00:00
|
|
|
func BuildArtShowM(in *artShow.SaveShowReq) (out *model.ArtShow) {
|
2022-09-21 06:30:52 +00:00
|
|
|
out = new(model.ArtShow)
|
2022-11-11 05:13:19 +00:00
|
|
|
|
|
|
|
out.ShowUID = in.ShowUID
|
2022-09-21 06:30:52 +00:00
|
|
|
out.ShowName = in.ShowName
|
|
|
|
out.ArtistName = in.ArtistName
|
2022-11-11 05:13:19 +00:00
|
|
|
out.ArtistUID = in.ArtistUID
|
2022-09-21 06:30:52 +00:00
|
|
|
out.ArtworkNum = in.ArtworkNum
|
|
|
|
out.Price = in.Price
|
|
|
|
out.Ruler = in.Ruler
|
|
|
|
out.Reward = in.Reward
|
2022-11-30 03:01:14 +00:00
|
|
|
out.CreateTime = in.CreateTime
|
2022-09-22 06:23:56 +00:00
|
|
|
if in.IsShow == 0 {
|
|
|
|
out.IsShow = m.ARTSHOW_INSIDE
|
|
|
|
} else {
|
|
|
|
out.IsShow = int8(in.IsShow)
|
|
|
|
}
|
2022-09-21 06:30:52 +00:00
|
|
|
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
2022-11-30 03:01:14 +00:00
|
|
|
func BuildArtShowListRes(artShows []*model.ArtShowRes) (out []*artShow.ShowDetail) {
|
2022-09-22 06:23:56 +00:00
|
|
|
out = make([]*artShow.ShowDetail, 0)
|
2022-09-21 06:30:52 +00:00
|
|
|
for i := 0; i < len(artShows); i++ {
|
|
|
|
artShowM := BuildArtShowRpc(artShows[i])
|
|
|
|
out = append(out, artShowM)
|
|
|
|
}
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
2022-11-30 03:01:14 +00:00
|
|
|
func BuildArtShowRpc(artShowM *model.ArtShowRes) (out *artShow.ShowDetail) {
|
2022-09-22 06:23:56 +00:00
|
|
|
out = new(artShow.ShowDetail)
|
2022-11-11 05:13:19 +00:00
|
|
|
out.ShowUID = artShowM.ShowUID
|
2022-09-21 06:30:52 +00:00
|
|
|
out.ShowSeq = artShowM.ShowSeq
|
|
|
|
out.ShowName = artShowM.ShowName
|
|
|
|
out.ArtistName = artShowM.ArtistName
|
2022-11-11 05:13:19 +00:00
|
|
|
out.ArtistUID = artShowM.ArtistUID
|
2022-09-21 06:30:52 +00:00
|
|
|
out.ArtworkNum = artShowM.ArtworkNum
|
|
|
|
out.Ruler = artShowM.Ruler
|
|
|
|
out.Price = artShowM.Price
|
2023-01-31 09:14:18 +00:00
|
|
|
out.Reward = artShowM.Reward
|
2022-11-30 03:01:14 +00:00
|
|
|
out.CreateTime = artShowM.CreateTime
|
2022-09-21 06:30:52 +00:00
|
|
|
out.IsShow = int32(artShowM.IsShow)
|
2022-11-30 03:01:14 +00:00
|
|
|
out.Address = artShowM.Address
|
|
|
|
out.ShowTime = artShowM.ShowTime
|
2022-09-21 06:30:52 +00:00
|
|
|
return
|
|
|
|
}
|
2022-10-27 08:06:36 +00:00
|
|
|
|
2022-11-11 05:13:19 +00:00
|
|
|
func BuildArtShowIsShowM(show_uid string, isShow int8) (out *model.ArtShow) {
|
2022-10-27 08:06:36 +00:00
|
|
|
out = new(model.ArtShow)
|
2022-11-11 05:13:19 +00:00
|
|
|
out.ShowUID = show_uid
|
2022-10-27 08:06:36 +00:00
|
|
|
out.IsShow = isShow
|
|
|
|
return
|
|
|
|
}
|