YouChuKoffee/app/http/entities/front/Products.go

29 lines
754 B
Go

package front
import (
"qteam/app/models/productsmodel"
"qteam/app/utils"
)
type ProductDetailRequest struct {
ProductId int `form:"product_id" validate:"required"`
}
type ProductDetailResponse struct {
Id string `json:"id"`
Name string `json:"name"`
MainImage string `json:"main_image"`
Brand string `json:"brand"`
Stock string `json:"stock"`
ShowPrice string `json:"show_price"`
Price string `json:"price"`
CreateTime string `json:"create_time"`
Status string `json:"status"`
Description string `json:"description"`
}
func (this *ProductDetailResponse) ResponseFromDb(in productsmodel.Products) {
utils.EntityCopy(this, &in)
this.CreateTime = in.CreateTime.Format("2006-01-02 15:04:05")
}