Update:更新支持不同类型的套餐不同的配置

This commit is contained in:
jiaji.H 2026-06-10 15:25:51 +08:00
parent a10e13c642
commit 4f3d256091
4 changed files with 35 additions and 12 deletions

View File

@ -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
}

View File

@ -422,6 +422,7 @@ type BundleBalanceLayout struct {
gorm.Model
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"`
}
// 总销售情况

View File

@ -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{

View File

@ -14288,6 +14288,7 @@ type SetBundleBalanceLayoutReq struct {
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
@ -14380,6 +14388,7 @@ type GetBundleBalanceLayoutReq struct {
unknownFields protoimpl.UnknownFields
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,