From d318cdf00389daa02d2c222940ea85f8811c0cc0 Mon Sep 17 00:00:00 2001 From: meixiongfeng <766881921@qq.com> Date: Tue, 13 Dec 2022 18:26:54 +0800 Subject: [PATCH] =?UTF-8?q?vip=20=E5=AE=9D=E7=AE=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- comm/const.go | 2 + modules/privilege/api.go | 1 + modules/privilege/api_buygift.go | 63 +++++++++++++ modules/privilege/model_vip.go | 54 +++++++++++ modules/privilege/module.go | 1 + pb/errorcode.pb.go | 53 +++++++---- pb/privilege_db.pb.go | 133 +++++++++++++++++++++++++-- pb/privilege_msg.pb.go | 152 ++++++++++++++++++++++++++++--- 8 files changed, 419 insertions(+), 40 deletions(-) create mode 100644 modules/privilege/api_buygift.go create mode 100644 modules/privilege/model_vip.go diff --git a/comm/const.go b/comm/const.go index 312adb740..a16c17b18 100644 --- a/comm/const.go +++ b/comm/const.go @@ -201,6 +201,8 @@ const ( TableWorldtask = "worldtask" //关卡编辑 TableCombat = "combat" + /// vip + TableVip = "vip" ) //RPC服务接口定义处 diff --git a/modules/privilege/api.go b/modules/privilege/api.go index 070f697bb..3ab3224cf 100644 --- a/modules/privilege/api.go +++ b/modules/privilege/api.go @@ -9,6 +9,7 @@ import ( const ( PrivilegeGetListResp = "getlist" PrivilegeBuyYuekaResp = "buyyueka" + PrivilegeBuyGiftResp = "buygift" ) type apiComp struct { diff --git a/modules/privilege/api_buygift.go b/modules/privilege/api_buygift.go new file mode 100644 index 000000000..69657e27f --- /dev/null +++ b/modules/privilege/api_buygift.go @@ -0,0 +1,63 @@ +package privilege + +import ( + "go_dreamfactory/comm" + "go_dreamfactory/pb" + cfg "go_dreamfactory/sys/configure/structs" + + "google.golang.org/protobuf/proto" +) + +//参数校验 +func (this *apiComp) BuyGiftCheck(session comm.IUserSession, req *pb.PrivilegeBuyGiftReq) (code pb.ErrorCode) { + if req.VipLv == 0 { + code = pb.ErrorCode_ReqParameterError + } + + return +} + +///获取特权列表 +func (this *apiComp) BuyGift(session comm.IUserSession, req *pb.PrivilegeBuyGiftReq) (code pb.ErrorCode, data proto.Message) { + if code = this.BuyGiftCheck(session, req); code != pb.ErrorCode_Success { + return + } + + userinfo := this.module.ModuleUser.GetUser(session.GetUserId()) + if userinfo.Viplv == 0 || userinfo.Viplv < req.VipLv { + code = pb.ErrorCode_VipLvError // vip 等级不足 + return + } + conf := this.module.configure.GetVipConfigureData(req.VipLv) + if conf == nil { + code = pb.ErrorCode_ConfigNoFound + return + } + vip, err := this.module.modelVip.getVipList(session.GetUserId()) + if err != nil { + code = pb.ErrorCode_VipLvError // vip 等级不足 + return + } + if _, ok := vip.Reward[req.VipLv]; ok { + code = pb.ErrorCode_VipBuyRepeat // 礼包重复购买 + return + } + // 消耗检测 + if conf.PriceDiscount.N > 0 { + if code = this.module.ConsumeRes(session, []*cfg.Gameatn{conf.PriceDiscount}, true); code != pb.ErrorCode_Success { + return + } + } + // 加资源 + if code = this.module.DispenseRes(session, conf.Giftinfo, true); code != pb.ErrorCode_Success { + return + } + vip.Reward[req.VipLv] = true + update := map[string]interface{}{ + "reward": vip.Reward, + } + this.module.modelVip.modifyVipData(session.GetUserId(), update) + // 推送 + session.SendMsg(string(this.module.GetType()), PrivilegeBuyGiftResp, &pb.PrivilegeBuyGiftResp{Data: vip}) + return +} diff --git a/modules/privilege/model_vip.go b/modules/privilege/model_vip.go new file mode 100644 index 000000000..c3a2fcff1 --- /dev/null +++ b/modules/privilege/model_vip.go @@ -0,0 +1,54 @@ +package privilege + +import ( + "go_dreamfactory/comm" + "go_dreamfactory/lego/core" + "go_dreamfactory/lego/sys/mgo" + "go_dreamfactory/modules" + "go_dreamfactory/pb" + + "go.mongodb.org/mongo-driver/mongo" + "go.mongodb.org/mongo-driver/x/bsonx" +) + +type ModelVip struct { + modules.MCompModel + module *Privilege +} + +//组件初始化接口 +func (this *ModelVip) Init(service core.IService, module core.IModule, comp core.IModuleComp, opt core.IModuleOptions) (err error) { + this.MCompModel.Init(service, module, comp, opt) + this.module = module.(*Privilege) + this.TableName = comm.TableVip + //创建uid索引 + this.DB.CreateIndex(core.SqlTable(this.TableName), mongo.IndexModel{ + Keys: bsonx.Doc{{Key: "uid", Value: bsonx.Int32(1)}}, + }) + return +} + +// 获取vip信息 +func (this *ModelVip) getVipList(uid string) (vip *pb.DBVip, err error) { + vip = &pb.DBVip{} + if err = this.Get(uid, vip); err != nil && err != mgo.MongodbNil { + return + } + err = nil + return vip, err +} + +// 修改Vip信息 +func (this *ModelVip) modifyVipData(uid string, data map[string]interface{}) error { + return this.Change(uid, data) +} + +// 增加vip信息 +func (this *ModelVip) addVipData(uId string, vip *pb.DBVip) (err error) { + + if err = this.Add(uId, vip); err != nil { + this.module.Errorf("err:%v", err) + return err + } + return nil +} diff --git a/modules/privilege/module.go b/modules/privilege/module.go index 97b53f7c8..519ec0e79 100644 --- a/modules/privilege/module.go +++ b/modules/privilege/module.go @@ -25,6 +25,7 @@ type Privilege struct { modelPrivilege *ModelPrivilege mail comm.Imail service core.IService + modelVip *ModelVip } //模块名 diff --git a/pb/errorcode.pb.go b/pb/errorcode.pb.go index 1750a2bc0..912cc4c4c 100644 --- a/pb/errorcode.pb.go +++ b/pb/errorcode.pb.go @@ -261,6 +261,9 @@ const ( // privileges ErrorCode_PrivilegeNotFound ErrorCode = 3501 // 特权没激活 ErrorCode_PrivilegeRenewTime ErrorCode = 3502 // 特权续费时间没到 + ErrorCode_VipLvError ErrorCode = 3503 // Vip等级不足 + ErrorCode_VipGiftError ErrorCode = 3504 // Vip礼包购买失败 + ErrorCode_VipBuyRepeat ErrorCode = 3505 // Vip礼包重复购买 // growtask ErrorCode_GrowtaskReceive ErrorCode = 3601 //子任务奖励领取失败 ErrorCode_GrowtaskAdvReceive ErrorCode = 3602 //进阶奖励领取失败 @@ -494,6 +497,9 @@ var ( 3402: "HoroscopeRestCDNoEnd", 3501: "PrivilegeNotFound", 3502: "PrivilegeRenewTime", + 3503: "VipLvError", + 3504: "VipGiftError", + 3505: "VipBuyRepeat", 3601: "GrowtaskReceive", 3602: "GrowtaskAdvReceive", 3701: "PayBuyNumNotEnough", @@ -720,6 +726,9 @@ var ( "HoroscopeRestCDNoEnd": 3402, "PrivilegeNotFound": 3501, "PrivilegeRenewTime": 3502, + "VipLvError": 3503, + "VipGiftError": 3504, + "VipBuyRepeat": 3505, "GrowtaskReceive": 3601, "GrowtaskAdvReceive": 3602, "PayBuyNumNotEnough": 3701, @@ -765,7 +774,7 @@ var File_errorcode_proto protoreflect.FileDescriptor var file_errorcode_proto_rawDesc = []byte{ 0x0a, 0x0f, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x63, 0x6f, 0x64, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x2a, 0xfc, 0x27, 0x0a, 0x09, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x43, 0x6f, 0x64, 0x65, 0x12, + 0x6f, 0x2a, 0xb3, 0x28, 0x0a, 0x09, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x43, 0x6f, 0x64, 0x65, 0x12, 0x0b, 0x0a, 0x07, 0x53, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x10, 0x00, 0x12, 0x11, 0x0a, 0x0d, 0x4e, 0x6f, 0x46, 0x69, 0x6e, 0x64, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x10, 0x0a, 0x12, 0x1b, 0x0a, 0x17, 0x4e, 0x6f, 0x46, 0x69, 0x6e, 0x64, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, @@ -1067,25 +1076,29 @@ var file_errorcode_proto_rawDesc = []byte{ 0x44, 0x4e, 0x6f, 0x45, 0x6e, 0x64, 0x10, 0xca, 0x1a, 0x12, 0x16, 0x0a, 0x11, 0x50, 0x72, 0x69, 0x76, 0x69, 0x6c, 0x65, 0x67, 0x65, 0x4e, 0x6f, 0x74, 0x46, 0x6f, 0x75, 0x6e, 0x64, 0x10, 0xad, 0x1b, 0x12, 0x17, 0x0a, 0x12, 0x50, 0x72, 0x69, 0x76, 0x69, 0x6c, 0x65, 0x67, 0x65, 0x52, 0x65, - 0x6e, 0x65, 0x77, 0x54, 0x69, 0x6d, 0x65, 0x10, 0xae, 0x1b, 0x12, 0x14, 0x0a, 0x0f, 0x47, 0x72, - 0x6f, 0x77, 0x74, 0x61, 0x73, 0x6b, 0x52, 0x65, 0x63, 0x65, 0x69, 0x76, 0x65, 0x10, 0x91, 0x1c, - 0x12, 0x17, 0x0a, 0x12, 0x47, 0x72, 0x6f, 0x77, 0x74, 0x61, 0x73, 0x6b, 0x41, 0x64, 0x76, 0x52, - 0x65, 0x63, 0x65, 0x69, 0x76, 0x65, 0x10, 0x92, 0x1c, 0x12, 0x17, 0x0a, 0x12, 0x50, 0x61, 0x79, - 0x42, 0x75, 0x79, 0x4e, 0x75, 0x6d, 0x4e, 0x6f, 0x74, 0x45, 0x6e, 0x6f, 0x75, 0x67, 0x68, 0x10, - 0xf5, 0x1c, 0x12, 0x14, 0x0a, 0x0f, 0x50, 0x61, 0x79, 0x52, 0x65, 0x6e, 0x65, 0x77, 0x54, 0x69, - 0x6d, 0x65, 0x45, 0x72, 0x72, 0x10, 0xf6, 0x1c, 0x12, 0x14, 0x0a, 0x0f, 0x57, 0x6f, 0x72, 0x6c, - 0x64, 0x74, 0x61, 0x73, 0x6b, 0x46, 0x69, 0x6e, 0x69, 0x73, 0x68, 0x10, 0xd9, 0x1d, 0x12, 0x19, - 0x0a, 0x14, 0x57, 0x6f, 0x72, 0x6c, 0x64, 0x74, 0x61, 0x73, 0x6b, 0x4c, 0x76, 0x4e, 0x6f, 0x74, - 0x45, 0x6e, 0x6f, 0x75, 0x67, 0x68, 0x10, 0xda, 0x1d, 0x12, 0x16, 0x0a, 0x11, 0x57, 0x6f, 0x72, - 0x6c, 0x64, 0x74, 0x61, 0x73, 0x6b, 0x4e, 0x6f, 0x41, 0x63, 0x63, 0x65, 0x70, 0x74, 0x10, 0xdb, - 0x1d, 0x12, 0x18, 0x0a, 0x13, 0x57, 0x6f, 0x72, 0x6c, 0x64, 0x74, 0x61, 0x73, 0x6b, 0x4e, 0x6f, - 0x43, 0x6f, 0x6d, 0x70, 0x6c, 0x65, 0x74, 0x65, 0x10, 0xdc, 0x1d, 0x12, 0x15, 0x0a, 0x10, 0x57, - 0x6f, 0x72, 0x6c, 0x64, 0x74, 0x61, 0x73, 0x6b, 0x46, 0x69, 0x6e, 0x69, 0x68, 0x65, 0x64, 0x10, - 0xdd, 0x1d, 0x12, 0x1c, 0x0a, 0x17, 0x57, 0x6f, 0x72, 0x6c, 0x64, 0x74, 0x61, 0x73, 0x6b, 0x4c, - 0x61, 0x73, 0x74, 0x55, 0x6e, 0x46, 0x69, 0x6e, 0x69, 0x73, 0x68, 0x65, 0x64, 0x10, 0xde, 0x1d, - 0x12, 0x1e, 0x0a, 0x19, 0x41, 0x63, 0x61, 0x64, 0x65, 0x6d, 0x79, 0x54, 0x61, 0x73, 0x6b, 0x4e, - 0x6f, 0x43, 0x6f, 0x6d, 0x70, 0x6c, 0x65, 0x74, 0x65, 0x54, 0x61, 0x73, 0x6b, 0x10, 0xbd, 0x1e, - 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x6e, 0x65, 0x77, 0x54, 0x69, 0x6d, 0x65, 0x10, 0xae, 0x1b, 0x12, 0x0f, 0x0a, 0x0a, 0x56, 0x69, + 0x70, 0x4c, 0x76, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x10, 0xaf, 0x1b, 0x12, 0x11, 0x0a, 0x0c, 0x56, + 0x69, 0x70, 0x47, 0x69, 0x66, 0x74, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x10, 0xb0, 0x1b, 0x12, 0x11, + 0x0a, 0x0c, 0x56, 0x69, 0x70, 0x42, 0x75, 0x79, 0x52, 0x65, 0x70, 0x65, 0x61, 0x74, 0x10, 0xb1, + 0x1b, 0x12, 0x14, 0x0a, 0x0f, 0x47, 0x72, 0x6f, 0x77, 0x74, 0x61, 0x73, 0x6b, 0x52, 0x65, 0x63, + 0x65, 0x69, 0x76, 0x65, 0x10, 0x91, 0x1c, 0x12, 0x17, 0x0a, 0x12, 0x47, 0x72, 0x6f, 0x77, 0x74, + 0x61, 0x73, 0x6b, 0x41, 0x64, 0x76, 0x52, 0x65, 0x63, 0x65, 0x69, 0x76, 0x65, 0x10, 0x92, 0x1c, + 0x12, 0x17, 0x0a, 0x12, 0x50, 0x61, 0x79, 0x42, 0x75, 0x79, 0x4e, 0x75, 0x6d, 0x4e, 0x6f, 0x74, + 0x45, 0x6e, 0x6f, 0x75, 0x67, 0x68, 0x10, 0xf5, 0x1c, 0x12, 0x14, 0x0a, 0x0f, 0x50, 0x61, 0x79, + 0x52, 0x65, 0x6e, 0x65, 0x77, 0x54, 0x69, 0x6d, 0x65, 0x45, 0x72, 0x72, 0x10, 0xf6, 0x1c, 0x12, + 0x14, 0x0a, 0x0f, 0x57, 0x6f, 0x72, 0x6c, 0x64, 0x74, 0x61, 0x73, 0x6b, 0x46, 0x69, 0x6e, 0x69, + 0x73, 0x68, 0x10, 0xd9, 0x1d, 0x12, 0x19, 0x0a, 0x14, 0x57, 0x6f, 0x72, 0x6c, 0x64, 0x74, 0x61, + 0x73, 0x6b, 0x4c, 0x76, 0x4e, 0x6f, 0x74, 0x45, 0x6e, 0x6f, 0x75, 0x67, 0x68, 0x10, 0xda, 0x1d, + 0x12, 0x16, 0x0a, 0x11, 0x57, 0x6f, 0x72, 0x6c, 0x64, 0x74, 0x61, 0x73, 0x6b, 0x4e, 0x6f, 0x41, + 0x63, 0x63, 0x65, 0x70, 0x74, 0x10, 0xdb, 0x1d, 0x12, 0x18, 0x0a, 0x13, 0x57, 0x6f, 0x72, 0x6c, + 0x64, 0x74, 0x61, 0x73, 0x6b, 0x4e, 0x6f, 0x43, 0x6f, 0x6d, 0x70, 0x6c, 0x65, 0x74, 0x65, 0x10, + 0xdc, 0x1d, 0x12, 0x15, 0x0a, 0x10, 0x57, 0x6f, 0x72, 0x6c, 0x64, 0x74, 0x61, 0x73, 0x6b, 0x46, + 0x69, 0x6e, 0x69, 0x68, 0x65, 0x64, 0x10, 0xdd, 0x1d, 0x12, 0x1c, 0x0a, 0x17, 0x57, 0x6f, 0x72, + 0x6c, 0x64, 0x74, 0x61, 0x73, 0x6b, 0x4c, 0x61, 0x73, 0x74, 0x55, 0x6e, 0x46, 0x69, 0x6e, 0x69, + 0x73, 0x68, 0x65, 0x64, 0x10, 0xde, 0x1d, 0x12, 0x1e, 0x0a, 0x19, 0x41, 0x63, 0x61, 0x64, 0x65, + 0x6d, 0x79, 0x54, 0x61, 0x73, 0x6b, 0x4e, 0x6f, 0x43, 0x6f, 0x6d, 0x70, 0x6c, 0x65, 0x74, 0x65, + 0x54, 0x61, 0x73, 0x6b, 0x10, 0xbd, 0x1e, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, + 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/pb/privilege_db.pb.go b/pb/privilege_db.pb.go index 8a0e3de43..782ce1374 100644 --- a/pb/privilege_db.pb.go +++ b/pb/privilege_db.pb.go @@ -116,6 +116,93 @@ func (x *DBPrivilege) GetRewardTime() int64 { return 0 } +type DBVip struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id" bson:"_id"` //ID + Uid string `protobuf:"bytes,2,opt,name=uid,proto3" json:"uid" bson:"uid"` //用户ID + Reward map[int32]bool `protobuf:"bytes,3,rep,name=reward,proto3" json:"reward" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3"` + PrivilegeID []int32 `protobuf:"varint,4,rep,packed,name=privilegeID,proto3" json:"privilegeID" bson:"privilegeID"` //特权ID + CTime int64 `protobuf:"varint,5,opt,name=cTime,proto3" json:"cTime" bson:"cTime"` ////购买时间 + RewardTime int64 `protobuf:"varint,6,opt,name=rewardTime,proto3" json:"rewardTime" bson:"rewardTime"` //每日奖励时间 +} + +func (x *DBVip) Reset() { + *x = DBVip{} + if protoimpl.UnsafeEnabled { + mi := &file_privilege_privilege_db_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *DBVip) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DBVip) ProtoMessage() {} + +func (x *DBVip) ProtoReflect() protoreflect.Message { + mi := &file_privilege_privilege_db_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use DBVip.ProtoReflect.Descriptor instead. +func (*DBVip) Descriptor() ([]byte, []int) { + return file_privilege_privilege_db_proto_rawDescGZIP(), []int{1} +} + +func (x *DBVip) GetId() string { + if x != nil { + return x.Id + } + return "" +} + +func (x *DBVip) GetUid() string { + if x != nil { + return x.Uid + } + return "" +} + +func (x *DBVip) GetReward() map[int32]bool { + if x != nil { + return x.Reward + } + return nil +} + +func (x *DBVip) GetPrivilegeID() []int32 { + if x != nil { + return x.PrivilegeID + } + return nil +} + +func (x *DBVip) GetCTime() int64 { + if x != nil { + return x.CTime + } + return 0 +} + +func (x *DBVip) GetRewardTime() int64 { + if x != nil { + return x.RewardTime + } + return 0 +} + var File_privilege_privilege_db_proto protoreflect.FileDescriptor var file_privilege_privilege_db_proto_rawDesc = []byte{ @@ -132,7 +219,22 @@ var file_privilege_privilege_db_proto_rawDesc = []byte{ 0x69, 0x6d, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x65, 0x54, 0x69, 0x6d, 0x65, 0x12, 0x1e, 0x0a, 0x0a, 0x72, 0x65, 0x77, 0x61, 0x72, 0x64, 0x54, 0x69, 0x6d, 0x65, 0x18, 0x07, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0a, 0x72, 0x65, 0x77, 0x61, 0x72, 0x64, 0x54, 0x69, 0x6d, 0x65, - 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x22, 0xe8, 0x01, 0x0a, 0x05, 0x44, 0x42, 0x56, 0x69, 0x70, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x10, 0x0a, 0x03, 0x75, 0x69, + 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x75, 0x69, 0x64, 0x12, 0x2a, 0x0a, 0x06, + 0x72, 0x65, 0x77, 0x61, 0x72, 0x64, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x44, + 0x42, 0x56, 0x69, 0x70, 0x2e, 0x52, 0x65, 0x77, 0x61, 0x72, 0x64, 0x45, 0x6e, 0x74, 0x72, 0x79, + 0x52, 0x06, 0x72, 0x65, 0x77, 0x61, 0x72, 0x64, 0x12, 0x20, 0x0a, 0x0b, 0x70, 0x72, 0x69, 0x76, + 0x69, 0x6c, 0x65, 0x67, 0x65, 0x49, 0x44, 0x18, 0x04, 0x20, 0x03, 0x28, 0x05, 0x52, 0x0b, 0x70, + 0x72, 0x69, 0x76, 0x69, 0x6c, 0x65, 0x67, 0x65, 0x49, 0x44, 0x12, 0x14, 0x0a, 0x05, 0x63, 0x54, + 0x69, 0x6d, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x63, 0x54, 0x69, 0x6d, 0x65, + 0x12, 0x1e, 0x0a, 0x0a, 0x72, 0x65, 0x77, 0x61, 0x72, 0x64, 0x54, 0x69, 0x6d, 0x65, 0x18, 0x06, + 0x20, 0x01, 0x28, 0x03, 0x52, 0x0a, 0x72, 0x65, 0x77, 0x61, 0x72, 0x64, 0x54, 0x69, 0x6d, 0x65, + 0x1a, 0x39, 0x0a, 0x0b, 0x52, 0x65, 0x77, 0x61, 0x72, 0x64, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, + 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x03, 0x6b, 0x65, + 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, + 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x42, 0x06, 0x5a, 0x04, 0x2e, + 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -147,16 +249,19 @@ func file_privilege_privilege_db_proto_rawDescGZIP() []byte { return file_privilege_privilege_db_proto_rawDescData } -var file_privilege_privilege_db_proto_msgTypes = make([]protoimpl.MessageInfo, 1) +var file_privilege_privilege_db_proto_msgTypes = make([]protoimpl.MessageInfo, 3) var file_privilege_privilege_db_proto_goTypes = []interface{}{ (*DBPrivilege)(nil), // 0: DBPrivilege + (*DBVip)(nil), // 1: DBVip + nil, // 2: DBVip.RewardEntry } var file_privilege_privilege_db_proto_depIdxs = []int32{ - 0, // [0:0] is the sub-list for method output_type - 0, // [0:0] is the sub-list for method input_type - 0, // [0:0] is the sub-list for extension type_name - 0, // [0:0] is the sub-list for extension extendee - 0, // [0:0] is the sub-list for field type_name + 2, // 0: DBVip.reward:type_name -> DBVip.RewardEntry + 1, // [1:1] is the sub-list for method output_type + 1, // [1:1] is the sub-list for method input_type + 1, // [1:1] is the sub-list for extension type_name + 1, // [1:1] is the sub-list for extension extendee + 0, // [0:1] is the sub-list for field type_name } func init() { file_privilege_privilege_db_proto_init() } @@ -177,6 +282,18 @@ func file_privilege_privilege_db_proto_init() { return nil } } + file_privilege_privilege_db_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*DBVip); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } } type x struct{} out := protoimpl.TypeBuilder{ @@ -184,7 +301,7 @@ func file_privilege_privilege_db_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_privilege_privilege_db_proto_rawDesc, NumEnums: 0, - NumMessages: 1, + NumMessages: 3, NumExtensions: 0, NumServices: 0, }, diff --git a/pb/privilege_msg.pb.go b/pb/privilege_msg.pb.go index d59e5dc4d..5be9c600c 100644 --- a/pb/privilege_msg.pb.go +++ b/pb/privilege_msg.pb.go @@ -202,6 +202,100 @@ func (x *PrivilegeBuyYuekaResp) GetData() []*DBPrivilege { return nil } +type PrivilegeBuyGiftReq struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + VipLv int32 `protobuf:"varint,1,opt,name=vipLv,proto3" json:"vipLv"` // vip 等级 +} + +func (x *PrivilegeBuyGiftReq) Reset() { + *x = PrivilegeBuyGiftReq{} + if protoimpl.UnsafeEnabled { + mi := &file_privilege_privilege_msg_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *PrivilegeBuyGiftReq) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PrivilegeBuyGiftReq) ProtoMessage() {} + +func (x *PrivilegeBuyGiftReq) ProtoReflect() protoreflect.Message { + mi := &file_privilege_privilege_msg_proto_msgTypes[4] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use PrivilegeBuyGiftReq.ProtoReflect.Descriptor instead. +func (*PrivilegeBuyGiftReq) Descriptor() ([]byte, []int) { + return file_privilege_privilege_msg_proto_rawDescGZIP(), []int{4} +} + +func (x *PrivilegeBuyGiftReq) GetVipLv() int32 { + if x != nil { + return x.VipLv + } + return 0 +} + +type PrivilegeBuyGiftResp struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Data *DBVip `protobuf:"bytes,1,opt,name=data,proto3" json:"data"` +} + +func (x *PrivilegeBuyGiftResp) Reset() { + *x = PrivilegeBuyGiftResp{} + if protoimpl.UnsafeEnabled { + mi := &file_privilege_privilege_msg_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *PrivilegeBuyGiftResp) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PrivilegeBuyGiftResp) ProtoMessage() {} + +func (x *PrivilegeBuyGiftResp) ProtoReflect() protoreflect.Message { + mi := &file_privilege_privilege_msg_proto_msgTypes[5] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use PrivilegeBuyGiftResp.ProtoReflect.Descriptor instead. +func (*PrivilegeBuyGiftResp) Descriptor() ([]byte, []int) { + return file_privilege_privilege_msg_proto_rawDescGZIP(), []int{5} +} + +func (x *PrivilegeBuyGiftResp) GetData() *DBVip { + if x != nil { + return x.Data + } + return nil +} + var File_privilege_privilege_msg_proto protoreflect.FileDescriptor var file_privilege_privilege_msg_proto_rawDesc = []byte{ @@ -220,8 +314,14 @@ var file_privilege_privilege_msg_proto_rawDesc = []byte{ 0x69, 0x6c, 0x65, 0x67, 0x65, 0x42, 0x75, 0x79, 0x59, 0x75, 0x65, 0x6b, 0x61, 0x52, 0x65, 0x73, 0x70, 0x12, 0x20, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0c, 0x2e, 0x44, 0x42, 0x50, 0x72, 0x69, 0x76, 0x69, 0x6c, 0x65, 0x67, 0x65, 0x52, 0x04, 0x64, - 0x61, 0x74, 0x61, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x33, + 0x61, 0x74, 0x61, 0x22, 0x2b, 0x0a, 0x13, 0x50, 0x72, 0x69, 0x76, 0x69, 0x6c, 0x65, 0x67, 0x65, + 0x42, 0x75, 0x79, 0x47, 0x69, 0x66, 0x74, 0x52, 0x65, 0x71, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x69, + 0x70, 0x4c, 0x76, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x76, 0x69, 0x70, 0x4c, 0x76, + 0x22, 0x32, 0x0a, 0x14, 0x50, 0x72, 0x69, 0x76, 0x69, 0x6c, 0x65, 0x67, 0x65, 0x42, 0x75, 0x79, + 0x47, 0x69, 0x66, 0x74, 0x52, 0x65, 0x73, 0x70, 0x12, 0x1a, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x06, 0x2e, 0x44, 0x42, 0x56, 0x69, 0x70, 0x52, 0x04, + 0x64, 0x61, 0x74, 0x61, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -236,22 +336,26 @@ func file_privilege_privilege_msg_proto_rawDescGZIP() []byte { return file_privilege_privilege_msg_proto_rawDescData } -var file_privilege_privilege_msg_proto_msgTypes = make([]protoimpl.MessageInfo, 4) +var file_privilege_privilege_msg_proto_msgTypes = make([]protoimpl.MessageInfo, 6) var file_privilege_privilege_msg_proto_goTypes = []interface{}{ (*PrivilegeGetListReq)(nil), // 0: PrivilegeGetListReq (*PrivilegeGetListResp)(nil), // 1: PrivilegeGetListResp (*PrivilegeBuyYuekaReq)(nil), // 2: PrivilegeBuyYuekaReq (*PrivilegeBuyYuekaResp)(nil), // 3: PrivilegeBuyYuekaResp - (*DBPrivilege)(nil), // 4: DBPrivilege + (*PrivilegeBuyGiftReq)(nil), // 4: PrivilegeBuyGiftReq + (*PrivilegeBuyGiftResp)(nil), // 5: PrivilegeBuyGiftResp + (*DBPrivilege)(nil), // 6: DBPrivilege + (*DBVip)(nil), // 7: DBVip } var file_privilege_privilege_msg_proto_depIdxs = []int32{ - 4, // 0: PrivilegeGetListResp.data:type_name -> DBPrivilege - 4, // 1: PrivilegeBuyYuekaResp.data:type_name -> DBPrivilege - 2, // [2:2] is the sub-list for method output_type - 2, // [2:2] is the sub-list for method input_type - 2, // [2:2] is the sub-list for extension type_name - 2, // [2:2] is the sub-list for extension extendee - 0, // [0:2] is the sub-list for field type_name + 6, // 0: PrivilegeGetListResp.data:type_name -> DBPrivilege + 6, // 1: PrivilegeBuyYuekaResp.data:type_name -> DBPrivilege + 7, // 2: PrivilegeBuyGiftResp.data:type_name -> DBVip + 3, // [3:3] is the sub-list for method output_type + 3, // [3:3] is the sub-list for method input_type + 3, // [3:3] is the sub-list for extension type_name + 3, // [3:3] is the sub-list for extension extendee + 0, // [0:3] is the sub-list for field type_name } func init() { file_privilege_privilege_msg_proto_init() } @@ -309,6 +413,30 @@ func file_privilege_privilege_msg_proto_init() { return nil } } + file_privilege_privilege_msg_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*PrivilegeBuyGiftReq); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_privilege_privilege_msg_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*PrivilegeBuyGiftResp); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } } type x struct{} out := protoimpl.TypeBuilder{ @@ -316,7 +444,7 @@ func file_privilege_privilege_msg_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_privilege_privilege_msg_proto_rawDesc, NumEnums: 0, - NumMessages: 4, + NumMessages: 6, NumExtensions: 0, NumServices: 0, },