From 4f3d256091bd9816a412601f31bffa5f667df9b0 Mon Sep 17 00:00:00 2001 From: "jiaji.H" Date: Wed, 10 Jun 2026 15:25:51 +0800 Subject: [PATCH] =?UTF-8?q?Update=EF=BC=9A=E6=9B=B4=E6=96=B0=E6=94=AF?= =?UTF-8?q?=E6=8C=81=E4=B8=8D=E5=90=8C=E7=B1=BB=E5=9E=8B=E7=9A=84=E5=A5=97?= =?UTF-8?q?=E9=A4=90=E4=B8=8D=E5=90=8C=E7=9A=84=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- internal/dao/bundleExtend.go | 6 +++--- internal/model/bundle.go | 5 +++-- pb/bundle.proto | 2 ++ pb/bundle/bundle.pb.go | 34 +++++++++++++++++++++++++++------- 4 files changed, 35 insertions(+), 12 deletions(-) diff --git a/internal/dao/bundleExtend.go b/internal/dao/bundleExtend.go index 2215719..41f7509 100644 --- a/internal/dao/bundleExtend.go +++ b/internal/dao/bundleExtend.go @@ -951,7 +951,7 @@ left join ( func GetBundleBalanceLayout(req *bundle.GetBundleBalanceLayoutReq) (string, error) { data := &model.BundleBalanceLayout{} - if err := app.ModuleClients.BundleDB.Model(&model.BundleBalanceLayout{}).Where("user_id = ?", req.UserId).First(data).Error; err != nil { + if err := app.ModuleClients.BundleDB.Model(&model.BundleBalanceLayout{}).Where("user_id = ? AND bundle_type = ?", req.UserId, req.BundleType).First(data).Error; err != nil { return "nil", err } return data.Data, nil @@ -959,7 +959,7 @@ func GetBundleBalanceLayout(req *bundle.GetBundleBalanceLayoutReq) (string, erro func SetBundleBalanceLayout(req *bundle.SetBundleBalanceLayoutReq) error { return app.ModuleClients.BundleDB.Clauses(clause.OnConflict{ - Columns: []clause.Column{{Name: "user_id"}}, + Columns: []clause.Column{{Name: "user_id"}, {Name: "bundle_type"}}, DoUpdates: clause.AssignmentColumns([]string{"data"}), - }).Create(&model.BundleBalanceLayout{Data: req.Data, UserId: uint64(req.UserId)}).Error + }).Create(&model.BundleBalanceLayout{Data: req.Data, UserId: uint64(req.UserId), BundleType: req.BundleType}).Error } diff --git a/internal/model/bundle.go b/internal/model/bundle.go index 4a23d11..fd4b707 100644 --- a/internal/model/bundle.go +++ b/internal/model/bundle.go @@ -420,8 +420,9 @@ type BundleExport struct { type BundleBalanceLayout struct { gorm.Model - UserId uint64 `gorm:"column:user_id;not null;unique"` - Data string `gorm:"column:data;type:longtext;not null"` + UserId uint64 `gorm:"column:user_id;not null;unique"` + Data string `gorm:"column:data;type:longtext;not null"` + BundleType int32 `gorm:"column:bundle_type;not null"` } // 总销售情况 diff --git a/pb/bundle.proto b/pb/bundle.proto index 5786e8c..473cc41 100644 --- a/pb/bundle.proto +++ b/pb/bundle.proto @@ -1732,6 +1732,7 @@ message ArtistBundleBalanceResponse { message SetBundleBalanceLayoutReq{ uint32 userId = 1; string data = 2; + int32 bundleType = 3; // 1: 普通套餐类型 2: 先用后付套餐 } message SetBundleBalanceLayoutResp{ @@ -1740,6 +1741,7 @@ message SetBundleBalanceLayoutResp{ message GetBundleBalanceLayoutReq{ uint32 userId = 1; + int32 bundleType = 2; } message GetBundleBalanceLayoutResp{ diff --git a/pb/bundle/bundle.pb.go b/pb/bundle/bundle.pb.go index aa8309d..5f15c80 100644 --- a/pb/bundle/bundle.pb.go +++ b/pb/bundle/bundle.pb.go @@ -14286,8 +14286,9 @@ type SetBundleBalanceLayoutReq struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - UserId uint32 `protobuf:"varint,1,opt,name=userId,proto3" json:"userId"` - Data string `protobuf:"bytes,2,opt,name=data,proto3" json:"data"` + UserId uint32 `protobuf:"varint,1,opt,name=userId,proto3" json:"userId"` + Data string `protobuf:"bytes,2,opt,name=data,proto3" json:"data"` + BundleType int32 `protobuf:"varint,3,opt,name=bundleType,proto3" json:"bundleType"` // 1: 普通套餐类型 2: 先用后付套餐 } func (x *SetBundleBalanceLayoutReq) Reset() { @@ -14336,6 +14337,13 @@ func (x *SetBundleBalanceLayoutReq) GetData() string { return "" } +func (x *SetBundleBalanceLayoutReq) GetBundleType() int32 { + if x != nil { + return x.BundleType + } + return 0 +} + type SetBundleBalanceLayoutResp struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -14379,7 +14387,8 @@ type GetBundleBalanceLayoutReq struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - UserId uint32 `protobuf:"varint,1,opt,name=userId,proto3" json:"userId"` + UserId uint32 `protobuf:"varint,1,opt,name=userId,proto3" json:"userId"` + BundleType int32 `protobuf:"varint,2,opt,name=bundleType,proto3" json:"bundleType"` } func (x *GetBundleBalanceLayoutReq) Reset() { @@ -14421,6 +14430,13 @@ func (x *GetBundleBalanceLayoutReq) GetUserId() uint32 { return 0 } +func (x *GetBundleBalanceLayoutReq) GetBundleType() int32 { + if x != nil { + return x.BundleType + } + return 0 +} + type GetBundleBalanceLayoutResp struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -24373,17 +24389,21 @@ var file_pb_bundle_proto_rawDesc = []byte{ 0x44, 0x61, 0x74, 0x61, 0x41, 0x6e, 0x61, 0x6c, 0x79, 0x73, 0x69, 0x73, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x05, 0x52, 0x20, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x61, 0x73, 0x65, 0x50, 0x65, 0x6e, 0x64, 0x69, 0x6e, 0x67, 0x44, 0x61, 0x74, 0x61, 0x41, 0x6e, 0x61, 0x6c, - 0x79, 0x73, 0x69, 0x73, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x47, 0x0a, 0x19, 0x53, 0x65, 0x74, + 0x79, 0x73, 0x69, 0x73, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x67, 0x0a, 0x19, 0x53, 0x65, 0x74, 0x42, 0x75, 0x6e, 0x64, 0x6c, 0x65, 0x42, 0x61, 0x6c, 0x61, 0x6e, 0x63, 0x65, 0x4c, 0x61, 0x79, 0x6f, 0x75, 0x74, 0x52, 0x65, 0x71, 0x12, 0x16, 0x0a, 0x06, 0x75, 0x73, 0x65, 0x72, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x06, 0x75, 0x73, 0x65, 0x72, 0x49, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x64, 0x61, - 0x74, 0x61, 0x22, 0x1c, 0x0a, 0x1a, 0x53, 0x65, 0x74, 0x42, 0x75, 0x6e, 0x64, 0x6c, 0x65, 0x42, + 0x74, 0x61, 0x12, 0x1e, 0x0a, 0x0a, 0x62, 0x75, 0x6e, 0x64, 0x6c, 0x65, 0x54, 0x79, 0x70, 0x65, + 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0a, 0x62, 0x75, 0x6e, 0x64, 0x6c, 0x65, 0x54, 0x79, + 0x70, 0x65, 0x22, 0x1c, 0x0a, 0x1a, 0x53, 0x65, 0x74, 0x42, 0x75, 0x6e, 0x64, 0x6c, 0x65, 0x42, 0x61, 0x6c, 0x61, 0x6e, 0x63, 0x65, 0x4c, 0x61, 0x79, 0x6f, 0x75, 0x74, 0x52, 0x65, 0x73, 0x70, - 0x22, 0x33, 0x0a, 0x19, 0x47, 0x65, 0x74, 0x42, 0x75, 0x6e, 0x64, 0x6c, 0x65, 0x42, 0x61, 0x6c, + 0x22, 0x53, 0x0a, 0x19, 0x47, 0x65, 0x74, 0x42, 0x75, 0x6e, 0x64, 0x6c, 0x65, 0x42, 0x61, 0x6c, 0x61, 0x6e, 0x63, 0x65, 0x4c, 0x61, 0x79, 0x6f, 0x75, 0x74, 0x52, 0x65, 0x71, 0x12, 0x16, 0x0a, 0x06, 0x75, 0x73, 0x65, 0x72, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x06, 0x75, - 0x73, 0x65, 0x72, 0x49, 0x64, 0x22, 0x30, 0x0a, 0x1a, 0x47, 0x65, 0x74, 0x42, 0x75, 0x6e, 0x64, + 0x73, 0x65, 0x72, 0x49, 0x64, 0x12, 0x1e, 0x0a, 0x0a, 0x62, 0x75, 0x6e, 0x64, 0x6c, 0x65, 0x54, + 0x79, 0x70, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0a, 0x62, 0x75, 0x6e, 0x64, 0x6c, + 0x65, 0x54, 0x79, 0x70, 0x65, 0x22, 0x30, 0x0a, 0x1a, 0x47, 0x65, 0x74, 0x42, 0x75, 0x6e, 0x64, 0x6c, 0x65, 0x42, 0x61, 0x6c, 0x61, 0x6e, 0x63, 0x65, 0x4c, 0x61, 0x79, 0x6f, 0x75, 0x74, 0x52, 0x65, 0x73, 0x70, 0x12, 0x12, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x22, 0x19, 0x0a, 0x17, 0x47, 0x65, 0x74, 0x50, 0x65,