package vip import ( "recook/internal/back" "recook/internal/v2/model/recook/goods" "git.oa00.com/go/mysql" "github.com/gin-gonic/gin" "github.com/shopspring/decimal" ) type Proxy struct{} type VipGoods struct { SkuID int `json:"sku_id"` GoodsID int `json:"goods_id"` SkuName string `json:"sku_name"` DiscountPrice decimal.Decimal `json:"discount_price"` Coupon decimal.Decimal `json:"coupon"` EffectTime int `json:"effect_time"` EffectDayType int `json:"effect_day_type"` } func (o Proxy) VipGoods(c *gin.Context) { var gs goods.RecookGoodsInfoModel mysql.Db.Preload("SkuList").First(&gs, "is_virtual = 1") data := make([]VipGoods, 0) for _, v := range gs.SkuList { data = append(data, VipGoods{ SkuID: int(v.Id), GoodsID: int(v.GoodsId), SkuName: v.Name, DiscountPrice: v.DiscountPrice, Coupon: v.Coupon, EffectTime: v.EffectTime, EffectDayType: v.EffectDayType, }) } back.Suc(c, "", data) }