feat:获取vip

master
howell 3 years ago
parent e7479c3d2b
commit 49c8c05bfe

@ -6,14 +6,35 @@ import (
"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.First(&gs, "is_virtual = 1")
back.Suc(c, "", gin.H{
"goods_id": gs.Id,
})
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)
}

@ -54,6 +54,8 @@ type RecookGoodsSkuModel struct {
SalePurchasePrice decimal.Decimal `json:"sale_purchase_price" gorm:"column:sale_purchase_price"`
SaleVolume2 uint `json:"sale_volume2" gorm:"column:sale_volume2"`
SaleVolumeInc2 uint `json:"sale_volume_inc2" gorm:"column:sale_volume_inc2"`
EffectTime int `json:"effect_time"`
EffectDayType int `json:"effect_day_type"`
}
func (r *RecookGoodsSkuModel) GetSalePrice(level int) decimal.Decimal {

@ -262,7 +262,7 @@ func routerApp(appRouter *gin.RouterGroup) {
profitRouter.POST("shop", proxy.ProfitShopList)
}
}
vipController := appRouter.Group("vip_goods", authorize)
vipController := appRouter.Group("vip_goods")
{
proxy := vip.Proxy{}
{

Loading…
Cancel
Save