75 lines
1.7 KiB
Go
Executable File
75 lines
1.7 KiB
Go
Executable File
package nakedchatdata
|
|
|
|
import (
|
|
"91porn-server/models/v/nakedchatmod"
|
|
)
|
|
|
|
// FormatAppDataList 格式化app列表数据
|
|
func FormatAppDataList(origin []nakedchatmod.NakedChat) (res []*nakedchatmod.NakedChatSimple) {
|
|
res = make([]*nakedchatmod.NakedChatSimple, len(origin))
|
|
if len(origin) == 0 {
|
|
return
|
|
}
|
|
|
|
// 组装返回数据
|
|
for i, item := range origin {
|
|
res[i] = FormatAppSimpleData(item)
|
|
}
|
|
|
|
return
|
|
}
|
|
|
|
// FormatAppSimpleData 格式化app数据
|
|
func FormatAppSimpleData(item nakedchatmod.NakedChat) (res *nakedchatmod.NakedChatSimple) {
|
|
if item.ID.IsZero() {
|
|
return
|
|
}
|
|
|
|
// 组装返回数据
|
|
res = &nakedchatmod.NakedChatSimple{
|
|
ID: item.ID,
|
|
Title: item.Title,
|
|
Cover: item.Cover,
|
|
Price: item.Price,
|
|
Age: item.Age,
|
|
Weight: item.Weight,
|
|
Height: item.Height,
|
|
Cup: item.Cup,
|
|
SaleNum: item.SaleNum + item.FakeSaleNum,
|
|
CreatedAt: item.CreatedAt,
|
|
UpdatedAt: item.UpdatedAt,
|
|
}
|
|
|
|
return
|
|
}
|
|
|
|
// FormatAppData 格式化app数据
|
|
func FormatAppData(item nakedchatmod.NakedChat) (res *nakedchatmod.NakedChatInfo) {
|
|
if item.ID.IsZero() {
|
|
return
|
|
}
|
|
|
|
// 组装返回数据
|
|
res = &nakedchatmod.NakedChatInfo{
|
|
ID: item.ID,
|
|
Title: item.Title,
|
|
Cover: item.Cover,
|
|
Price: item.Price,
|
|
Options: item.Options,
|
|
Images: item.Images,
|
|
Video: item.Video,
|
|
Contact: item.Contact,
|
|
Age: item.Age,
|
|
Weight: item.Weight,
|
|
Height: item.Height,
|
|
Cup: item.Cup,
|
|
SaleNum: item.SaleNum + item.FakeSaleNum,
|
|
BusinessHours: item.BusinessHours,
|
|
Summary: item.Summary,
|
|
CreatedAt: item.CreatedAt,
|
|
UpdatedAt: item.UpdatedAt,
|
|
}
|
|
|
|
return
|
|
}
|