From bbe0c0390cfd6eeb8f654fb84ad073201811108f Mon Sep 17 00:00:00 2001 From: JNG <365252428@qq.com> Date: Mon, 12 Jan 2026 14:36:20 +0800 Subject: [PATCH] 11 --- internal/dao/orderRecordsDao.go | 1 + internal/logic/orderRecordsLogic.go | 1 + internal/model/bundle_order_records.go | 1 + pb/bundle.proto | 4 +++ pb/bundle/bundle.pb.go | 44 +++++++++++++++++++++++--- pkg/db/mysql.go | 5 +++ 6 files changed, 52 insertions(+), 4 deletions(-) diff --git a/internal/dao/orderRecordsDao.go b/internal/dao/orderRecordsDao.go index 72f972f..b2f7143 100644 --- a/internal/dao/orderRecordsDao.go +++ b/internal/dao/orderRecordsDao.go @@ -518,6 +518,7 @@ func OrderRecordsListV2(req *bundle.OrderRecordsRequestV2) (res *bundle.OrderRec Amount: record.Amount, CustomerId: customerID, PayTime: record.PayTime, + InviterId: record.InviterID, } // 聚合子订单 diff --git a/internal/logic/orderRecordsLogic.go b/internal/logic/orderRecordsLogic.go index 9913efa..dc86e99 100644 --- a/internal/logic/orderRecordsLogic.go +++ b/internal/logic/orderRecordsLogic.go @@ -69,6 +69,7 @@ func CreateOrderRecord(req *bundle.OrderCreateRecord) (res *bundle.CommonRespons Language: req.Language, BundleOrderValueAdd: addRecords, PlatformIds: req.PlatformIds, + InviterID: req.InviterId, } res, err = dao.CreateOrderRecord(orderRecord) return diff --git a/internal/model/bundle_order_records.go b/internal/model/bundle_order_records.go index 62976bb..8d563c7 100644 --- a/internal/model/bundle_order_records.go +++ b/internal/model/bundle_order_records.go @@ -45,6 +45,7 @@ type BundleOrderRecords struct { BundleOrderValueAdd []BundleOrderValueAdd `gorm:"foreignKey:OrderUUID;references:UUID" json:"bundleOrderValueAdd"` ReSignature int `json:"reSignature" gorm:"column:re_signature;default:2;type:int;comment:是否重新签 1:是 2:否"` PlatformIds PlatformIDs `gorm:"column:platform_ids;type:json;NOT NULL;comment:发布平台ID集合 TIKTOK= 1, YOUTUBE = 2, INS = 3 , DM = 4, BL = 5;" json:"platformIDs"` + InviterID uint64 `gorm:"column:inviter_id;type:bigint;comment:邀请人ID" json:"inviterID"` } type BundleOrderValueAdd struct { gorm.Model diff --git a/pb/bundle.proto b/pb/bundle.proto index 16ac515..262eb39 100644 --- a/pb/bundle.proto +++ b/pb/bundle.proto @@ -218,6 +218,7 @@ message OrderCreateRecord{ repeated OrderCreateAddRecord addRecords = 20 [json_name = "addRecords"]; //增值服务 string orderNo = 21 [json_name = "orderNo"]; repeated uint32 platformIds = 22; // 发布平台ID集合 (json 格式字符串) + uint64 inviterId = 23; // 邀请人ID } message OrderCreateAddRecord{ int32 serviceType = 1 [json_name = "serviceType"]; @@ -270,6 +271,9 @@ message OrderBundleRecordInfo{ int64 customerId = 9; string payTime = 10; string subNum = 11; + uint64 inviterId = 12; + string inviterCode = 13; + string inviterName = 14; } message OrderAddBundleRecordInfo{ string orderAddNo = 1; diff --git a/pb/bundle/bundle.pb.go b/pb/bundle/bundle.pb.go index 2006306..3209bba 100644 --- a/pb/bundle/bundle.pb.go +++ b/pb/bundle/bundle.pb.go @@ -863,6 +863,7 @@ type OrderCreateRecord struct { AddRecords []*OrderCreateAddRecord `protobuf:"bytes,20,rep,name=addRecords,proto3" json:"addRecords"` //增值服务 OrderNo string `protobuf:"bytes,21,opt,name=orderNo,proto3" json:"orderNo"` PlatformIds []uint32 `protobuf:"varint,22,rep,packed,name=platformIds,proto3" json:"platformIds"` // 发布平台ID集合 (json 格式字符串) + InviterId uint64 `protobuf:"varint,23,opt,name=inviterId,proto3" json:"inviterId"` // 邀请人ID unknownFields protoimpl.UnknownFields sizeCache protoimpl.SizeCache } @@ -1051,6 +1052,13 @@ func (x *OrderCreateRecord) GetPlatformIds() []uint32 { return nil } +func (x *OrderCreateRecord) GetInviterId() uint64 { + if x != nil { + return x.InviterId + } + return 0 +} + type OrderCreateAddRecord struct { state protoimpl.MessageState `protogen:"open.v1"` ServiceType int32 `protobuf:"varint,1,opt,name=serviceType,proto3" json:"serviceType"` @@ -1436,6 +1444,9 @@ type OrderBundleRecordInfo struct { CustomerId int64 `protobuf:"varint,9,opt,name=customerId,proto3" json:"customerId"` PayTime string `protobuf:"bytes,10,opt,name=payTime,proto3" json:"payTime"` SubNum string `protobuf:"bytes,11,opt,name=subNum,proto3" json:"subNum"` + InviterId uint64 `protobuf:"varint,12,opt,name=inviterId,proto3" json:"inviterId"` + InviterCode string `protobuf:"bytes,13,opt,name=inviterCode,proto3" json:"inviterCode"` + InviterName string `protobuf:"bytes,14,opt,name=inviterName,proto3" json:"inviterName"` unknownFields protoimpl.UnknownFields sizeCache protoimpl.SizeCache } @@ -1547,6 +1558,27 @@ func (x *OrderBundleRecordInfo) GetSubNum() string { return "" } +func (x *OrderBundleRecordInfo) GetInviterId() uint64 { + if x != nil { + return x.InviterId + } + return 0 +} + +func (x *OrderBundleRecordInfo) GetInviterCode() string { + if x != nil { + return x.InviterCode + } + return "" +} + +func (x *OrderBundleRecordInfo) GetInviterName() string { + if x != nil { + return x.InviterName + } + return "" +} + type OrderAddBundleRecordInfo struct { state protoimpl.MessageState `protogen:"open.v1"` OrderAddNo string `protobuf:"bytes,1,opt,name=orderAddNo,proto3" json:"orderAddNo"` @@ -14969,7 +15001,7 @@ const file_pb_bundle_proto_rawDesc = "" + "\bduration\x18\b \x01(\x05R\bduration\x12\x12\n" + "\x04unit\x18\t \x01(\tR\x04unit\x12\x1a\n" + "\buserName\x18\n" + - " \x01(\tR\buserName\"\xe5\x05\n" + + " \x01(\tR\buserName\"\x83\x06\n" + "\x11OrderCreateRecord\x12\x1e\n" + "\n" + "bundleUuid\x18\x01 \x01(\tR\n" + @@ -15007,7 +15039,8 @@ const file_pb_bundle_proto_rawDesc = "" + "addRecords\x18\x14 \x03(\v2\x1c.bundle.OrderCreateAddRecordR\n" + "addRecords\x12\x18\n" + "\aorderNo\x18\x15 \x01(\tR\aorderNo\x12 \n" + - "\vplatformIds\x18\x16 \x03(\rR\vplatformIds\"\x92\x03\n" + + "\vplatformIds\x18\x16 \x03(\rR\vplatformIds\x12\x1c\n" + + "\tinviterId\x18\x17 \x01(\x04R\tinviterId\"\x92\x03\n" + "\x14OrderCreateAddRecord\x12 \n" + "\vserviceType\x18\x01 \x01(\x05R\vserviceType\x12\x1a\n" + "\bvalueUid\x18\x02 \x01(\tR\bvalueUid\x12\"\n" + @@ -15055,7 +15088,7 @@ const file_pb_bundle_proto_rawDesc = "" + "bundleInfo\x12\x12\n" + "\x04page\x18\x02 \x01(\x05R\x04page\x12\x1a\n" + "\bpageSize\x18\x03 \x01(\x05R\bpageSize\x12\x14\n" + - "\x05total\x18\x04 \x01(\x05R\x05total\"\x85\x03\n" + + "\x05total\x18\x04 \x01(\x05R\x05total\"\xe7\x03\n" + "\x15OrderBundleRecordInfo\x12\x18\n" + "\aorderNo\x18\x01 \x01(\tR\aorderNo\x12\x1e\n" + "\n" + @@ -15072,7 +15105,10 @@ const file_pb_bundle_proto_rawDesc = "" + "customerId\x12\x18\n" + "\apayTime\x18\n" + " \x01(\tR\apayTime\x12\x16\n" + - "\x06subNum\x18\v \x01(\tR\x06subNum\"\xda\x03\n" + + "\x06subNum\x18\v \x01(\tR\x06subNum\x12\x1c\n" + + "\tinviterId\x18\f \x01(\x04R\tinviterId\x12 \n" + + "\vinviterCode\x18\r \x01(\tR\vinviterCode\x12 \n" + + "\vinviterName\x18\x0e \x01(\tR\vinviterName\"\xda\x03\n" + "\x18OrderAddBundleRecordInfo\x12\x1e\n" + "\n" + "orderAddNo\x18\x01 \x01(\tR\n" + diff --git a/pkg/db/mysql.go b/pkg/db/mysql.go index 6166806..e7e7f28 100644 --- a/pkg/db/mysql.go +++ b/pkg/db/mysql.go @@ -68,6 +68,11 @@ func loadMysqlConn(conn string) *gorm.DB { fmt.Println(err) } } + if db.Migrator().HasColumn(&model.BundleOrderRecords{}, "inviter_id") == false { + if err := db.Migrator().AddColumn(&model.BundleOrderRecords{}, "inviter_id"); err != nil { + fmt.Println(err) + } + } if err != nil { // return nil panic(err)