From 3beb54c12cfdb50bf67f95618e9580414cd818df Mon Sep 17 00:00:00 2001 From: Echo <1711788888@qq.com> Date: Tue, 12 Aug 2025 16:24:33 +0800 Subject: [PATCH] =?UTF-8?q?:art:=20=20=E4=BC=98=E5=8C=96=E8=AE=A2=E5=8D=95?= =?UTF-8?q?=E9=80=BB=E8=BE=91=EF=BC=8C=E6=96=B0=E5=A2=9Evip=E5=AD=97?= =?UTF-8?q?=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- model/app/order.go | 1 + model/vip/vip.go | 1 + service/app/order.go | 2 +- 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/model/app/order.go b/model/app/order.go index 2718b4b..198e35a 100644 --- a/model/app/order.go +++ b/model/app/order.go @@ -8,6 +8,7 @@ type Order struct { UserId uint64 `gorm:"column:user_id;type:bigint(20) unsigned;comment:用户ID;NOT NULL" json:"user_id"` OrderType int `gorm:"column:order_type;type:int(11);comment:订单类型 |1 课程|2 vip|;NOT NULL" json:"order_type"` ArticleId uint `gorm:"column:article_id;type:bigint(20) unsigned;default:0;comment:文章ID;NOT NULL" json:"article_id"` + VipId uint `gorm:"column:vip_id;type:bigint(20) unsigned;default:0;comment:会员ID;NOT NULL" json:"vip_id"` Title string `gorm:"column:title;type:varchar(255);comment:订单标题;NOT NULL" json:"title"` Name string `gorm:"column:name;type:varchar(255);comment:名称;NOT NULL" json:"name"` Price int64 `gorm:"column:price;type:int(11) unsigned;default:0;comment:订单价格;NOT NULL" json:"price"` diff --git a/model/vip/vip.go b/model/vip/vip.go index 82c329d..b1b6b3b 100644 --- a/model/vip/vip.go +++ b/model/vip/vip.go @@ -8,6 +8,7 @@ type Vip struct { Level int `json:"level" form:"level" gorm:"comment:会员等级 1 Vip 2 Svip"` // 会员等级 Price float64 `json:"price" form:"price" gorm:"comment:会员价格"` // 会员价格 Expiration int64 `json:"expiration" form:"expiration" gorm:"comment:会员有效期"` // 会员过期时间 + Des string `json:"des" form:"des" gorm:"comment:会员描述"` // 会员描述 } // TableName 设置表名 diff --git a/service/app/order.go b/service/app/order.go index 6dfca33..eb4f84d 100644 --- a/service/app/order.go +++ b/service/app/order.go @@ -60,7 +60,7 @@ func (s *OrderService) Create(o *app.Order) (*app.Order, error) { return nil, err } } else { - err := global.GVA_DB.Table("lckt_vip").Select("price").Where("id = ?", o.ArticleId).Scan(&price).Error + err := global.GVA_DB.Table("lckt_vip").Select("price").Where("id = ?", o.VipId).Scan(&price).Error if err != nil { global.GVA_LOG.Error("查询VIP价格失败", zap.Error(err)) return nil, err