package logic import ( product "lone-services/rpc/product/pb" "lone-services/services/product/internal/dao" "time" ) func toProductItem(row dao.ProductInfo) *product.Item { publishTime := "" if !row.PublishTime.IsZero() { publishTime = row.PublishTime.Format(time.DateTime) } return &product.Item{ Id: int64(row.Id), Name: row.Name, Subhead: row.Subhead, Content: row.Content, ModelCode: row.ModelCode, Price: float64(row.Price), StorePrice: float64(row.StorePrice), SalePrice: float64(row.SalePrice), SharePrice: float64(row.SharePrice), AgentPrice: float64(row.AgentPrice), SaleReward: row.SaleReward, SalesModel: uint32(row.SalesModel), Waybill: row.Waybill, Status: uint32(row.Status), Weight: float64(row.Weight), IsIndex: uint32(row.IsIndex), IndexImage: row.IndexImage, Cubage: row.Cubage, Label: row.Label, Images: row.Images, IsBuy: uint32(row.IsBuy), PeriodValidity: int32(row.PeriodValidity), PublishTime: publishTime, Type: uint32(row.Type), NormsNumber: uint32(row.NormsNumber), BoxNumber: row.BoxNumber, Sort: uint32(row.Sort), Number: uint32(row.Number), VerifyStatus: uint32(row.VerifyStatus), VerifyId: int64(row.VerifyId), VerifyName: row.VerifyName, VerifySecondId: int64(row.VerifySecondId), VerifySecondName: row.VerifySecondName, Reason: row.Reason, AdminName: row.AdminName, Edit: uint32(row.Edit), } }