Merge branch 'feat-hjj-Paylater' of http://gitea.tools.fontree.cn:3000/fiee/micro-bundle into feat-hjj-Paylater
This commit is contained in:
commit
20f94743d4
@ -65,6 +65,10 @@ func BundleList(req *bundle.BundleListRequest) (res *bundle.BundleListResponse,
|
|||||||
query = query.Where("language like ?", req.Language)
|
query = query.Where("language like ?", req.Language)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if req.BundleType != 0 {
|
||||||
|
query = query.Where("bundle_type = ?", req.BundleType)
|
||||||
|
}
|
||||||
|
|
||||||
count := *query
|
count := *query
|
||||||
|
|
||||||
if req.PageSize != 0 && req.Page != 0 {
|
if req.PageSize != 0 && req.Page != 0 {
|
||||||
@ -89,6 +93,7 @@ func BundleList(req *bundle.BundleListRequest) (res *bundle.BundleListResponse,
|
|||||||
CompanySign: bundleProfile.CompanySign,
|
CompanySign: bundleProfile.CompanySign,
|
||||||
ContractDuration: int64(bundleProfile.ContractDuration),
|
ContractDuration: int64(bundleProfile.ContractDuration),
|
||||||
BundleCommonUid: bundleProfile.BundleCommonUid,
|
BundleCommonUid: bundleProfile.BundleCommonUid,
|
||||||
|
BundleType: int64(bundleProfile.BundleType),
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -128,6 +133,7 @@ func BundleDetail(uuid string) (res *bundle.BundleProfile, err error) {
|
|||||||
CompanySign: bundleProfile.CompanySign,
|
CompanySign: bundleProfile.CompanySign,
|
||||||
ContractDuration: int64(bundleProfile.ContractDuration),
|
ContractDuration: int64(bundleProfile.ContractDuration),
|
||||||
BundleCommonUid: bundleProfile.BundleCommonUid,
|
BundleCommonUid: bundleProfile.BundleCommonUid,
|
||||||
|
BundleType: int64(bundleProfile.BundleType),
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -151,6 +157,10 @@ func BundleListV2(req *bundle.BundleListRequest) (res *bundle.BundleListResponse
|
|||||||
baseQuery = baseQuery.Where("language like ?", req.Language)
|
baseQuery = baseQuery.Where("language like ?", req.Language)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if req.BundleType != 0 {
|
||||||
|
baseQuery = baseQuery.Where("bundle_type = ?", req.BundleType)
|
||||||
|
}
|
||||||
|
|
||||||
var total int64
|
var total int64
|
||||||
if err = baseQuery.Count(&total).Error; err != nil {
|
if err = baseQuery.Count(&total).Error; err != nil {
|
||||||
return res, commonErr.ReturnError(err, msg.ErrorGetBundleList, "获取套餐总数失败: ")
|
return res, commonErr.ReturnError(err, msg.ErrorGetBundleList, "获取套餐总数失败: ")
|
||||||
@ -225,6 +235,7 @@ func BundleListV2(req *bundle.BundleListRequest) (res *bundle.BundleListResponse
|
|||||||
BundleProfileLang: bundleProfileLang,
|
BundleProfileLang: bundleProfileLang,
|
||||||
ShelfStatus: int64(bundleProfile.ShelfStatus),
|
ShelfStatus: int64(bundleProfile.ShelfStatus),
|
||||||
FontColor: bundleProfile.FontColor,
|
FontColor: bundleProfile.FontColor,
|
||||||
|
BundleType: int64(bundleProfile.BundleType),
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -379,7 +390,7 @@ func BundleListH5V2(req *bundle.BundleListRequest) (res *bundle.BundleListRespon
|
|||||||
res.Bundles = make([]*bundle.BundleProfile, 0)
|
res.Bundles = make([]*bundle.BundleProfile, 0)
|
||||||
bundles := make([]*model.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) //上架的
|
//query = query.Where("shelf_status = ?", 1) //上架的
|
||||||
|
|
||||||
if req.Name != "" {
|
if req.Name != "" {
|
||||||
@ -394,6 +405,10 @@ func BundleListH5V2(req *bundle.BundleListRequest) (res *bundle.BundleListRespon
|
|||||||
query = query.Where("language like ?", req.Language)
|
query = query.Where("language like ?", req.Language)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if req.BundleType != 0 {
|
||||||
|
query = query.Where("bundle_type = ?", req.BundleType)
|
||||||
|
}
|
||||||
|
|
||||||
count := *query
|
count := *query
|
||||||
|
|
||||||
// 排序:sort 升序,相同 sort 按 created_at 倒序
|
// 排序:sort 升序,相同 sort 按 created_at 倒序
|
||||||
@ -452,6 +467,7 @@ func BundleListH5V2(req *bundle.BundleListRequest) (res *bundle.BundleListRespon
|
|||||||
BundleProfileLang: bundleProfileLang,
|
BundleProfileLang: bundleProfileLang,
|
||||||
ShelfStatus: int64(bundleProfile.ShelfStatus),
|
ShelfStatus: int64(bundleProfile.ShelfStatus),
|
||||||
FontColor: bundleProfile.FontColor,
|
FontColor: bundleProfile.FontColor,
|
||||||
|
BundleType: int64(bundleProfile.BundleType),
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -286,6 +286,7 @@ func GetBundleBalanceByOrderUUID(orderUUID string) (time.Time, int, error) {
|
|||||||
func AddBundleBalance(req *bundle.AddBundleBalanceReq) (*bundle.AddBundleBalanceResp, error) {
|
func AddBundleBalance(req *bundle.AddBundleBalanceReq) (*bundle.AddBundleBalanceResp, error) {
|
||||||
data := model.BundleBalanceUsePo{
|
data := model.BundleBalanceUsePo{
|
||||||
UserId: int(req.UserId),
|
UserId: int(req.UserId),
|
||||||
|
OrderUUID: req.OrderUUID,
|
||||||
AccountNumber: int(req.AccountConsumptionNumber),
|
AccountNumber: int(req.AccountConsumptionNumber),
|
||||||
ImageNumber: int(req.ImageConsumptionNumber),
|
ImageNumber: int(req.ImageConsumptionNumber),
|
||||||
VideoNumber: int(req.VideoConsumptionNumber),
|
VideoNumber: int(req.VideoConsumptionNumber),
|
||||||
|
|||||||
@ -357,6 +357,7 @@ func BundleDetailV2(req *bundle.BundleDetailRequest) (res *bundle.BundleDetailRe
|
|||||||
CreatedAt: detail.CreatedAt.Format("2006-01-02 15:04:05"),
|
CreatedAt: detail.CreatedAt.Format("2006-01-02 15:04:05"),
|
||||||
UpdatedAt: detail.UpdatedAt.Format("2006-01-02 15:04:05"),
|
UpdatedAt: detail.UpdatedAt.Format("2006-01-02 15:04:05"),
|
||||||
Contract: detail.Contract,
|
Contract: detail.Contract,
|
||||||
|
BundleType: int64(detail.BundleType),
|
||||||
}
|
}
|
||||||
if len(detail.BundleToValueAddService) > 0 {
|
if len(detail.BundleToValueAddService) > 0 {
|
||||||
var valueUuids []string
|
var valueUuids []string
|
||||||
|
|||||||
@ -8,6 +8,16 @@ import (
|
|||||||
"gorm.io/plugin/soft_delete"
|
"gorm.io/plugin/soft_delete"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
const (
|
||||||
|
BundleTypeBasic = 1 // 基础套餐
|
||||||
|
BundleTypePostpaid = 2 // 先用后付套餐
|
||||||
|
)
|
||||||
|
|
||||||
|
const (
|
||||||
|
BundleShelfStatusUp = 1 // 上架
|
||||||
|
BundleShelfStatusDown = 2 // 下架
|
||||||
|
)
|
||||||
|
|
||||||
type BundleProfile struct {
|
type BundleProfile struct {
|
||||||
gorm.Model
|
gorm.Model
|
||||||
UUID string `json:"uuid" gorm:"column:uuid;type:varchar(1024);comment:套餐UUID"`
|
UUID string `json:"uuid" gorm:"column:uuid;type:varchar(1024);comment:套餐UUID"`
|
||||||
@ -349,6 +359,7 @@ func (*BundleActivate) TableName() string {
|
|||||||
|
|
||||||
type BundleBalanceUsePo struct {
|
type BundleBalanceUsePo struct {
|
||||||
UserId int
|
UserId int
|
||||||
|
OrderUUID string
|
||||||
AccountNumber int
|
AccountNumber int
|
||||||
VideoNumber int
|
VideoNumber int
|
||||||
ImageNumber int
|
ImageNumber int
|
||||||
|
|||||||
@ -35,7 +35,7 @@ type ValueAddService struct {
|
|||||||
Id int32 `gorm:"column:id;type:int(11);primary_key;AUTO_INCREMENT" json:"id"`
|
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"`
|
UUID string `json:"uuid" gorm:"column:uuid;type:varchar(1024);comment:增值套餐UUID"`
|
||||||
ServiceName string `json:"serviceName" gorm:"column:service_name;type:varchar(1024);comment:增值服务名称"`
|
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"`
|
ValueAddServiceLang []ValueAddServiceLang `gorm:"foreignKey:UUID;references:UUID"`
|
||||||
BundleToValueAddService []BundleToValueAddService `gorm:"foreignKey:ValueUid;references:UUID"`
|
BundleToValueAddService []BundleToValueAddService `gorm:"foreignKey:ValueUid;references:UUID"`
|
||||||
CreatedAt int64 `gorm:"column:created_at;autoCreateTime"`
|
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"`
|
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"`
|
UUID string `json:"uuid" gorm:"column:uuid;type:varchar(1024);comment:增值套餐UUID"`
|
||||||
ServiceName string `json:"serviceName" gorm:"column:service_name;type:varchar(1024);comment:增值服务名称"`
|
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:总价"`
|
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:原单价"`
|
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:增值服务总价"` //总价模式不合理,该字段暂时无用
|
TotalPrice float32 `json:"totalPrice" gorm:"column:total_price;type:decimal(12,2);comment:增值服务总价"` //总价模式不合理,该字段暂时无用
|
||||||
|
|||||||
@ -442,6 +442,7 @@ message BundleListRequest {
|
|||||||
string name = 3 [json_name = "name"];
|
string name = 3 [json_name = "name"];
|
||||||
string content = 4 [json_name = "content"];
|
string content = 4 [json_name = "content"];
|
||||||
string language = 5 [json_name = "language"];
|
string language = 5 [json_name = "language"];
|
||||||
|
int32 bundleType = 6 [json_name = "bundleType"];
|
||||||
}
|
}
|
||||||
|
|
||||||
message BundleListResponse {
|
message BundleListResponse {
|
||||||
|
|||||||
@ -2779,11 +2779,12 @@ type BundleListRequest struct {
|
|||||||
sizeCache protoimpl.SizeCache
|
sizeCache protoimpl.SizeCache
|
||||||
unknownFields protoimpl.UnknownFields
|
unknownFields protoimpl.UnknownFields
|
||||||
|
|
||||||
Page int32 `protobuf:"varint,1,opt,name=page,proto3" json:"page"`
|
Page int32 `protobuf:"varint,1,opt,name=page,proto3" json:"page"`
|
||||||
PageSize int32 `protobuf:"varint,2,opt,name=pageSize,proto3" json:"pageSize"`
|
PageSize int32 `protobuf:"varint,2,opt,name=pageSize,proto3" json:"pageSize"`
|
||||||
Name string `protobuf:"bytes,3,opt,name=name,proto3" json:"name"`
|
Name string `protobuf:"bytes,3,opt,name=name,proto3" json:"name"`
|
||||||
Content string `protobuf:"bytes,4,opt,name=content,proto3" json:"content"`
|
Content string `protobuf:"bytes,4,opt,name=content,proto3" json:"content"`
|
||||||
Language string `protobuf:"bytes,5,opt,name=language,proto3" json:"language"`
|
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() {
|
func (x *BundleListRequest) Reset() {
|
||||||
@ -2853,6 +2854,13 @@ func (x *BundleListRequest) GetLanguage() string {
|
|||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (x *BundleListRequest) GetBundleType() int32 {
|
||||||
|
if x != nil {
|
||||||
|
return x.BundleType
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
type BundleListResponse struct {
|
type BundleListResponse struct {
|
||||||
state protoimpl.MessageState
|
state protoimpl.MessageState
|
||||||
sizeCache protoimpl.SizeCache
|
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,
|
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,
|
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,
|
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,
|
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,
|
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,
|
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,
|
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,
|
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,
|
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,
|
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,
|
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,
|
0x20, 0x03, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x62, 0x75, 0x6e, 0x64, 0x6c, 0x65, 0x2e, 0x42, 0x75,
|
||||||
|
|||||||
@ -58,7 +58,7 @@ func loadMysqlConn(conn string) *gorm.DB {
|
|||||||
&model.ValueAddServiceHistory{},
|
&model.ValueAddServiceHistory{},
|
||||||
&model.BundleOrderValueAdd{},
|
&model.BundleOrderValueAdd{},
|
||||||
&model.BundleExtensionRecords{},
|
&model.BundleExtensionRecords{},
|
||||||
&model.BundleBalance{},
|
// &model.BundleBalance{},
|
||||||
// &model.Reconciliation{},
|
// &model.Reconciliation{},
|
||||||
&model.BundleActivate{},
|
&model.BundleActivate{},
|
||||||
&model.BundleBalanceLayout{},
|
&model.BundleBalanceLayout{},
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user