From acdd67e0aeae2c291644690459cdbe9703976529 Mon Sep 17 00:00:00 2001 From: "jiaji.H" Date: Thu, 4 Jun 2026 14:26:32 +0800 Subject: [PATCH 1/2] =?UTF-8?q?Update:=E5=A2=9E=E5=8A=A0=E5=A5=97=E9=A4=90?= =?UTF-8?q?=E7=B1=BB=E5=9E=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- internal/dao/bundleDao.go | 16 ++++++++++++++++ internal/logic/bundleExtendLogic.go | 1 + internal/logic/bundleLogic.go | 1 + internal/model/bundle.go | 6 ++++++ internal/model/valueAdd_bundle.go | 4 ++-- pb/bundle.proto | 1 + pb/bundle/bundle.pb.go | 24 +++++++++++++++++------- pkg/db/mysql.go | 2 +- 8 files changed, 45 insertions(+), 10 deletions(-) diff --git a/internal/dao/bundleDao.go b/internal/dao/bundleDao.go index 4c3b337..d19da9f 100644 --- a/internal/dao/bundleDao.go +++ b/internal/dao/bundleDao.go @@ -64,6 +64,10 @@ func BundleList(req *bundle.BundleListRequest) (res *bundle.BundleListResponse, query = query.Where("language like ?", req.Language) } + if req.BundleType != 0 { + query = query.Where("bundle_type = ?", req.BundleType) + } + count := *query if req.PageSize != 0 && req.Page != 0 { @@ -88,6 +92,7 @@ func BundleList(req *bundle.BundleListRequest) (res *bundle.BundleListResponse, CompanySign: bundleProfile.CompanySign, ContractDuration: int64(bundleProfile.ContractDuration), BundleCommonUid: bundleProfile.BundleCommonUid, + BundleType: int64(bundleProfile.BundleType), }) } @@ -127,6 +132,7 @@ func BundleDetail(uuid string) (res *bundle.BundleProfile, err error) { CompanySign: bundleProfile.CompanySign, ContractDuration: int64(bundleProfile.ContractDuration), BundleCommonUid: bundleProfile.BundleCommonUid, + BundleType: int64(bundleProfile.BundleType), } return } @@ -150,6 +156,10 @@ func BundleListV2(req *bundle.BundleListRequest) (res *bundle.BundleListResponse baseQuery = baseQuery.Where("language like ?", req.Language) } + if req.BundleType != 0 { + baseQuery = baseQuery.Where("bundle_type = ?", req.BundleType) + } + var total int64 if err = baseQuery.Count(&total).Error; err != nil { return res, commonErr.ReturnError(err, msg.ErrorGetBundleList, "获取套餐总数失败: ") @@ -224,6 +234,7 @@ func BundleListV2(req *bundle.BundleListRequest) (res *bundle.BundleListResponse BundleProfileLang: bundleProfileLang, ShelfStatus: int64(bundleProfile.ShelfStatus), FontColor: bundleProfile.FontColor, + BundleType: int64(bundleProfile.BundleType), }) } } @@ -393,6 +404,10 @@ func BundleListH5V2(req *bundle.BundleListRequest) (res *bundle.BundleListRespon query = query.Where("language like ?", req.Language) } + if req.BundleType != 0 { + query = query.Where("bundle_type = ?", req.BundleType) + } + count := *query // 排序:sort 升序,相同 sort 按 created_at 倒序 @@ -451,6 +466,7 @@ func BundleListH5V2(req *bundle.BundleListRequest) (res *bundle.BundleListRespon BundleProfileLang: bundleProfileLang, ShelfStatus: int64(bundleProfile.ShelfStatus), FontColor: bundleProfile.FontColor, + BundleType: int64(bundleProfile.BundleType), }) } } diff --git a/internal/logic/bundleExtendLogic.go b/internal/logic/bundleExtendLogic.go index 794c591..7cb9c7f 100644 --- a/internal/logic/bundleExtendLogic.go +++ b/internal/logic/bundleExtendLogic.go @@ -286,6 +286,7 @@ func GetBundleBalanceByOrderUUID(orderUUID string) (time.Time, int, error) { func AddBundleBalance(req *bundle.AddBundleBalanceReq) (*bundle.AddBundleBalanceResp, error) { data := model.BundleBalanceUsePo{ UserId: int(req.UserId), + OrderUUID: req.OrderUUID, AccountNumber: int(req.AccountConsumptionNumber), ImageNumber: int(req.ImageConsumptionNumber), VideoNumber: int(req.VideoConsumptionNumber), diff --git a/internal/logic/bundleLogic.go b/internal/logic/bundleLogic.go index e9da244..544aeac 100644 --- a/internal/logic/bundleLogic.go +++ b/internal/logic/bundleLogic.go @@ -357,6 +357,7 @@ func BundleDetailV2(req *bundle.BundleDetailRequest) (res *bundle.BundleDetailRe CreatedAt: detail.CreatedAt.Format("2006-01-02 15:04:05"), UpdatedAt: detail.UpdatedAt.Format("2006-01-02 15:04:05"), Contract: detail.Contract, + BundleType: int64(detail.BundleType), } if len(detail.BundleToValueAddService) > 0 { var valueUuids []string diff --git a/internal/model/bundle.go b/internal/model/bundle.go index 5628af1..97ac1d9 100644 --- a/internal/model/bundle.go +++ b/internal/model/bundle.go @@ -8,6 +8,11 @@ import ( "gorm.io/plugin/soft_delete" ) +const ( + BundleTypeBasic = 1 // 基础套餐 + BundleTypePostpaid = 2 // 先用后付套餐 +) + type BundleProfile struct { gorm.Model UUID string `json:"uuid" gorm:"column:uuid;type:varchar(1024);comment:套餐UUID"` @@ -349,6 +354,7 @@ func (*BundleActivate) TableName() string { type BundleBalanceUsePo struct { UserId int + OrderUUID string AccountNumber int VideoNumber int ImageNumber int diff --git a/internal/model/valueAdd_bundle.go b/internal/model/valueAdd_bundle.go index e56f9fc..99a5cf7 100644 --- a/internal/model/valueAdd_bundle.go +++ b/internal/model/valueAdd_bundle.go @@ -35,7 +35,7 @@ type ValueAddService struct { Id int32 `gorm:"column:id;type:int(11);primary_key;AUTO_INCREMENT" json:"id"` UUID string `json:"uuid" gorm:"column:uuid;type:varchar(1024);comment:增值套餐UUID"` ServiceName string `json:"serviceName" gorm:"column:service_name;type:varchar(1024);comment:增值服务名称"` - ServiceType int32 `json:"serviceType" gorm:"column:service_type;type:int;comment:服务类型 1:视频 2:图文 3:数据报表 4:账号数 5:可用时长"` + ServiceType int32 `json:"serviceType" gorm:"column:service_type;type:int;comment:服务类型 1:视频 2:图文 3:数据报表 4:账号数 5:可用时长 6:竞品数 7:支付时长"` ValueAddServiceLang []ValueAddServiceLang `gorm:"foreignKey:UUID;references:UUID"` BundleToValueAddService []BundleToValueAddService `gorm:"foreignKey:ValueUid;references:UUID"` CreatedAt int64 `gorm:"column:created_at;autoCreateTime"` @@ -48,7 +48,7 @@ type ValueAddServiceLang struct { Id int32 `gorm:"column:id;type:int(11);primary_key;AUTO_INCREMENT" json:"id"` UUID string `json:"uuid" gorm:"column:uuid;type:varchar(1024);comment:增值套餐UUID"` ServiceName string `json:"serviceName" gorm:"column:service_name;type:varchar(1024);comment:增值服务名称"` - ServiceType int32 `json:"serviceType" gorm:"column:service_type;type:int;comment:服务类型 1:视频 2:图文 3:数据报表 4:账号数 5:可用时长"` + ServiceType int32 `json:"serviceType" gorm:"column:service_type;type:int;comment:服务类型 1:视频 2:图文 3:数据报表 4:账号数 5:可用时长 6:竞品数 7:支付时长"` PriceMode int32 `json:"priceMode" gorm:"column:price_mode;type:int;comment:套餐价格类型 1:单价 2:总价"` OriginalPrice float32 `json:"originalPrice" gorm:"column:original_price;type:decimal(12,2);comment:原单价"` TotalPrice float32 `json:"totalPrice" gorm:"column:total_price;type:decimal(12,2);comment:增值服务总价"` //总价模式不合理,该字段暂时无用 diff --git a/pb/bundle.proto b/pb/bundle.proto index 3ae523e..4ac8e67 100644 --- a/pb/bundle.proto +++ b/pb/bundle.proto @@ -442,6 +442,7 @@ message BundleListRequest { string name = 3 [json_name = "name"]; string content = 4 [json_name = "content"]; string language = 5 [json_name = "language"]; + int32 bundleType = 6 [json_name = "bundleType"]; } message BundleListResponse { diff --git a/pb/bundle/bundle.pb.go b/pb/bundle/bundle.pb.go index b811b3d..951cd7e 100644 --- a/pb/bundle/bundle.pb.go +++ b/pb/bundle/bundle.pb.go @@ -2779,11 +2779,12 @@ type BundleListRequest struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Page int32 `protobuf:"varint,1,opt,name=page,proto3" json:"page"` - PageSize int32 `protobuf:"varint,2,opt,name=pageSize,proto3" json:"pageSize"` - Name string `protobuf:"bytes,3,opt,name=name,proto3" json:"name"` - Content string `protobuf:"bytes,4,opt,name=content,proto3" json:"content"` - Language string `protobuf:"bytes,5,opt,name=language,proto3" json:"language"` + Page int32 `protobuf:"varint,1,opt,name=page,proto3" json:"page"` + PageSize int32 `protobuf:"varint,2,opt,name=pageSize,proto3" json:"pageSize"` + Name string `protobuf:"bytes,3,opt,name=name,proto3" json:"name"` + Content string `protobuf:"bytes,4,opt,name=content,proto3" json:"content"` + Language string `protobuf:"bytes,5,opt,name=language,proto3" json:"language"` + BundleType int32 `protobuf:"varint,6,opt,name=bundleType,proto3" json:"bundleType"` } func (x *BundleListRequest) Reset() { @@ -2853,6 +2854,13 @@ func (x *BundleListRequest) GetLanguage() string { return "" } +func (x *BundleListRequest) GetBundleType() int32 { + if x != nil { + return x.BundleType + } + return 0 +} + type BundleListResponse struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -21648,7 +21656,7 @@ var file_pb_bundle_proto_rawDesc = []byte{ 0x52, 0x13, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x26, 0x0a, 0x10, 0x44, 0x65, 0x6c, 0x42, 0x75, 0x6e, 0x64, 0x6c, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x75, 0x75, 0x69, - 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x75, 0x75, 0x69, 0x64, 0x22, 0x8d, 0x01, + 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x75, 0x75, 0x69, 0x64, 0x22, 0xad, 0x01, 0x0a, 0x11, 0x42, 0x75, 0x6e, 0x64, 0x6c, 0x65, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x70, 0x61, 0x67, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x04, 0x70, 0x61, 0x67, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x70, 0x61, 0x67, 0x65, 0x53, @@ -21657,7 +21665,9 @@ var file_pb_bundle_proto_rawDesc = []byte{ 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x6c, 0x61, 0x6e, 0x67, 0x75, 0x61, 0x67, 0x65, 0x18, 0x05, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x08, 0x6c, 0x61, 0x6e, 0x67, 0x75, 0x61, 0x67, 0x65, 0x22, 0x5b, 0x0a, + 0x01, 0x28, 0x09, 0x52, 0x08, 0x6c, 0x61, 0x6e, 0x67, 0x75, 0x61, 0x67, 0x65, 0x12, 0x1e, 0x0a, + 0x0a, 0x62, 0x75, 0x6e, 0x64, 0x6c, 0x65, 0x54, 0x79, 0x70, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, + 0x05, 0x52, 0x0a, 0x62, 0x75, 0x6e, 0x64, 0x6c, 0x65, 0x54, 0x79, 0x70, 0x65, 0x22, 0x5b, 0x0a, 0x12, 0x42, 0x75, 0x6e, 0x64, 0x6c, 0x65, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x2f, 0x0a, 0x07, 0x62, 0x75, 0x6e, 0x64, 0x6c, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x62, 0x75, 0x6e, 0x64, 0x6c, 0x65, 0x2e, 0x42, 0x75, diff --git a/pkg/db/mysql.go b/pkg/db/mysql.go index b6810e8..b80e5fb 100644 --- a/pkg/db/mysql.go +++ b/pkg/db/mysql.go @@ -58,7 +58,7 @@ func loadMysqlConn(conn string) *gorm.DB { &model.ValueAddServiceHistory{}, &model.BundleOrderValueAdd{}, &model.BundleExtensionRecords{}, - &model.BundleBalance{}, + // &model.BundleBalance{}, // &model.Reconciliation{}, &model.BundleActivate{}, &model.BundleBalanceLayout{}, From d668424ac7a87eca9613808dadb48fba71e20ae5 Mon Sep 17 00:00:00 2001 From: "jiaji.H" Date: Fri, 5 Jun 2026 10:58:40 +0800 Subject: [PATCH 2/2] =?UTF-8?q?Update:=E5=A2=9E=E5=8A=A0=E5=AF=B9=E5=BA=94?= =?UTF-8?q?=E7=B1=BB=E5=9E=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- internal/dao/bundleDao.go | 2 +- internal/model/bundle.go | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/internal/dao/bundleDao.go b/internal/dao/bundleDao.go index d19da9f..8cd0fb6 100644 --- a/internal/dao/bundleDao.go +++ b/internal/dao/bundleDao.go @@ -389,7 +389,7 @@ func BundleListH5V2(req *bundle.BundleListRequest) (res *bundle.BundleListRespon res.Bundles = make([]*bundle.BundleProfile, 0) bundles := make([]*model.BundleProfile, 0) - query := app.ModuleClients.BundleDB.Model(&model.BundleProfile{}).Where("shelf_status = ?", 1).Preload("BundleProfileLang") + query := app.ModuleClients.BundleDB.Model(&model.BundleProfile{}).Where("shelf_status = ?", model.BundleShelfStatusUp).Preload("BundleProfileLang") //query = query.Where("shelf_status = ?", 1) //上架的 if req.Name != "" { diff --git a/internal/model/bundle.go b/internal/model/bundle.go index 97ac1d9..0308e59 100644 --- a/internal/model/bundle.go +++ b/internal/model/bundle.go @@ -13,6 +13,11 @@ const ( BundleTypePostpaid = 2 // 先用后付套餐 ) +const ( + BundleShelfStatusUp = 1 // 上架 + BundleShelfStatusDown = 2 // 下架 +) + type BundleProfile struct { gorm.Model UUID string `json:"uuid" gorm:"column:uuid;type:varchar(1024);comment:套餐UUID"`