vip 特权

This commit is contained in:
meixiongfeng 2022-12-14 14:27:39 +08:00
parent 36b208f82c
commit 67385797e5
9 changed files with 2215 additions and 144 deletions

File diff suppressed because it is too large Load Diff

View File

@ -20,9 +20,9 @@
} }
], ],
"privilege_id": [ "privilege_id": [
10001, 10101,
10002, 10201,
10003 10301
] ]
}, },
{ {
@ -46,9 +46,9 @@
} }
], ],
"privilege_id": [ "privilege_id": [
10004, 10401,
10005, 10501,
10006 10601
] ]
}, },
{ {
@ -59,8 +59,6 @@
"renew_day": 0, "renew_day": 0,
"day_reward": [], "day_reward": [],
"disposable_reward": [], "disposable_reward": [],
"privilege_id": [ "privilege_id": []
10007
]
} }
] ]

View File

@ -70,7 +70,19 @@ func GetMonthStartEnd() (int64, int64) {
return _d1, _d2 return _d1, _d2
} }
func Test_Main(t *testing.T) { func Test_Main(t *testing.T) {
var list []int32
var list2 []int32
list = []int32{1, 2, 3, 4, 5, 6, 7, 8, 9}
list2 = []int32{4, 8, 9}
for _, v := range list2 {
for i, v1 := range list {
if v == v1 { // 找到了 就删除
//conf.PrivilegeId = append(conf.PrivilegeId, v1)
list = append(list[:i], list[i+1:]...)
break
}
}
}
ids := utils.RandomNumbers(0, 10, 5) ids := utils.RandomNumbers(0, 10, 5)
for _, v := range ids { for _, v := range ids {
fmt.Printf("%d", v) fmt.Printf("%d", v)

View File

@ -47,20 +47,15 @@ func (this *configureComp) GetPrivilegeCard(id string) (configure *cfg.GamePrivi
} }
// 获取指定特权配置 // 获取指定特权配置
func (this *configureComp) GetPrivilegeData(id int32) (result *cfg.GamePrivilegeData, err error) { func (this *configureComp) GetPrivilegeData(id int32) (result *cfg.GamePrivilegeData) {
var (
v interface{} if v, err := this.GetConfigure(game_privilege); err == nil {
ok bool
) if c, ok := v.(*cfg.GamePrivilege); ok {
if v, err = this.GetConfigure(game_privilege); err != nil { result = c.Get(id)
this.module.Errorf("err:%v", err)
return
} else {
if result, ok = v.(*cfg.GamePrivilege).GetDataMap()[id]; !ok {
err = fmt.Errorf("GamePrivilegeData not found:%d ", id)
this.module.Errorf("err:%v", err)
return return
} }
} }
return this.module.Errorf("GetPrivilegeData err, id:%d", id)
return nil
} }

View File

@ -33,11 +33,18 @@ func (this *ModelVip) Init(service core.IService, module core.IModule, comp core
// 获取vip信息 // 获取vip信息
func (this *ModelVip) getVipList(uid string) (vip *pb.DBVip, err error) { func (this *ModelVip) getVipList(uid string) (vip *pb.DBVip, err error) {
vip = &pb.DBVip{} vip = &pb.DBVip{}
if err = this.Get(uid, vip); err != nil && err != mgo.MongodbNil { if err = this.Get(uid, vip); err == mgo.MongodbNil { // 没有数据 直接创建一条
return
vip.Id = primitive.NewObjectID().Hex()
vip.CTime = configure.Now().Unix()
if err = this.Add(uid, vip); err != nil {
this.module.Errorf("err:%v", err)
return
}
err = nil
return vip, err
} }
err = nil return
return vip, err
} }
// 修改Vip信息 // 修改Vip信息

View File

@ -106,17 +106,36 @@ func (this *Privilege) CreatePrivilegeCard(session comm.IUserSession, cId string
if !bFind { if !bFind {
data := &pb.DBPrivilege{ data := &pb.DBPrivilege{
Id: primitive.NewObjectID().Hex(), Id: primitive.NewObjectID().Hex(),
Uid: session.GetUserId(), Uid: session.GetUserId(),
CId: cId, CId: cId,
PrivilegeID: []int32{},
CTime: configure.Now().Unix(), CTime: configure.Now().Unix(),
ETime: 0, ETime: 0,
RewardTime: configure.Now().Unix(), RewardTime: configure.Now().Unix(),
} }
data.ETime = configure.Now().Unix() + int64(conf.AssertDay*24*3600) // 设置过期时间 data.ETime = configure.Now().Unix() + int64(conf.AssertDay*24*3600) // 设置过期时间
for _, v := range conf.PrivilegeId {
data.PrivilegeID = append(data.PrivilegeID, v) // 特权插入
vip, err := this.modelVip.getVipList(session.GetUserId())
if err == nil {
update := map[string]interface{}{}
for _, v := range conf.PrivilegeId {
conf := this.configure.GetPrivilegeData(v)
if conf != nil {
if _, ok := vip.Privilege[conf.PrivilegeType]; ok {
vip.Privilege[conf.PrivilegeType].PrivilegeID = append(vip.Privilege[conf.PrivilegeType].PrivilegeID, v)
} else {
sz := &pb.PrivilegeData{}
sz.PrivilegeID = append(sz.PrivilegeID, v)
vip.Privilege[conf.PrivilegeType] = sz
}
}
}
update["privilege"] = vip.Privilege
this.modelVip.modifyVipData(session.GetUserId(), update)
} }
list = append(list, data) list = append(list, data)
this.modelPrivilege.addNewPrivilegeData(session.GetUserId(), data) this.modelPrivilege.addNewPrivilegeData(session.GetUserId(), data)
@ -189,21 +208,43 @@ func (this *Privilege) CheckPrivilege(session comm.IUserSession, cId string) (pr
// 查询特权信息,把过期的特权清除掉 // 查询特权信息,把过期的特权清除掉
func (this *Privilege) QueryPrivilege(session comm.IUserSession) (privilegeID []int32) { func (this *Privilege) QueryPrivilege(session comm.IUserSession) (privilegeID []int32) {
privilgeList, err := this.modelVip.getVipList(session.GetUserId())
if err != nil {
return
}
list, err := this.modelPrivilege.getPrivilegeList(session.GetUserId()) list, err := this.modelPrivilege.getPrivilegeList(session.GetUserId())
if err != nil { if err != nil {
return return
} }
for _, v := range list { for _, v := range list {
conf, err := this.configure.GetPrivilegeCard(v.CId)
if err != nil {
return nil
}
if v.ETime < configure.Now().Unix() { // 判断当前特权是否过期 if v.ETime < configure.Now().Unix() { // 判断当前特权是否过期
if err := this.modelPrivilege.DelListlds(session.GetUserId(), v.Id); err != nil { if err := this.modelPrivilege.DelListlds(session.GetUserId(), v.Id); err != nil {
this.Errorf("delete privilege failed:%v", err) this.Errorf("delete privilege failed:%v", err)
} }
} else { update := map[string]interface{}{}
conf, err := this.configure.GetPrivilegeCard(v.CId) for _, id := range conf.PrivilegeId { // 找到过期的特权 并删除
if err != nil { data := this.configure.GetPrivilegeData(id)
return nil if data != nil {
if v, ok := privilgeList.Privilege[data.PrivilegeType]; ok {
for i, v1 := range v.PrivilegeID {
if v1 == id { // 找到了 就删除
v.PrivilegeID = append(v.PrivilegeID[:i], v.PrivilegeID[i+1:]...)
break
}
}
}
}
} }
privilegeID = append(privilegeID, v.PrivilegeID...) update["privilege"] = privilgeList.Privilege
this.modelVip.modifyVipData(session.GetUserId(), update) // 更新数据
} else {
// 检查 每日奖励是否发放 // 检查 每日奖励是否发放
if !utils.IsToday(v.RewardTime) { if !utils.IsToday(v.RewardTime) {
v.RewardTime = configure.Now().Unix() v.RewardTime = configure.Now().Unix()

View File

@ -26,13 +26,13 @@ type DBPrivilege struct {
sizeCache protoimpl.SizeCache sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields unknownFields protoimpl.UnknownFields
Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id" bson:"_id"` //ID 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 Uid string `protobuf:"bytes,2,opt,name=uid,proto3" json:"uid" bson:"uid"` //用户ID
CId string `protobuf:"bytes,3,opt,name=cId,proto3" json:"cId" bson:"cId"` //计费点数ID CId string `protobuf:"bytes,3,opt,name=cId,proto3" json:"cId" bson:"cId"` //计费点数ID
PrivilegeID []int32 `protobuf:"varint,4,rep,packed,name=privilegeID,proto3" json:"privilegeID" bson:"privilegeID"` //特权ID // repeated int32 privilegeID = 4; //@go_tags(`bson:"privilegeID"`) 特权ID
CTime int64 `protobuf:"varint,5,opt,name=cTime,proto3" json:"cTime" bson:"cTime"` ////购买时间 CTime int64 `protobuf:"varint,4,opt,name=cTime,proto3" json:"cTime" bson:"cTime"` ////购买时间
ETime int64 `protobuf:"varint,6,opt,name=eTime,proto3" json:"eTime" bson:"eTime"` ////到期时间 ETime int64 `protobuf:"varint,5,opt,name=eTime,proto3" json:"eTime" bson:"eTime"` ////到期时间
RewardTime int64 `protobuf:"varint,7,opt,name=rewardTime,proto3" json:"rewardTime" bson:"rewardTime"` //每日奖励时间 RewardTime int64 `protobuf:"varint,6,opt,name=rewardTime,proto3" json:"rewardTime" bson:"rewardTime"` //每日奖励时间
} }
func (x *DBPrivilege) Reset() { func (x *DBPrivilege) Reset() {
@ -88,13 +88,6 @@ func (x *DBPrivilege) GetCId() string {
return "" return ""
} }
func (x *DBPrivilege) GetPrivilegeID() []int32 {
if x != nil {
return x.PrivilegeID
}
return nil
}
func (x *DBPrivilege) GetCTime() int64 { func (x *DBPrivilege) GetCTime() int64 {
if x != nil { if x != nil {
return x.CTime return x.CTime
@ -116,23 +109,70 @@ func (x *DBPrivilege) GetRewardTime() int64 {
return 0 return 0
} }
type PrivilegeData struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
PrivilegeID []int32 `protobuf:"varint,1,rep,packed,name=privilegeID,proto3" json:"privilegeID" bson:"privilegeID"` //特权ID
}
func (x *PrivilegeData) Reset() {
*x = PrivilegeData{}
if protoimpl.UnsafeEnabled {
mi := &file_privilege_privilege_db_proto_msgTypes[1]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *PrivilegeData) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*PrivilegeData) ProtoMessage() {}
func (x *PrivilegeData) 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 PrivilegeData.ProtoReflect.Descriptor instead.
func (*PrivilegeData) Descriptor() ([]byte, []int) {
return file_privilege_privilege_db_proto_rawDescGZIP(), []int{1}
}
func (x *PrivilegeData) GetPrivilegeID() []int32 {
if x != nil {
return x.PrivilegeID
}
return nil
}
type DBVip struct { type DBVip struct {
state protoimpl.MessageState state protoimpl.MessageState
sizeCache protoimpl.SizeCache sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields unknownFields protoimpl.UnknownFields
Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id" bson:"_id"` //ID 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 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"` 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"` // key vip 等级
PrivilegeID []int32 `protobuf:"varint,4,rep,packed,name=privilegeID,proto3" json:"privilegeID" bson:"privilegeID"` //特权ID Privilege map[int32]*PrivilegeData `protobuf:"bytes,4,rep,name=privilege,proto3" json:"privilege" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3" bson:"privilege"` //特权ID
CTime int64 `protobuf:"varint,5,opt,name=cTime,proto3" json:"cTime" bson:"cTime"` ////购买时间 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"` //每日奖励时间 RewardTime int64 `protobuf:"varint,6,opt,name=rewardTime,proto3" json:"rewardTime" bson:"rewardTime"` //每日奖励时间
} }
func (x *DBVip) Reset() { func (x *DBVip) Reset() {
*x = DBVip{} *x = DBVip{}
if protoimpl.UnsafeEnabled { if protoimpl.UnsafeEnabled {
mi := &file_privilege_privilege_db_proto_msgTypes[1] mi := &file_privilege_privilege_db_proto_msgTypes[2]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi) ms.StoreMessageInfo(mi)
} }
@ -145,7 +185,7 @@ func (x *DBVip) String() string {
func (*DBVip) ProtoMessage() {} func (*DBVip) ProtoMessage() {}
func (x *DBVip) ProtoReflect() protoreflect.Message { func (x *DBVip) ProtoReflect() protoreflect.Message {
mi := &file_privilege_privilege_db_proto_msgTypes[1] mi := &file_privilege_privilege_db_proto_msgTypes[2]
if protoimpl.UnsafeEnabled && x != nil { if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil { if ms.LoadMessageInfo() == nil {
@ -158,7 +198,7 @@ func (x *DBVip) ProtoReflect() protoreflect.Message {
// Deprecated: Use DBVip.ProtoReflect.Descriptor instead. // Deprecated: Use DBVip.ProtoReflect.Descriptor instead.
func (*DBVip) Descriptor() ([]byte, []int) { func (*DBVip) Descriptor() ([]byte, []int) {
return file_privilege_privilege_db_proto_rawDescGZIP(), []int{1} return file_privilege_privilege_db_proto_rawDescGZIP(), []int{2}
} }
func (x *DBVip) GetId() string { func (x *DBVip) GetId() string {
@ -182,9 +222,9 @@ func (x *DBVip) GetReward() map[int32]bool {
return nil return nil
} }
func (x *DBVip) GetPrivilegeID() []int32 { func (x *DBVip) GetPrivilege() map[int32]*PrivilegeData {
if x != nil { if x != nil {
return x.PrivilegeID return x.Privilege
} }
return nil return nil
} }
@ -207,34 +247,41 @@ var File_privilege_privilege_db_proto protoreflect.FileDescriptor
var file_privilege_privilege_db_proto_rawDesc = []byte{ var file_privilege_privilege_db_proto_rawDesc = []byte{
0x0a, 0x1c, 0x70, 0x72, 0x69, 0x76, 0x69, 0x6c, 0x65, 0x67, 0x65, 0x2f, 0x70, 0x72, 0x69, 0x76, 0x0a, 0x1c, 0x70, 0x72, 0x69, 0x76, 0x69, 0x6c, 0x65, 0x67, 0x65, 0x2f, 0x70, 0x72, 0x69, 0x76,
0x69, 0x6c, 0x65, 0x67, 0x65, 0x5f, 0x64, 0x62, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xaf, 0x69, 0x6c, 0x65, 0x67, 0x65, 0x5f, 0x64, 0x62, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x8d,
0x01, 0x0a, 0x0b, 0x44, 0x42, 0x50, 0x72, 0x69, 0x76, 0x69, 0x6c, 0x65, 0x67, 0x65, 0x12, 0x0e, 0x01, 0x0a, 0x0b, 0x44, 0x42, 0x50, 0x72, 0x69, 0x76, 0x69, 0x6c, 0x65, 0x67, 0x65, 0x12, 0x0e,
0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x10, 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, 0x0a, 0x03, 0x75, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x75, 0x69, 0x64,
0x12, 0x10, 0x0a, 0x03, 0x63, 0x49, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x63, 0x12, 0x10, 0x0a, 0x03, 0x63, 0x49, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x63,
0x49, 0x64, 0x12, 0x20, 0x0a, 0x0b, 0x70, 0x72, 0x69, 0x76, 0x69, 0x6c, 0x65, 0x67, 0x65, 0x49, 0x49, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x63, 0x54, 0x69, 0x6d, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28,
0x44, 0x18, 0x04, 0x20, 0x03, 0x28, 0x05, 0x52, 0x0b, 0x70, 0x72, 0x69, 0x76, 0x69, 0x6c, 0x65, 0x03, 0x52, 0x05, 0x63, 0x54, 0x69, 0x6d, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x65, 0x54, 0x69, 0x6d,
0x67, 0x65, 0x49, 0x44, 0x12, 0x14, 0x0a, 0x05, 0x63, 0x54, 0x69, 0x6d, 0x65, 0x18, 0x05, 0x20, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x65, 0x54, 0x69, 0x6d, 0x65, 0x12, 0x1e,
0x01, 0x28, 0x03, 0x52, 0x05, 0x63, 0x54, 0x69, 0x6d, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x65, 0x54, 0x0a, 0x0a, 0x72, 0x65, 0x77, 0x61, 0x72, 0x64, 0x54, 0x69, 0x6d, 0x65, 0x18, 0x06, 0x20, 0x01,
0x69, 0x6d, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x65, 0x54, 0x69, 0x6d, 0x65, 0x28, 0x03, 0x52, 0x0a, 0x72, 0x65, 0x77, 0x61, 0x72, 0x64, 0x54, 0x69, 0x6d, 0x65, 0x22, 0x31,
0x12, 0x1e, 0x0a, 0x0a, 0x72, 0x65, 0x77, 0x61, 0x72, 0x64, 0x54, 0x69, 0x6d, 0x65, 0x18, 0x07, 0x0a, 0x0d, 0x50, 0x72, 0x69, 0x76, 0x69, 0x6c, 0x65, 0x67, 0x65, 0x44, 0x61, 0x74, 0x61, 0x12,
0x20, 0x01, 0x28, 0x03, 0x52, 0x0a, 0x72, 0x65, 0x77, 0x61, 0x72, 0x64, 0x54, 0x69, 0x6d, 0x65, 0x20, 0x0a, 0x0b, 0x70, 0x72, 0x69, 0x76, 0x69, 0x6c, 0x65, 0x67, 0x65, 0x49, 0x44, 0x18, 0x01,
0x22, 0xe8, 0x01, 0x0a, 0x05, 0x44, 0x42, 0x56, 0x69, 0x70, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x20, 0x03, 0x28, 0x05, 0x52, 0x0b, 0x70, 0x72, 0x69, 0x76, 0x69, 0x6c, 0x65, 0x67, 0x65, 0x49,
0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x10, 0x0a, 0x03, 0x75, 0x69, 0x44, 0x22, 0xc9, 0x02, 0x0a, 0x05, 0x44, 0x42, 0x56, 0x69, 0x70, 0x12, 0x0e, 0x0a, 0x02, 0x69,
0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x75, 0x69, 0x64, 0x12, 0x2a, 0x0a, 0x06, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x10, 0x0a, 0x03, 0x75,
0x72, 0x65, 0x77, 0x61, 0x72, 0x64, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x44, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x75, 0x69, 0x64, 0x12, 0x2a, 0x0a,
0x42, 0x56, 0x69, 0x70, 0x2e, 0x52, 0x65, 0x77, 0x61, 0x72, 0x64, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x06, 0x72, 0x65, 0x77, 0x61, 0x72, 0x64, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x12, 0x2e,
0x52, 0x06, 0x72, 0x65, 0x77, 0x61, 0x72, 0x64, 0x12, 0x20, 0x0a, 0x0b, 0x70, 0x72, 0x69, 0x76, 0x44, 0x42, 0x56, 0x69, 0x70, 0x2e, 0x52, 0x65, 0x77, 0x61, 0x72, 0x64, 0x45, 0x6e, 0x74, 0x72,
0x69, 0x6c, 0x65, 0x67, 0x65, 0x49, 0x44, 0x18, 0x04, 0x20, 0x03, 0x28, 0x05, 0x52, 0x0b, 0x70, 0x79, 0x52, 0x06, 0x72, 0x65, 0x77, 0x61, 0x72, 0x64, 0x12, 0x33, 0x0a, 0x09, 0x70, 0x72, 0x69,
0x72, 0x69, 0x76, 0x69, 0x6c, 0x65, 0x67, 0x65, 0x49, 0x44, 0x12, 0x14, 0x0a, 0x05, 0x63, 0x54, 0x76, 0x69, 0x6c, 0x65, 0x67, 0x65, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x44,
0x69, 0x6d, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x63, 0x54, 0x69, 0x6d, 0x65, 0x42, 0x56, 0x69, 0x70, 0x2e, 0x50, 0x72, 0x69, 0x76, 0x69, 0x6c, 0x65, 0x67, 0x65, 0x45, 0x6e,
0x12, 0x1e, 0x0a, 0x0a, 0x72, 0x65, 0x77, 0x61, 0x72, 0x64, 0x54, 0x69, 0x6d, 0x65, 0x18, 0x06, 0x74, 0x72, 0x79, 0x52, 0x09, 0x70, 0x72, 0x69, 0x76, 0x69, 0x6c, 0x65, 0x67, 0x65, 0x12, 0x14,
0x20, 0x01, 0x28, 0x03, 0x52, 0x0a, 0x72, 0x65, 0x77, 0x61, 0x72, 0x64, 0x54, 0x69, 0x6d, 0x65, 0x0a, 0x05, 0x63, 0x54, 0x69, 0x6d, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x63,
0x1a, 0x39, 0x0a, 0x0b, 0x52, 0x65, 0x77, 0x61, 0x72, 0x64, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x54, 0x69, 0x6d, 0x65, 0x12, 0x1e, 0x0a, 0x0a, 0x72, 0x65, 0x77, 0x61, 0x72, 0x64, 0x54, 0x69,
0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x03, 0x6b, 0x65, 0x6d, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0a, 0x72, 0x65, 0x77, 0x61, 0x72, 0x64,
0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x54, 0x69, 0x6d, 0x65, 0x1a, 0x39, 0x0a, 0x0b, 0x52, 0x65, 0x77, 0x61, 0x72, 0x64, 0x45, 0x6e,
0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05,
0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, 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, 0x1a,
0x4c, 0x0a, 0x0e, 0x50, 0x72, 0x69, 0x76, 0x69, 0x6c, 0x65, 0x67, 0x65, 0x45, 0x6e, 0x74, 0x72,
0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x03,
0x6b, 0x65, 0x79, 0x12, 0x24, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01,
0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x50, 0x72, 0x69, 0x76, 0x69, 0x6c, 0x65, 0x67, 0x65, 0x44, 0x61,
0x74, 0x61, 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 ( var (
@ -249,19 +296,23 @@ func file_privilege_privilege_db_proto_rawDescGZIP() []byte {
return file_privilege_privilege_db_proto_rawDescData return file_privilege_privilege_db_proto_rawDescData
} }
var file_privilege_privilege_db_proto_msgTypes = make([]protoimpl.MessageInfo, 3) var file_privilege_privilege_db_proto_msgTypes = make([]protoimpl.MessageInfo, 5)
var file_privilege_privilege_db_proto_goTypes = []interface{}{ var file_privilege_privilege_db_proto_goTypes = []interface{}{
(*DBPrivilege)(nil), // 0: DBPrivilege (*DBPrivilege)(nil), // 0: DBPrivilege
(*DBVip)(nil), // 1: DBVip (*PrivilegeData)(nil), // 1: PrivilegeData
nil, // 2: DBVip.RewardEntry (*DBVip)(nil), // 2: DBVip
nil, // 3: DBVip.RewardEntry
nil, // 4: DBVip.PrivilegeEntry
} }
var file_privilege_privilege_db_proto_depIdxs = []int32{ var file_privilege_privilege_db_proto_depIdxs = []int32{
2, // 0: DBVip.reward:type_name -> DBVip.RewardEntry 3, // 0: DBVip.reward:type_name -> DBVip.RewardEntry
1, // [1:1] is the sub-list for method output_type 4, // 1: DBVip.privilege:type_name -> DBVip.PrivilegeEntry
1, // [1:1] is the sub-list for method input_type 1, // 2: DBVip.PrivilegeEntry.value:type_name -> PrivilegeData
1, // [1:1] is the sub-list for extension type_name 3, // [3:3] is the sub-list for method output_type
1, // [1:1] is the sub-list for extension extendee 3, // [3:3] is the sub-list for method input_type
0, // [0:1] is the sub-list for field type_name 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_db_proto_init() } func init() { file_privilege_privilege_db_proto_init() }
@ -283,6 +334,18 @@ func file_privilege_privilege_db_proto_init() {
} }
} }
file_privilege_privilege_db_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { file_privilege_privilege_db_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*PrivilegeData); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_privilege_privilege_db_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*DBVip); i { switch v := v.(*DBVip); i {
case 0: case 0:
return &v.state return &v.state
@ -301,7 +364,7 @@ func file_privilege_privilege_db_proto_init() {
GoPackagePath: reflect.TypeOf(x{}).PkgPath(), GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_privilege_privilege_db_proto_rawDesc, RawDescriptor: file_privilege_privilege_db_proto_rawDesc,
NumEnums: 0, NumEnums: 0,
NumMessages: 3, NumMessages: 5,
NumExtensions: 0, NumExtensions: 0,
NumServices: 0, NumServices: 0,
}, },

View File

@ -63,7 +63,7 @@ func Dispose(ctx context.Context, concurrency, totalNumber uint64, request *mode
// 并发建立长链接 // 并发建立长链接
go func(i uint64) { go func(i uint64) {
r := robot.NewRobot(request.URL) r := robot.NewRobot(request.URL)
r.SetAccount("c71112" + strconv.Itoa(int(i))) r.SetAccount("d71112" + strconv.Itoa(int(i)))
//head := &pb.UserMessage{MainType: "user", SubType: "login"} //head := &pb.UserMessage{MainType: "user", SubType: "login"}
// 先登录 // 先登录

View File

@ -12,8 +12,10 @@ import "errors"
type GamePrivilegeData struct { type GamePrivilegeData struct {
PrivilegeId int32 PrivilegeId int32
PrivilegeType int32
PrivilegeDescribeFront string PrivilegeDescribeFront string
PrivilegeDescribeAfter string PrivilegeDescribeAfter string
PrivilegeParameter int32
} }
const TypeId_GamePrivilegeData = 40320255 const TypeId_GamePrivilegeData = 40320255
@ -24,8 +26,10 @@ func (*GamePrivilegeData) GetTypeId() int32 {
func (_v *GamePrivilegeData)Deserialize(_buf map[string]interface{}) (err error) { func (_v *GamePrivilegeData)Deserialize(_buf map[string]interface{}) (err error) {
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["privilege_id"].(float64); !_ok_ { err = errors.New("privilege_id error"); return }; _v.PrivilegeId = int32(_tempNum_) } { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["privilege_id"].(float64); !_ok_ { err = errors.New("privilege_id error"); return }; _v.PrivilegeId = int32(_tempNum_) }
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["privilege_type"].(float64); !_ok_ { err = errors.New("privilege_type error"); return }; _v.PrivilegeType = int32(_tempNum_) }
{var _ok_ bool; var __json_text__ map[string]interface{}; if __json_text__, _ok_ = _buf["privilege_DescribeFront"].(map[string]interface{}) ; !_ok_ { err = errors.New("_v.PrivilegeDescribeFront error"); return }; { var _ok_ bool; if _, _ok_ = __json_text__["key"].(string); !_ok_ { err = errors.New("key error"); return } }; { var _ok_ bool; if _v.PrivilegeDescribeFront, _ok_ = __json_text__["text"].(string); !_ok_ { err = errors.New("text error"); return } } } {var _ok_ bool; var __json_text__ map[string]interface{}; if __json_text__, _ok_ = _buf["privilege_DescribeFront"].(map[string]interface{}) ; !_ok_ { err = errors.New("_v.PrivilegeDescribeFront error"); return }; { var _ok_ bool; if _, _ok_ = __json_text__["key"].(string); !_ok_ { err = errors.New("key error"); return } }; { var _ok_ bool; if _v.PrivilegeDescribeFront, _ok_ = __json_text__["text"].(string); !_ok_ { err = errors.New("text error"); return } } }
{var _ok_ bool; var __json_text__ map[string]interface{}; if __json_text__, _ok_ = _buf["privilege_DescribeAfter"].(map[string]interface{}) ; !_ok_ { err = errors.New("_v.PrivilegeDescribeAfter error"); return }; { var _ok_ bool; if _, _ok_ = __json_text__["key"].(string); !_ok_ { err = errors.New("key error"); return } }; { var _ok_ bool; if _v.PrivilegeDescribeAfter, _ok_ = __json_text__["text"].(string); !_ok_ { err = errors.New("text error"); return } } } {var _ok_ bool; var __json_text__ map[string]interface{}; if __json_text__, _ok_ = _buf["privilege_DescribeAfter"].(map[string]interface{}) ; !_ok_ { err = errors.New("_v.PrivilegeDescribeAfter error"); return }; { var _ok_ bool; if _, _ok_ = __json_text__["key"].(string); !_ok_ { err = errors.New("key error"); return } }; { var _ok_ bool; if _v.PrivilegeDescribeAfter, _ok_ = __json_text__["text"].(string); !_ok_ { err = errors.New("text error"); return } } }
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["privilege_parameter"].(float64); !_ok_ { err = errors.New("privilege_parameter error"); return }; _v.PrivilegeParameter = int32(_tempNum_) }
return return
} }