YouChuKoffee/app/http/entities/Voucher.go

44 lines
1.2 KiB
Go
Raw Normal View History

2024-06-17 16:29:39 +08:00
package entities
import (
"qteam/app/models/brandmodel"
"qteam/app/models/productsmodel"
"qteam/config"
)
type VoucherListResponse struct {
MilkUrl string `json:"milkUrl"`
MilkList []MilkList `json:"milkList"`
MilkVoucherList []MilkVoucherList `json:"milkVoucherList"`
}
type MilkList struct {
BrandLogo string `json:"brandLogo"`
BrandFlag string `json:"brandFlag"`
}
func (this *MilkList) ResponseFromDb(in brandmodel.Brand) {
this.BrandFlag = in.Flag
this.BrandLogo = in.Logo
}
type MilkVoucherList struct {
BrandFlag string `json:"brandFlag"`
VoucherTitle string `json:"voucherTitle"`
VoucherUrl string `json:"voucherUrl"`
VoucherIcon string `json:"voucherIcon"`
VoucherAmount string `json:"voucherAmount"`
VoucherOriginalPrice string `json:"voucherOriginalPrice"`
VoucherStatus string `json:"voucherStatus"`
}
func (this *MilkVoucherList) ResponseFromDb(in productsmodel.MilkProductsList) {
this.BrandFlag = in.Flag
this.VoucherTitle = in.Name
this.VoucherUrl = config.GetConf().YouChu.MilkUrl + "?voucher_id=" + in.Id
this.VoucherIcon = in.MainImage
this.VoucherAmount = in.ShowPrice
this.VoucherOriginalPrice = in.Price
this.VoucherStatus = in.Status
}