Merge branch 'feat-hjj-Paylater' into feat-cjy-Paylater

# Conflicts:
#	pb/bundle/bundle.pb.go
This commit is contained in:
cjy 2026-06-09 09:31:33 +08:00
commit 4a867d2a97
13 changed files with 5778 additions and 5414 deletions

View File

@ -27,6 +27,11 @@ func (b *BundleProvider) GetBundleBalanceByUserId(_ context.Context, req *bundle
return logic.GetBundleBalanceByUserId(req)
}
// 根据用户ID查询套餐订单列表过期的套餐订单不展示
func (b *BundleProvider) GetBundleOrderListByUserId(_ context.Context, req *bundle.GetBundleOrderListByUserIdReq) (*bundle.GetBundleOrderListByUserIdResp, error) {
return logic.GetBundleOrderListByUserId(req)
}
func (b *BundleProvider) GetBundleBalanceByOrderUUID(_ context.Context, req *bundle.GetBundleBalanceByOrderUUIDReq) (*bundle.GetBundleBalanceByOrderUUIDResp, error) {
startTime, status, err := logic.GetBundleBalanceByOrderUUID(req.OrderUUID)
if err != nil {

View File

@ -23,6 +23,7 @@ func CreateBundle(req *model.BundleProfile) (res *bundle.CommonResponse, err err
return
}
// 测试注释
func UpdateBundle(req *model.BundleProfile) (res *bundle.CommonResponse, err error) {
res = new(bundle.CommonResponse)
err = app.ModuleClients.BundleDB.Model(&model.BundleProfile{}).Where("uuid = ? and language= ?", req.UUID, req.Language).Updates(req).Error
@ -64,6 +65,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 +93,8 @@ func BundleList(req *bundle.BundleListRequest) (res *bundle.BundleListResponse,
CompanySign: bundleProfile.CompanySign,
ContractDuration: int64(bundleProfile.ContractDuration),
BundleCommonUid: bundleProfile.BundleCommonUid,
BundleType: int64(bundleProfile.BundleType),
PayLaterTime: int64(bundleProfile.PayLaterTime),
})
}
@ -127,6 +134,8 @@ func BundleDetail(uuid string) (res *bundle.BundleProfile, err error) {
CompanySign: bundleProfile.CompanySign,
ContractDuration: int64(bundleProfile.ContractDuration),
BundleCommonUid: bundleProfile.BundleCommonUid,
BundleType: int64(bundleProfile.BundleType),
PayLaterTime: int64(bundleProfile.PayLaterTime),
}
return
}
@ -150,6 +159,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 +237,8 @@ func BundleListV2(req *bundle.BundleListRequest) (res *bundle.BundleListResponse
BundleProfileLang: bundleProfileLang,
ShelfStatus: int64(bundleProfile.ShelfStatus),
FontColor: bundleProfile.FontColor,
BundleType: int64(bundleProfile.BundleType),
PayLaterTime: int64(bundleProfile.PayLaterTime),
})
}
}
@ -378,7 +393,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 != "" {
@ -393,6 +408,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 +470,8 @@ func BundleListH5V2(req *bundle.BundleListRequest) (res *bundle.BundleListRespon
BundleProfileLang: bundleProfileLang,
ShelfStatus: int64(bundleProfile.ShelfStatus),
FontColor: bundleProfile.FontColor,
BundleType: int64(bundleProfile.BundleType),
PayLaterTime: int64(bundleProfile.PayLaterTime),
})
}
}

View File

@ -174,10 +174,23 @@ func GetBundleBalanceByUserId(req *bundle.GetBundleBalanceByUserIdReq) (data mod
Where("u.id = ?", req.UserId).
Where("bb.month = ?", time.Now().Format("2006-01")).
Order("bor.expiration_time desc")
if req.OrderUUID != "" {
session = session.Where("bb.order_uuid = ?", req.OrderUUID)
}
err = session.First(&data).Error
return
}
func GetBundleOrderListByUserId(userId int32) (orderList []string, err error) {
currentMonth := time.Now().Format("2006-01")
timeNow := time.Now().Format("2006-01-02 15:04:05")
err = app.ModuleClients.BundleDB.Table("bundle_balance").Where("user_id = ? and expired_at >= ?", userId, timeNow).Where("month = ?", currentMonth).Where("deleted_at is null").Select("order_uuid").Find(&orderList).Error
if err != nil {
return nil, err
}
return orderList, nil
}
func GetBundleBalanceByOrderUuid(orderUuid string) (data model.BundleBalance, err error) {
err = app.ModuleClients.BundleDB.Model(&model.BundleBalance{}).Where("order_uuid = ?", orderUuid).First(&data).Error
if err != nil {

View File

@ -262,6 +262,19 @@ func GetBundleBalanceByUserId(req *bundle.GetBundleBalanceByUserIdReq) (*bundle.
return result, nil
}
func GetBundleOrderListByUserId(req *bundle.GetBundleOrderListByUserIdReq) (*bundle.GetBundleOrderListByUserIdResp, error) {
orderList, err := dao.GetBundleOrderListByUserId(req.UserId)
if err != nil {
logger.Error(err)
return nil, errors.New("查询订单列表失败")
}
resp := &bundle.GetBundleOrderListByUserIdResp{}
resp.OrderUuid = lo.Map(orderList, func(m string, _ int) string {
return m
})
return resp, nil
}
// 获取最初非续费套餐订单的开始时间
// 查询失败返回2 和 默认事件
func GetBundleBalanceByOrderUUID(orderUUID string) (time.Time, int, error) {
@ -286,6 +299,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),

View File

@ -68,17 +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: 2, //默认初始状态为2-下架
FontColor: req.FontColor,
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,
@ -202,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)
@ -288,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("更新套餐信息失败")
@ -333,6 +339,7 @@ func BundleListV2(req *bundle.BundleListRequest) (res *bundle.BundleListResponse
func BundleDetailV2(req *bundle.BundleDetailRequest) (res *bundle.BundleDetailResponseV2, err error) {
res = new(bundle.BundleDetailResponseV2)
bundleProfile := &bundle.BundleProfile{}
var bundleProfileLang *bundle.BundleProfileLang
if req.Uuid == "" {
return res, errors.New("缺少套餐UUID")
@ -341,22 +348,55 @@ func BundleDetailV2(req *bundle.BundleDetailRequest) (res *bundle.BundleDetailRe
if err != nil {
return res, errors.New("获取套餐信息失败")
}
if req.Language != "" {
for _, lang := range detail.BundleProfileLang {
if lang.Language == req.Language {
bundleProfileLang = &bundle.BundleProfileLang{
Uuid: lang.UUID,
Name: lang.Name,
Price: lang.Price,
PriceType: lang.PriceType,
Content: lang.Content,
PayLaterTime: lang.PayLaterTime,
}
break
}
}
} else {
//默认返回中文数据
for _, lang := range detail.BundleProfileLang {
if lang.Language == msg.ZH_CN {
bundleProfileLang = &bundle.BundleProfileLang{
Uuid: lang.UUID,
Name: lang.Name,
Price: lang.Price,
PriceType: lang.PriceType,
Content: lang.Content,
PayLaterTime: lang.PayLaterTime,
}
break
}
}
}
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,
Uuid: detail.UUID,
Name: bundleProfileLang.Name,
Content: bundleProfileLang.Content,
Price: bundleProfileLang.Price,
PriceType: bundleProfileLang.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(bundleProfileLang.PayLaterTime),
}
if len(detail.BundleToValueAddService) > 0 {
var valueUuids []string
@ -421,20 +461,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
@ -469,6 +511,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 {
@ -486,6 +530,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

@ -8,6 +8,16 @@ import (
"gorm.io/plugin/soft_delete"
)
const (
BundleTypeBasic = 1 // 基础套餐
BundleTypePostpaid = 2 // 先用后付套餐
)
const (
BundleShelfStatusUp = 1 // 上架
BundleShelfStatusDown = 2 // 下架
)
type BundleProfile struct {
gorm.Model
UUID string `json:"uuid" gorm:"column:uuid;type:varchar(1024);comment:套餐UUID"`
@ -28,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"`
@ -349,6 +361,7 @@ func (*BundleActivate) TableName() string {
type BundleBalanceUsePo struct {
UserId int
OrderUUID string
AccountNumber int
VideoNumber int
ImageNumber int

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:可用时长"`
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:可用时长"`
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

@ -64,6 +64,7 @@ service Bundle {
rpc BundleExtendRecordsList(BundleExtendRecordsListRequest) returns (BundleExtendRecordsListResponse) {} //
rpc GetBundleBalanceList(GetBundleBalanceListReq) returns (GetBundleBalanceListResp) {} //
rpc GetBundleBalanceByUserId(GetBundleBalanceByUserIdReq) returns (GetBundleBalanceByUserIdResp) {} //
rpc GetBundleOrderListByUserId(GetBundleOrderListByUserIdReq) returns (GetBundleOrderListByUserIdResp) {} // ID查询订单列表
rpc GetBundleBalanceByOrderUUID(GetBundleBalanceByOrderUUIDReq) returns (GetBundleBalanceByOrderUUIDResp) {}
rpc CreateBundleBalance(CreateBundleBalanceReq) returns (CreateBundleBalanceResp) {} //
rpc AddBundleBalance(AddBundleBalanceReq) returns (AddBundleBalanceResp) {} //
@ -381,6 +382,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"];
@ -400,7 +402,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"];
}
@ -449,6 +453,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 {
@ -1179,6 +1184,7 @@ message ToBeComfirmedWorksResp{
message GetBundleBalanceByUserIdReq{
int32 userId = 1;
string orderUUID = 2;
}
message GetBundleBalanceByUserIdResp{
@ -1220,6 +1226,14 @@ message GetBundleBalanceByUserIdResp{
string renewalOrderUuid = 36;
}
message GetBundleOrderListByUserIdReq{
int32 userId = 1;
}
message GetBundleOrderListByUserIdResp{
repeated string orderUuid = 1;
}
message GetBundleBalanceByOrderUUIDReq{
string orderUUID = 1;
}

File diff suppressed because it is too large Load Diff

View File

@ -7,8 +7,8 @@ import (
fmt "fmt"
math "math"
proto "github.com/golang/protobuf/proto"
_ "github.com/mwitkow/go-proto-validators"
_ "google.golang.org/protobuf/types/descriptorpb"
_ "github.com/mwitkow/go-proto-validators"
github_com_mwitkow_go_proto_validators "github.com/mwitkow/go-proto-validators"
)
@ -493,6 +493,12 @@ func (this *GetBundleBalanceByUserIdReq) Validate() error {
func (this *GetBundleBalanceByUserIdResp) Validate() error {
return nil
}
func (this *GetBundleOrderListByUserIdReq) Validate() error {
return nil
}
func (this *GetBundleOrderListByUserIdResp) Validate() error {
return nil
}
func (this *GetBundleBalanceByOrderUUIDReq) Validate() error {
return nil
}

View File

@ -70,6 +70,7 @@ type BundleClient interface {
BundleExtendRecordsList(ctx context.Context, in *BundleExtendRecordsListRequest, opts ...grpc_go.CallOption) (*BundleExtendRecordsListResponse, common.ErrorWithAttachment)
GetBundleBalanceList(ctx context.Context, in *GetBundleBalanceListReq, opts ...grpc_go.CallOption) (*GetBundleBalanceListResp, common.ErrorWithAttachment)
GetBundleBalanceByUserId(ctx context.Context, in *GetBundleBalanceByUserIdReq, opts ...grpc_go.CallOption) (*GetBundleBalanceByUserIdResp, common.ErrorWithAttachment)
GetBundleOrderListByUserId(ctx context.Context, in *GetBundleOrderListByUserIdReq, opts ...grpc_go.CallOption) (*GetBundleOrderListByUserIdResp, common.ErrorWithAttachment)
GetBundleBalanceByOrderUUID(ctx context.Context, in *GetBundleBalanceByOrderUUIDReq, opts ...grpc_go.CallOption) (*GetBundleBalanceByOrderUUIDResp, common.ErrorWithAttachment)
CreateBundleBalance(ctx context.Context, in *CreateBundleBalanceReq, opts ...grpc_go.CallOption) (*CreateBundleBalanceResp, common.ErrorWithAttachment)
AddBundleBalance(ctx context.Context, in *AddBundleBalanceReq, opts ...grpc_go.CallOption) (*AddBundleBalanceResp, common.ErrorWithAttachment)
@ -199,6 +200,7 @@ type BundleClientImpl struct {
BundleExtendRecordsList func(ctx context.Context, in *BundleExtendRecordsListRequest) (*BundleExtendRecordsListResponse, error)
GetBundleBalanceList func(ctx context.Context, in *GetBundleBalanceListReq) (*GetBundleBalanceListResp, error)
GetBundleBalanceByUserId func(ctx context.Context, in *GetBundleBalanceByUserIdReq) (*GetBundleBalanceByUserIdResp, error)
GetBundleOrderListByUserId func(ctx context.Context, in *GetBundleOrderListByUserIdReq) (*GetBundleOrderListByUserIdResp, error)
GetBundleBalanceByOrderUUID func(ctx context.Context, in *GetBundleBalanceByOrderUUIDReq) (*GetBundleBalanceByOrderUUIDResp, error)
CreateBundleBalance func(ctx context.Context, in *CreateBundleBalanceReq) (*CreateBundleBalanceResp, error)
AddBundleBalance func(ctx context.Context, in *AddBundleBalanceReq) (*AddBundleBalanceResp, error)
@ -520,6 +522,12 @@ func (c *bundleClient) GetBundleBalanceByUserId(ctx context.Context, in *GetBund
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/GetBundleBalanceByUserId", in, out)
}
func (c *bundleClient) GetBundleOrderListByUserId(ctx context.Context, in *GetBundleOrderListByUserIdReq, opts ...grpc_go.CallOption) (*GetBundleOrderListByUserIdResp, common.ErrorWithAttachment) {
out := new(GetBundleOrderListByUserIdResp)
interfaceKey := ctx.Value(constant.InterfaceKey).(string)
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/GetBundleOrderListByUserId", in, out)
}
func (c *bundleClient) GetBundleBalanceByOrderUUID(ctx context.Context, in *GetBundleBalanceByOrderUUIDReq, opts ...grpc_go.CallOption) (*GetBundleBalanceByOrderUUIDResp, common.ErrorWithAttachment) {
out := new(GetBundleBalanceByOrderUUIDResp)
interfaceKey := ctx.Value(constant.InterfaceKey).(string)
@ -1004,6 +1012,7 @@ type BundleServer interface {
BundleExtendRecordsList(context.Context, *BundleExtendRecordsListRequest) (*BundleExtendRecordsListResponse, error)
GetBundleBalanceList(context.Context, *GetBundleBalanceListReq) (*GetBundleBalanceListResp, error)
GetBundleBalanceByUserId(context.Context, *GetBundleBalanceByUserIdReq) (*GetBundleBalanceByUserIdResp, error)
GetBundleOrderListByUserId(context.Context, *GetBundleOrderListByUserIdReq) (*GetBundleOrderListByUserIdResp, error)
GetBundleBalanceByOrderUUID(context.Context, *GetBundleBalanceByOrderUUIDReq) (*GetBundleBalanceByOrderUUIDResp, error)
CreateBundleBalance(context.Context, *CreateBundleBalanceReq) (*CreateBundleBalanceResp, error)
AddBundleBalance(context.Context, *AddBundleBalanceReq) (*AddBundleBalanceResp, error)
@ -1212,6 +1221,9 @@ func (UnimplementedBundleServer) GetBundleBalanceList(context.Context, *GetBundl
func (UnimplementedBundleServer) GetBundleBalanceByUserId(context.Context, *GetBundleBalanceByUserIdReq) (*GetBundleBalanceByUserIdResp, error) {
return nil, status.Errorf(codes.Unimplemented, "method GetBundleBalanceByUserId not implemented")
}
func (UnimplementedBundleServer) GetBundleOrderListByUserId(context.Context, *GetBundleOrderListByUserIdReq) (*GetBundleOrderListByUserIdResp, error) {
return nil, status.Errorf(codes.Unimplemented, "method GetBundleOrderListByUserId not implemented")
}
func (UnimplementedBundleServer) GetBundleBalanceByOrderUUID(context.Context, *GetBundleBalanceByOrderUUIDReq) (*GetBundleBalanceByOrderUUIDResp, error) {
return nil, status.Errorf(codes.Unimplemented, "method GetBundleBalanceByOrderUUID not implemented")
}
@ -2590,6 +2602,35 @@ func _Bundle_GetBundleBalanceByUserId_Handler(srv interface{}, ctx context.Conte
return interceptor(ctx, in, info, handler)
}
func _Bundle_GetBundleOrderListByUserId_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) {
in := new(GetBundleOrderListByUserIdReq)
if err := dec(in); err != nil {
return nil, err
}
base := srv.(dubbo3.Dubbo3GrpcService)
args := []interface{}{}
args = append(args, in)
md, _ := metadata.FromIncomingContext(ctx)
invAttachment := make(map[string]interface{}, len(md))
for k, v := range md {
invAttachment[k] = v
}
invo := invocation.NewRPCInvocation("GetBundleOrderListByUserId", args, invAttachment)
if interceptor == nil {
result := base.XXX_GetProxyImpl().Invoke(ctx, invo)
return result, result.Error()
}
info := &grpc_go.UnaryServerInfo{
Server: srv,
FullMethod: ctx.Value("XXX_TRIPLE_GO_INTERFACE_NAME").(string),
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
result := base.XXX_GetProxyImpl().Invoke(ctx, invo)
return result, result.Error()
}
return interceptor(ctx, in, info, handler)
}
func _Bundle_GetBundleBalanceByOrderUUID_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) {
in := new(GetBundleBalanceByOrderUUIDReq)
if err := dec(in); err != nil {
@ -4870,6 +4911,10 @@ var Bundle_ServiceDesc = grpc_go.ServiceDesc{
MethodName: "GetBundleBalanceByUserId",
Handler: _Bundle_GetBundleBalanceByUserId_Handler,
},
{
MethodName: "GetBundleOrderListByUserId",
Handler: _Bundle_GetBundleOrderListByUserId_Handler,
},
{
MethodName: "GetBundleBalanceByOrderUUID",
Handler: _Bundle_GetBundleBalanceByOrderUUID_Handler,

View File

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

View File

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