You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

41 lines
1.0 KiB

3 years ago
package vip
import (
"recook/internal/back"
"recook/internal/v2/model/recook/goods"
"git.oa00.com/go/mysql"
"github.com/gin-gonic/gin"
3 years ago
"github.com/shopspring/decimal"
3 years ago
)
type Proxy struct{}
3 years ago
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"`
}
3 years ago
func (o Proxy) VipGoods(c *gin.Context) {
var gs goods.RecookGoodsInfoModel
3 years ago
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)
3 years ago
}