Update:增加字段

This commit is contained in:
jiaji.H 2026-06-08 11:51:31 +08:00
parent f9c7edf7c3
commit 17c8114b47
7 changed files with 4551 additions and 4500 deletions

View File

@ -94,6 +94,7 @@ func BundleList(req *bundle.BundleListRequest) (res *bundle.BundleListResponse,
ContractDuration: int64(bundleProfile.ContractDuration),
BundleCommonUid: bundleProfile.BundleCommonUid,
BundleType: int64(bundleProfile.BundleType),
PayLaterTime: int64(bundleProfile.PayLaterTime),
})
}
@ -134,6 +135,7 @@ func BundleDetail(uuid string) (res *bundle.BundleProfile, err error) {
ContractDuration: int64(bundleProfile.ContractDuration),
BundleCommonUid: bundleProfile.BundleCommonUid,
BundleType: int64(bundleProfile.BundleType),
PayLaterTime: int64(bundleProfile.PayLaterTime),
}
return
}
@ -236,6 +238,7 @@ func BundleListV2(req *bundle.BundleListRequest) (res *bundle.BundleListResponse
ShelfStatus: int64(bundleProfile.ShelfStatus),
FontColor: bundleProfile.FontColor,
BundleType: int64(bundleProfile.BundleType),
PayLaterTime: int64(bundleProfile.PayLaterTime),
})
}
}
@ -468,6 +471,7 @@ func BundleListH5V2(req *bundle.BundleListRequest) (res *bundle.BundleListRespon
ShelfStatus: int64(bundleProfile.ShelfStatus),
FontColor: bundleProfile.FontColor,
BundleType: int64(bundleProfile.BundleType),
PayLaterTime: int64(bundleProfile.PayLaterTime),
})
}
}

View File

@ -68,18 +68,19 @@ func SaveBundle(req *bundle.BundleProfile) (res *bundle.SaveResponse, err error)
}
//套餐主表数据
bundleProfile := &model.BundleProfile{
Name: req.Name,
Sort: req.Sort,
Content: req.Content,
Price: req.Price,
PriceType: req.PriceType,
Contract: "https://e-cdn.fontree.cn/fonchain-main/prod/file/contract/saas/template-25122501.pdf",
ImgOption: int8(req.ImgOption),
BgImg1: req.BgImg1,
BgImg2: req.BgImg2,
ShelfStatus: model.BundleShelfStatusDown, //默认初始状态为2-下架
FontColor: req.FontColor,
BundleType: req.BundleType,
Name: req.Name,
Sort: req.Sort,
Content: req.Content,
Price: req.Price,
PriceType: req.PriceType,
Contract: "https://e-cdn.fontree.cn/fonchain-main/prod/file/contract/saas/template-25122501.pdf",
ImgOption: int8(req.ImgOption),
BgImg1: req.BgImg1,
BgImg2: req.BgImg2,
ShelfStatus: model.BundleShelfStatusDown, //默认初始状态为2-下架
FontColor: req.FontColor,
BundleType: req.BundleType,
PayLaterTime: req.PayLaterTime,
}
bundleLang := &model.BundleProfileLang{
Name: req.Name,
@ -203,6 +204,8 @@ func SaveBundle(req *bundle.BundleProfile) (res *bundle.SaveResponse, err error)
serviceName = "账号数"
case msg.AvailableTimeService:
serviceName = "可用时长"
case msg.CompetitiveService:
serviceName = "竞品数"
}
return res, fmt.Errorf("服务类型%s的额度不兼容套餐权益额度为%d附加权益额度为%d",
serviceName, benefitsQuota.QuotaValue, optionalQuota.QuotaValue)
@ -289,15 +292,17 @@ func SaveBundle(req *bundle.BundleProfile) (res *bundle.SaveResponse, err error)
}
if req.Language == msg.ZH_CN {
updateBundle := map[string]interface{}{
"name": req.Name,
"sort": req.Sort,
"content": req.Content,
"price": req.Price,
"price_type": req.PriceType,
"img_option": req.ImgOption,
"bg_img1": req.BgImg1,
"bg_img2": req.BgImg2,
"font_color": req.FontColor,
"name": req.Name,
"sort": req.Sort,
"content": req.Content,
"price": req.Price,
"price_type": req.PriceType,
"img_option": req.ImgOption,
"bg_img1": req.BgImg1,
"bg_img2": req.BgImg2,
"font_color": req.FontColor,
"bundle_type": req.BundleType,
"pay_later_time": req.PayLaterTime,
}
if err = dao.TxUpdateBundle(tx, req.Uuid, updateBundle); err != nil {
return res, errors.New("更新套餐信息失败")
@ -344,21 +349,22 @@ func BundleDetailV2(req *bundle.BundleDetailRequest) (res *bundle.BundleDetailRe
}
if detail != nil {
bundleProfile = &bundle.BundleProfile{
Uuid: detail.UUID,
Name: detail.Name,
Content: detail.Content,
Price: detail.Price,
PriceType: detail.PriceType,
ImgOption: int32(detail.ImgOption),
BgImg1: detail.BgImg1,
BgImg2: detail.BgImg2,
FontColor: detail.FontColor,
Sort: detail.Sort,
ShelfStatus: detail.ShelfStatus,
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),
Uuid: detail.UUID,
Name: detail.Name,
Content: detail.Content,
Price: detail.Price,
PriceType: detail.PriceType,
ImgOption: int32(detail.ImgOption),
BgImg1: detail.BgImg1,
BgImg2: detail.BgImg2,
FontColor: detail.FontColor,
Sort: detail.Sort,
ShelfStatus: detail.ShelfStatus,
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),
PayLaterTime: int64(detail.PayLaterTime),
}
if len(detail.BundleToValueAddService) > 0 {
var valueUuids []string
@ -423,20 +429,22 @@ func BundleDetailV2(req *bundle.BundleDetailRequest) (res *bundle.BundleDetailRe
bundleProfileLangs := make([]*bundle.BundleProfileLang, 0, len(detail.BundleProfileLang))
for _, lang := range detail.BundleProfileLang {
bundleProfileLangs = append(bundleProfileLangs, &bundle.BundleProfileLang{
Uuid: lang.UUID,
Name: lang.Name,
Price: lang.Price,
PriceType: lang.PriceType,
Content: lang.Content,
Language: lang.Language,
ImgOption: int32(detail.ImgOption),
BgImg1: detail.BgImg1,
BgImg2: detail.BgImg2,
FontColor: detail.FontColor,
Sort: detail.Sort,
ShelfStatus: detail.ShelfStatus,
CreatedAt: time.Unix(lang.CreatedAt, 0).Format("2006-01-02 15:04:05"),
UpdatedAt: time.Unix(int64(lang.UpdatedAt), 0).Format("2006-01-02 15:04:05"),
Uuid: lang.UUID,
Name: lang.Name,
Price: lang.Price,
PriceType: lang.PriceType,
Content: lang.Content,
Language: lang.Language,
PayLaterTime: int64(lang.PayLaterTime),
ImgOption: int32(detail.ImgOption),
BgImg1: detail.BgImg1,
BgImg2: detail.BgImg2,
FontColor: detail.FontColor,
Sort: detail.Sort,
ShelfStatus: detail.ShelfStatus,
BundleType: int64(detail.BundleType),
CreatedAt: time.Unix(lang.CreatedAt, 0).Format("2006-01-02 15:04:05"),
UpdatedAt: time.Unix(int64(lang.UpdatedAt), 0).Format("2006-01-02 15:04:05"),
})
}
bundleProfile.BundleProfileLang = bundleProfileLangs
@ -471,6 +479,8 @@ func BundleLangDetailV2(req *bundle.BundleDetailRequest) (res *bundle.BundleProf
res.Sort = detail.Sort
res.ShelfStatus = detail.ShelfStatus
res.Contract = detail.Contract
res.BundleType = int64(detail.BundleType)
res.PayLaterTime = int64(detail.PayLaterTime)
if len(detail.BundleToValueAddService) > 0 {
var serviceLangInfos []*bundle.ServiceLangInfo
for _, service := range detail.BundleToValueAddService {
@ -488,6 +498,7 @@ func BundleLangDetailV2(req *bundle.BundleDetailRequest) (res *bundle.BundleProf
res.PriceType = lang.PriceType
res.Content = lang.Content
res.Language = lang.Language
res.PayLaterTime = int64(lang.PayLaterTime)
res.CreatedAt = time.Unix(lang.CreatedAt, 0).Format("2006-01-02 15:04:05")
res.UpdatedAt = time.Unix(int64(lang.UpdatedAt), 0).Format("2006-01-02 15:04:05")
}

View File

@ -38,20 +38,22 @@ type BundleProfile struct {
BgImg1 string `json:"bgImg1" gorm:"column:bg_img1;type:varchar(1024);comment:背景图-首页"`
BgImg2 string `json:"bgImg2" gorm:"column:bg_img2;type:varchar(1024);comment:背景图-我的"`
BundleType int64 `json:"bundleType" gorm:"column:bundle_type;type:int;default:1;comment:套餐类型 1:基础套餐 2:先用后付套餐"`
PayLaterTime int64 `json:"payLaterTime" gorm:"column:pay_later_time;type:int;default:1;comment:先用后付套餐的后付时间,单位为天"`
BundleToValueAddService []BundleToValueAddService `gorm:"foreignKey:BundleUuid;references:UUID" json:"bundleToValueAddService"`
BundleProfileLang []BundleProfileLang `gorm:"foreignKey:UUID;references:UUID" json:"bundleProfileLang"`
}
type BundleProfileLang 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"`
Name string `json:"name" gorm:"column:name;type:varchar(2048);comment:套餐名称"`
Price float32 `json:"price" gorm:"column:price;type:decimal(12,2);comment:套餐价格"`
PriceType int64 `json:"priceType" gorm:"column:price_type;type:int;comment:套餐类型 1:人民币 2:美元"`
Content string `json:"content" gorm:"column:content;type:text;comment:套餐内容"`
Language string `json:"language" gorm:"column:language;type:varchar(32);comment:套餐语言 zh-CN zh-TW EN de-DE ja-JP(中繁英德日)"`
CreatedAt int64 `gorm:"column:created_at;autoCreateTime"`
UpdatedAt int64 `gorm:"column:updated_at;autoCreateTime"`
DeletedAt soft_delete.DeletedAt
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"`
Name string `json:"name" gorm:"column:name;type:varchar(2048);comment:套餐名称"`
Price float32 `json:"price" gorm:"column:price;type:decimal(12,2);comment:套餐价格"`
PriceType int64 `json:"priceType" gorm:"column:price_type;type:int;comment:套餐类型 1:人民币 2:美元"`
Content string `json:"content" gorm:"column:content;type:text;comment:套餐内容"`
PayLaterTime int64 `json:"payLaterTime" gorm:"column:pay_later_time;type:int;default:1;comment:先用后付套餐的后付时间,单位为天"`
Language string `json:"language" gorm:"column:language;type:varchar(32);comment:套餐语言 zh-CN zh-TW EN de-DE ja-JP(中繁英德日)"`
CreatedAt int64 `gorm:"column:created_at;autoCreateTime"`
UpdatedAt int64 `gorm:"column:updated_at;autoCreateTime"`
DeletedAt soft_delete.DeletedAt
}
type BundleToValueAddService struct {
Id int32 `gorm:"column:id;type:int(11);primary_key;AUTO_INCREMENT" json:"id"`

View File

@ -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:可用时长 6:竞品数 7:支付时长"`
ServiceType int32 `json:"serviceType" gorm:"column:service_type;type:int;comment:服务类型 1:视频 2:图文 3:数据报表 4:账号数 5:可用时长 6:竞品数"`
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:可用时长 6:竞品数 7:支付时长"`
ServiceType int32 `json:"serviceType" gorm:"column:service_type;type:int;comment:服务类型 1:视频 2:图文 3:数据报表 4:账号数 5:可用时长 6:竞品数"`
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:增值服务总价"` //总价模式不合理,该字段暂时无用

View File

@ -374,6 +374,7 @@ message BundleProfile {
int32 imgOption = 20 [json_name = "imgOption"];
string fontColor = 21 [json_name = "fontColor"];
int64 bundleType = 22 [json_name = "bundleType"];
int64 payLaterTime = 23 [json_name = "payLaterTime"]; //
}
message BundleProfileLang {
string uuid = 1 [json_name = "uuid"];
@ -393,7 +394,9 @@ message BundleProfileLang {
string bgImg2 = 15 [json_name = "bgImg2"];
int64 shelfStatus = 16 [json_name = "shelfStatus"]; // 1 2
int32 imgOption = 17 [json_name = "imgOption"];
repeated ServiceLangInfo serviceLangInfo = 18 [json_name = "serviceLangInfo"];//
int64 bundleType = 18 [json_name = "bundleType"];
int64 payLaterTime = 19 [json_name = "payLaterTime"]; //
repeated ServiceLangInfo serviceLangInfo = 20 [json_name = "serviceLangInfo"];//
//repeated ValueAddServiceLang valueAddServiceLang = 12 [json_name = "ValueAddServiceLang"];
}

File diff suppressed because it is too large Load Diff

View File

@ -119,6 +119,7 @@ const (
DataReportService = 3 //数据报表
AccountService = 4 //账号数
AvailableTimeService = 5 //可用时长
CompetitiveService = 6 //竞品数
)
// 套餐状态