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
|
|
|
)
|
|
|
|
|
2022-11-11 05:13:19 +00:00
|
|
|
func BuildShowRelM(in []*artShow.ShowRel, applyUID string) (out []*model.ShowRel) {
|
2022-09-21 06:30:52 +00:00
|
|
|
for i := 0; i < len(in); i++ {
|
|
|
|
showRel := &model.ShowRel{
|
2022-11-11 05:13:19 +00:00
|
|
|
ShowUID: in[i].ShowUID,
|
|
|
|
ApplyUID: applyUID,
|
|
|
|
Index: in[i].Index,
|
|
|
|
Address: in[i].Address,
|
2022-09-21 06:30:52 +00:00
|
|
|
}
|
2022-11-11 05:13:19 +00:00
|
|
|
if in[i].ShowRelUID != "" {
|
|
|
|
showRel.ShowRelUID = in[i].ShowRelUID
|
2022-09-21 06:30:52 +00:00
|
|
|
}
|
|
|
|
out = append(out, showRel)
|
|
|
|
}
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
2022-09-22 06:23:56 +00:00
|
|
|
func BuildShowRelRes(in []*model.ShowRel) (out []*artShow.ShowRel) {
|
2022-09-21 06:30:52 +00:00
|
|
|
for i := 0; i < len(in); i++ {
|
2022-09-22 06:23:56 +00:00
|
|
|
showRel := &artShow.ShowRel{
|
2022-11-11 05:13:19 +00:00
|
|
|
ShowRelUID: in[i].ShowRelUID,
|
|
|
|
ApplyUID: in[i].ApplyUID,
|
|
|
|
ShowUID: in[i].ShowUID,
|
|
|
|
Index: in[i].Index,
|
|
|
|
Address: in[i].Address,
|
2022-09-21 06:30:52 +00:00
|
|
|
}
|
|
|
|
out = append(out, showRel)
|
|
|
|
}
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
func BuildShowRelIDs(in []*model.ShowRel) (out []uint) {
|
|
|
|
out = make([]uint, len(in))
|
|
|
|
for i := 0; i < len(in); i++ {
|
|
|
|
out[i] = in[i].ID
|
|
|
|
}
|
|
|
|
return
|
|
|
|
}
|