好友推荐优化

This commit is contained in:
liwei1dao 2023-12-20 14:11:12 +08:00
parent b35a40ceff
commit a9c63d7fa5
13 changed files with 419 additions and 257 deletions

View File

@ -178,12 +178,12 @@ type (
GetUserExpand(uid string) (result *pb.DBUserExpand, err error) GetUserExpand(uid string) (result *pb.DBUserExpand, err error)
//更新用户expand //更新用户expand
ChangeUserExpand(uid string, value map[string]interface{}) error ChangeUserExpand(uid string, value map[string]interface{}) error
// 本服在线玩家列表 //本服在线玩家列表
UserOnlineList() ([]*pb.CacheUser, error) UserOnlineList() ([]*pb.CacheUser, error)
//随机获取在线列表
UserRandOnlineList(num int32) ([]*pb.CacheUser, error)
//是否在线 //是否在线
IsOnline(uid string) bool IsOnline(uid string) bool
// 跨服在线玩家列表
CrossUserOnlineList() ([]*pb.CacheUser, error)
// 跨服用户会话 // 跨服用户会话
CrossUserSession(uid string) *pb.CacheUser CrossUserSession(uid string) *pb.CacheUser
// 跨服搜索玩家 // 跨服搜索玩家

View File

@ -138,6 +138,11 @@ func (this *MCompModel) GetList(uid string, data interface{}) (err error) {
return this.DBModel.GetList(uid, data) return this.DBModel.GetList(uid, data)
} }
// 获取列表数据 注意 data 必须是 切片的指针 *[]type
func (this *MCompModel) RandGetList(uid string, num int32, data interface{}) (err error) {
return this.DBModel.RandGetList(uid, num, data)
}
// 查询队列信息 // 查询队列信息
func (this *MCompModel) GetQueues(key string, count int, data interface{}) (err error) { func (this *MCompModel) GetQueues(key string, count int, data interface{}) (err error) {
return this.DBModel.GetQueues(key, count, data) return this.DBModel.GetQueues(key, count, data)

View File

@ -14,9 +14,18 @@ func (this *apiComp) RandlistCheck(session comm.IUserSession, req *pb.FriendRand
} }
func (this *apiComp) Randlist(session comm.IUserSession, req *pb.FriendRandlistReq) (errdata *pb.ErrorData) { func (this *apiComp) Randlist(session comm.IUserSession, req *pb.FriendRandlistReq) (errdata *pb.ErrorData) {
var (
self *pb.DBFriend
onlines []*pb.CacheUser
userids []string = make([]string, 0)
friends []*pb.DBFriend
target *pb.DBFriend
friendMaps map[string]*pb.DBFriend = make(map[string]*pb.DBFriend)
err error
ok bool
)
// 当前玩家好友数据 // 当前玩家好友数据
self, err := this.module.modelFriend.GetFriend(session.GetUserId()) self, err = this.module.modelFriend.GetFriend(session.GetUserId())
if err != nil { if err != nil {
errdata = &pb.ErrorData{ errdata = &pb.ErrorData{
Code: pb.ErrorCode_FriendSelfNoData, Code: pb.ErrorCode_FriendSelfNoData,
@ -26,7 +35,7 @@ func (this *apiComp) Randlist(session comm.IUserSession, req *pb.FriendRandlistR
} }
//在线玩家列表 //在线玩家列表
cuList, err := this.module.ModuleUser.UserOnlineList() onlines, err = this.module.ModuleUser.UserRandOnlineList(10)
if err != nil { if err != nil {
errdata = &pb.ErrorData{ errdata = &pb.ErrorData{
Code: pb.ErrorCode_DBError, Code: pb.ErrorCode_DBError,
@ -35,11 +44,25 @@ func (this *apiComp) Randlist(session comm.IUserSession, req *pb.FriendRandlistR
} }
return return
} }
for _, v := range onlines {
userids = append(userids, v.Uid)
}
//检查目标v中的申请列表中是否有自己
friends, err = this.module.modelFriend.GetFriends(userids)
if err != nil {
errdata = &pb.ErrorData{
Code: pb.ErrorCode_FriendSelfNoData,
Title: pb.ErrorCode_FriendSelfNoData.ToString(),
}
return
}
for _, v := range friends {
friendMaps[v.Uid] = v
}
recommend := 5 //推荐数量
//过滤 //过滤
var newList []*pb.CacheUser var newList []*pb.DBFriend
for _, v := range cuList { for _, v := range onlines {
// 将自己从在线玩家中过滤掉 // 将自己从在线玩家中过滤掉
if v.Uid == session.GetUserId() { if v.Uid == session.GetUserId() {
continue continue
@ -49,54 +72,32 @@ func (this *apiComp) Randlist(session comm.IUserSession, req *pb.FriendRandlistR
continue continue
} }
//检查目标v中的申请列表中是否有自己 if target, ok = friendMaps[v.Uid]; !ok {
target, err := this.module.modelFriend.GetFriend(v.Uid) continue
if err != nil { } else {
errdata = &pb.ErrorData{
Code: pb.ErrorCode_FriendSelfNoData,
Title: pb.ErrorCode_FriendSelfNoData.ToString(),
}
return
}
if _, ok := utils.Findx(target.ApplyIds, self.Uid); ok { if _, ok := utils.Findx(target.ApplyIds, self.Uid); ok {
continue continue
} }
}
//将黑名单中的玩家过滤 //将黑名单中的玩家过滤
if _, ok := utils.Findx(self.BlackIds, v.Uid); ok { if _, ok := utils.Findx(self.BlackIds, v.Uid); ok {
continue continue
} }
newList = append(newList, v) newList = append(newList, target)
} }
var randOnlineUsers []string userList := make([]*pb.FriendBase, 0)
if len(newList) > recommend { for _, user := range newList {
randArr := utils.RandomNumbers(0, len(newList), recommend) base := &pb.FriendBase{
for _, v := range randArr { ServerId: user.Info.Sid,
if newList[v] != nil { UserId: user.Uid,
randOnlineUsers = append(randOnlineUsers, newList[v].Uid) NickName: user.Info.Name,
Level: user.Info.Lv,
Skin: user.Info.Skin,
Gender: user.Info.Gender,
} }
}
} else {
for _, v := range newList {
if v.Uid != "" {
randOnlineUsers = append(randOnlineUsers, v.Uid)
}
}
}
var userList []*pb.FriendBase
for _, uid := range randOnlineUsers {
target, err := this.module.modelFriend.GetFriend(uid)
if err != nil {
this.module.Debug("未找到好友",
log.Field{Key: "uid", Value: uid})
continue
}
base := this.setDefaultFriendUserBaseInfo(uid)
if base == nil { if base == nil {
this.module.Debug("未找到玩家信息", this.module.Debug("未找到玩家信息",
log.Field{Key: "uid", Value: uid}) log.Field{Key: "uid", Value: user.Uid})
continue continue
} }
@ -106,7 +107,6 @@ func (this *apiComp) Randlist(session comm.IUserSession, req *pb.FriendRandlistR
} else { } else {
userList = append(userList, base) userList = append(userList, base)
} }
} }
rsp := &pb.FriendRandlistResp{ rsp := &pb.FriendRandlistResp{

View File

@ -3,11 +3,11 @@ package friend
import ( import (
"go_dreamfactory/comm" "go_dreamfactory/comm"
"go_dreamfactory/lego/core" "go_dreamfactory/lego/core"
"go_dreamfactory/lego/sys/redis" "go_dreamfactory/lego/sys/mgo"
"go_dreamfactory/modules" "go_dreamfactory/modules"
"go_dreamfactory/pb" "go_dreamfactory/pb"
"go_dreamfactory/sys/db"
"go.mongodb.org/mongo-driver/bson/primitive"
"go.mongodb.org/mongo-driver/mongo" "go.mongodb.org/mongo-driver/mongo"
"go.mongodb.org/mongo-driver/x/bsonx" "go.mongodb.org/mongo-driver/x/bsonx"
) )
@ -29,33 +29,57 @@ func (this *ModelFriend) Init(service core.IService, module core.IModule, comp c
} }
// 查询好友 // 查询好友
func (this *ModelFriend) GetFriend(uid string) (friend *pb.DBFriend, err error) { func (this *ModelFriend) GetFriend(uid string) (info *pb.DBFriend, err error) {
friend = &pb.DBFriend{Uid: uid} info = &pb.DBFriend{}
if this.moduole.IsCross() { if err = this.Get(uid, info); err != nil && err != mgo.MongodbNil {
err = this.Get(uid, friend) this.moduole.Errorln(err)
if err != nil {
if err == redis.RedisNil || err == mongo.ErrNoDocuments {
if err = this.Add(uid, friend); err != nil {
return return
} }
} var user *pb.DBUser
// log.Error("未获得好友数据", log.Fields{"uid": uid}) if err == mgo.MongodbNil {
} if user, err = this.moduole.ModuleUser.GetUser(uid); err != nil {
} else { this.moduole.Errorln(err)
var (
model *db.DBModel
)
if model, err = this.moduole.GetCrossDBModel(this.TableName); err != nil {
return return
} }
model.Get(uid, friend) info = &pb.DBFriend{
if err != nil { Id: primitive.NewObjectID().Hex(),
if err == redis.RedisNil || err == mongo.ErrNoDocuments { Uid: uid,
if err = model.Add(uid, friend); err != nil { Info: comm.GetUserBaseInfo(user),
return FriendIds: make([]string, 0),
} ApplyIds: make([]string, 0),
} BlackIds: make([]string, 0),
GetZandIds: make([]string, 0),
Record: make([]*pb.AssistRecord, 0),
} }
err = this.Add(uid, info)
}
return
}
func (this *ModelFriend) GetFriends(uids []string) (friends []*pb.DBFriend, err error) {
friends = make([]*pb.DBFriend, 0)
var onfound []string
if onfound, err = this.Gets(uids, &friends); err != nil {
this.moduole.Errorln(err)
}
for _, v := range onfound {
var user *pb.DBUser
if user, err = this.moduole.ModuleUser.GetUser(v); err != nil {
this.moduole.Errorln(err)
return
}
info := &pb.DBFriend{
Id: primitive.NewObjectID().Hex(),
Uid: v,
Info: comm.GetUserBaseInfo(user),
FriendIds: make([]string, 0),
ApplyIds: make([]string, 0),
BlackIds: make([]string, 0),
GetZandIds: make([]string, 0),
Record: make([]*pb.AssistRecord, 0),
}
err = this.Add(v, info)
friends = append(friends, info)
} }
return return
} }

View File

@ -45,14 +45,6 @@ func (this *ModuleRobot_Arena) OncePipeline(robot IRobot) (err error) {
err = errors.New(fmt.Sprintf("code:%d message:%s", errdata.Code, errdata.Message)) err = errors.New(fmt.Sprintf("code:%d message:%s", errdata.Code, errdata.Message))
return return
} }
if this.players == nil || this.index >= int32(len(this.players)) {
if _, errdata = robot.SendMessage("arena", "matche", &pb.ArenaMatcheReq{}); errdata != nil {
err = errors.New(fmt.Sprintf("code:%d message:%s", errdata.Code, errdata.Message))
return
}
this.index = 0
}
return return
} }
@ -65,7 +57,13 @@ func (this *ModuleRobot_Arena) DoPipeline(robot IRobot) (err error) {
player *pb.ArenaPlayer player *pb.ArenaPlayer
resp proto.Message resp proto.Message
) )
if this.players == nil || this.index >= int32(len(this.players)) {
if _, errdata = robot.SendMessage("arena", "matche", &pb.ArenaMatcheReq{}); errdata != nil {
err = errors.New(fmt.Sprintf("code:%d message:%s", errdata.Code, errdata.Message))
return
}
this.index = 0
}
heromodule = robot.GetModule(comm.ModuleHero).(*ModuleRobot_Hero) heromodule = robot.GetModule(comm.ModuleHero).(*ModuleRobot_Hero)
heros = heromodule.getbattlehero() heros = heromodule.getbattlehero()

View File

@ -74,7 +74,7 @@ func (this *ModuleRobot_Friend) DoPipeline(robot IRobot) (err error) {
return return
} }
for _, v := range resp.(*pb.FriendRandlistResp).List { for _, v := range resp.(*pb.FriendRandlistResp).List {
if _, errdata = robot.SendMessage("friend", "agree", &pb.FriendApplyReq{ if _, errdata = robot.SendMessage("friend", "apply", &pb.FriendApplyReq{
FriendId: v.UserId, FriendId: v.UserId,
}); errdata != nil { }); errdata != nil {
err = errors.New(fmt.Sprintf("code:%d message:%s", errdata.Code, errdata.Message)) err = errors.New(fmt.Sprintf("code:%d message:%s", errdata.Code, errdata.Message))

View File

@ -198,16 +198,24 @@ func (this *User) CleanSession(uid, sessionid string) {
// 在线玩家列表 // 在线玩家列表
func (this *User) UserOnlineList() ([]*pb.CacheUser, error) { func (this *User) UserOnlineList() ([]*pb.CacheUser, error) {
var cache []*pb.CacheUser var cache []*pb.CacheUser
if !this.IsCross() { // if !this.IsCross() {
if err := this.modelSession.GetList(comm.RDS_EMPTY, &cache); err != nil { if err := this.modelSession.GetList(comm.RDS_EMPTY, &cache); err != nil {
return nil, err return nil, err
} }
} else { // } else {
var err error // var err error
if cache, err = this.CrossUserOnlineList(); err != nil { // if cache, err = this.CrossUserOnlineList(); err != nil {
// return nil, err
// }
// }
return cache, nil
}
func (this *User) UserRandOnlineList(num int32) ([]*pb.CacheUser, error) {
var cache []*pb.CacheUser
if err := this.modelSession.RandGetList(comm.RDS_EMPTY, num, &cache); err != nil {
return nil, err return nil, err
} }
}
return cache, nil return cache, nil
} }

View File

@ -44,6 +44,7 @@ const (
EffectTipsType_Diseased EffectTipsType = 18 //禁疗 EffectTipsType_Diseased EffectTipsType = 18 //禁疗
EffectTipsType_LostHold EffectTipsType = 19 //失手 EffectTipsType_LostHold EffectTipsType = 19 //失手
EffectTipsType_UnderStand EffectTipsType = 20 //会心 EffectTipsType_UnderStand EffectTipsType = 20 //会心
EffectTipsType_Invincibility EffectTipsType = 21 //无敌
) )
// Enum value maps for EffectTipsType. // Enum value maps for EffectTipsType.
@ -70,6 +71,7 @@ var (
18: "Diseased", 18: "Diseased",
19: "LostHold", 19: "LostHold",
20: "UnderStand", 20: "UnderStand",
21: "Invincibility",
} }
EffectTipsType_value = map[string]int32{ EffectTipsType_value = map[string]int32{
"Eff_Success": 0, "Eff_Success": 0,
@ -93,6 +95,7 @@ var (
"Diseased": 18, "Diseased": 18,
"LostHold": 19, "LostHold": 19,
"UnderStand": 20, "UnderStand": 20,
"Invincibility": 21,
} }
) )
@ -1490,7 +1493,7 @@ type ComPlayEffect struct {
unknownFields protoimpl.UnknownFields unknownFields protoimpl.UnknownFields
EffectName string `protobuf:"bytes,1,opt,name=effectName,proto3" json:"effectName"` EffectName string `protobuf:"bytes,1,opt,name=effectName,proto3" json:"effectName"`
Side int32 `protobuf:"varint,2,opt,name=side,proto3" json:"side"` NodePath string `protobuf:"bytes,2,opt,name=nodePath,proto3" json:"nodePath"`
} }
func (x *ComPlayEffect) Reset() { func (x *ComPlayEffect) Reset() {
@ -1532,11 +1535,11 @@ func (x *ComPlayEffect) GetEffectName() string {
return "" return ""
} }
func (x *ComPlayEffect) GetSide() int32 { func (x *ComPlayEffect) GetNodePath() string {
if x != nil { if x != nil {
return x.Side return x.NodePath
} }
return 0 return ""
} }
//出手倒计时 //出手倒计时
@ -2000,55 +2003,57 @@ var file_battle_battle_struct_proto_rawDesc = []byte{
0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x08, 0x70, 0x6c, 0x61, 0x79, 0x54, 0x79, 0x70, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x08, 0x70, 0x6c, 0x61, 0x79, 0x54, 0x79, 0x70,
0x65, 0x12, 0x21, 0x0a, 0x05, 0x72, 0x6f, 0x6c, 0x65, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x65, 0x12, 0x21, 0x0a, 0x05, 0x72, 0x6f, 0x6c, 0x65, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b,
0x32, 0x0b, 0x2e, 0x42, 0x61, 0x74, 0x74, 0x6c, 0x65, 0x52, 0x6f, 0x6c, 0x65, 0x52, 0x05, 0x72, 0x32, 0x0b, 0x2e, 0x42, 0x61, 0x74, 0x74, 0x6c, 0x65, 0x52, 0x6f, 0x6c, 0x65, 0x52, 0x05, 0x72,
0x6f, 0x6c, 0x65, 0x73, 0x22, 0x43, 0x0a, 0x0d, 0x43, 0x6f, 0x6d, 0x50, 0x6c, 0x61, 0x79, 0x45, 0x6f, 0x6c, 0x65, 0x73, 0x22, 0x4b, 0x0a, 0x0d, 0x43, 0x6f, 0x6d, 0x50, 0x6c, 0x61, 0x79, 0x45,
0x66, 0x66, 0x65, 0x63, 0x74, 0x12, 0x1e, 0x0a, 0x0a, 0x65, 0x66, 0x66, 0x65, 0x63, 0x74, 0x4e, 0x66, 0x66, 0x65, 0x63, 0x74, 0x12, 0x1e, 0x0a, 0x0a, 0x65, 0x66, 0x66, 0x65, 0x63, 0x74, 0x4e,
0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x65, 0x66, 0x66, 0x65, 0x63, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x65, 0x66, 0x66, 0x65, 0x63,
0x74, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x73, 0x69, 0x64, 0x65, 0x18, 0x02, 0x20, 0x74, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x6e, 0x6f, 0x64, 0x65, 0x50, 0x61, 0x74,
0x01, 0x28, 0x05, 0x52, 0x04, 0x73, 0x69, 0x64, 0x65, 0x22, 0x2c, 0x0a, 0x10, 0x43, 0x6f, 0x6d, 0x68, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x6e, 0x6f, 0x64, 0x65, 0x50, 0x61, 0x74,
0x45, 0x6d, 0x69, 0x74, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x64, 0x6f, 0x77, 0x6e, 0x12, 0x18, 0x0a, 0x68, 0x22, 0x2c, 0x0a, 0x10, 0x43, 0x6f, 0x6d, 0x45, 0x6d, 0x69, 0x74, 0x43, 0x6f, 0x75, 0x6e,
0x07, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x07, 0x74, 0x64, 0x6f, 0x77, 0x6e, 0x12, 0x18, 0x0a, 0x07, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65,
0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x22, 0x44, 0x0a, 0x0d, 0x43, 0x6f, 0x6d, 0x45, 0x66, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x07, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x22,
0x66, 0x65, 0x63, 0x74, 0x54, 0x69, 0x70, 0x73, 0x12, 0x23, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x44, 0x0a, 0x0d, 0x43, 0x6f, 0x6d, 0x45, 0x66, 0x66, 0x65, 0x63, 0x74, 0x54, 0x69, 0x70, 0x73,
0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x0f, 0x2e, 0x45, 0x66, 0x66, 0x65, 0x63, 0x74, 0x54, 0x12, 0x23, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x0f,
0x69, 0x70, 0x73, 0x54, 0x79, 0x70, 0x65, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x0e, 0x0a, 0x2e, 0x45, 0x66, 0x66, 0x65, 0x63, 0x74, 0x54, 0x69, 0x70, 0x73, 0x54, 0x79, 0x70, 0x65, 0x52,
0x02, 0x74, 0x6f, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x02, 0x74, 0x6f, 0x22, 0x26, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x74, 0x6f, 0x18, 0x02, 0x20, 0x01, 0x28,
0x0e, 0x43, 0x6f, 0x6d, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x45, 0x66, 0x66, 0x65, 0x63, 0x74, 0x12, 0x05, 0x52, 0x02, 0x74, 0x6f, 0x22, 0x26, 0x0a, 0x0e, 0x43, 0x6f, 0x6d, 0x43, 0x68, 0x61, 0x69,
0x14, 0x0a, 0x05, 0x72, 0x6f, 0x6c, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x05, 0x52, 0x05, 0x6e, 0x45, 0x66, 0x66, 0x65, 0x63, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x72, 0x6f, 0x6c, 0x65, 0x73,
0x72, 0x6f, 0x6c, 0x65, 0x73, 0x22, 0x53, 0x0a, 0x0d, 0x43, 0x6f, 0x6d, 0x53, 0x68, 0x69, 0x65, 0x18, 0x01, 0x20, 0x03, 0x28, 0x05, 0x52, 0x05, 0x72, 0x6f, 0x6c, 0x65, 0x73, 0x22, 0x53, 0x0a,
0x6c, 0x64, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x10, 0x0a, 0x03, 0x72, 0x69, 0x64, 0x18, 0x01, 0x20, 0x0d, 0x43, 0x6f, 0x6d, 0x53, 0x68, 0x69, 0x65, 0x6c, 0x64, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x10,
0x01, 0x28, 0x05, 0x52, 0x03, 0x72, 0x69, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x0a, 0x03, 0x72, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x03, 0x72, 0x69, 0x64,
0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x1a, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52,
0x0a, 0x08, 0x63, 0x75, 0x72, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x63, 0x75, 0x72, 0x56, 0x61, 0x6c,
0x52, 0x08, 0x63, 0x75, 0x72, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x26, 0x0a, 0x0e, 0x43, 0x6f, 0x75, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x08, 0x63, 0x75, 0x72, 0x56, 0x61, 0x6c,
0x6d, 0x53, 0x77, 0x69, 0x74, 0x63, 0x68, 0x53, 0x63, 0x65, 0x6e, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x75, 0x65, 0x22, 0x26, 0x0a, 0x0e, 0x43, 0x6f, 0x6d, 0x53, 0x77, 0x69, 0x74, 0x63, 0x68, 0x53,
0x73, 0x63, 0x65, 0x6e, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x73, 0x63, 0x65, 0x63, 0x65, 0x6e, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x73, 0x63, 0x65, 0x6e, 0x65, 0x18, 0x01, 0x20,
0x6e, 0x65, 0x22, 0x4e, 0x0a, 0x0f, 0x43, 0x6f, 0x6d, 0x52, 0x65, 0x70, 0x6c, 0x61, 0x63, 0x65, 0x01, 0x28, 0x09, 0x52, 0x05, 0x73, 0x63, 0x65, 0x6e, 0x65, 0x22, 0x4e, 0x0a, 0x0f, 0x43, 0x6f,
0x53, 0x6b, 0x69, 0x6c, 0x6c, 0x12, 0x0e, 0x0a, 0x02, 0x74, 0x6f, 0x18, 0x01, 0x20, 0x01, 0x28, 0x6d, 0x52, 0x65, 0x70, 0x6c, 0x61, 0x63, 0x65, 0x53, 0x6b, 0x69, 0x6c, 0x6c, 0x12, 0x0e, 0x0a,
0x05, 0x52, 0x02, 0x74, 0x6f, 0x12, 0x2b, 0x0a, 0x09, 0x73, 0x6b, 0x69, 0x6c, 0x6c, 0x49, 0x6e, 0x02, 0x74, 0x6f, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x02, 0x74, 0x6f, 0x12, 0x2b, 0x0a,
0x66, 0x6f, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x43, 0x6f, 0x6d, 0x53, 0x6b, 0x09, 0x73, 0x6b, 0x69, 0x6c, 0x6c, 0x49, 0x6e, 0x66, 0x6f, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b,
0x69, 0x6c, 0x6c, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x09, 0x73, 0x6b, 0x69, 0x6c, 0x6c, 0x49, 0x6e, 0x32, 0x0d, 0x2e, 0x43, 0x6f, 0x6d, 0x53, 0x6b, 0x69, 0x6c, 0x6c, 0x49, 0x6e, 0x66, 0x6f, 0x52,
0x66, 0x6f, 0x2a, 0xc8, 0x02, 0x0a, 0x0e, 0x45, 0x66, 0x66, 0x65, 0x63, 0x74, 0x54, 0x69, 0x70, 0x09, 0x73, 0x6b, 0x69, 0x6c, 0x6c, 0x49, 0x6e, 0x66, 0x6f, 0x2a, 0xdb, 0x02, 0x0a, 0x0e, 0x45,
0x73, 0x54, 0x79, 0x70, 0x65, 0x12, 0x0f, 0x0a, 0x0b, 0x45, 0x66, 0x66, 0x5f, 0x53, 0x75, 0x63, 0x66, 0x66, 0x65, 0x63, 0x74, 0x54, 0x69, 0x70, 0x73, 0x54, 0x79, 0x70, 0x65, 0x12, 0x0f, 0x0a,
0x63, 0x65, 0x73, 0x73, 0x10, 0x00, 0x12, 0x0f, 0x0a, 0x0b, 0x4e, 0x6f, 0x74, 0x5f, 0x53, 0x75, 0x0b, 0x45, 0x66, 0x66, 0x5f, 0x53, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x10, 0x00, 0x12, 0x0f,
0x63, 0x63, 0x65, 0x73, 0x73, 0x10, 0x01, 0x12, 0x0c, 0x0a, 0x08, 0x49, 0x6d, 0x6d, 0x75, 0x6e, 0x0a, 0x0b, 0x4e, 0x6f, 0x74, 0x5f, 0x53, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x10, 0x01, 0x12,
0x69, 0x74, 0x79, 0x10, 0x02, 0x12, 0x0a, 0x0a, 0x06, 0x52, 0x65, 0x73, 0x69, 0x73, 0x74, 0x10, 0x0c, 0x0a, 0x08, 0x49, 0x6d, 0x6d, 0x75, 0x6e, 0x69, 0x74, 0x79, 0x10, 0x02, 0x12, 0x0a, 0x0a,
0x03, 0x12, 0x0c, 0x0a, 0x08, 0x4e, 0x6f, 0x74, 0x5f, 0x47, 0x61, 0x69, 0x6e, 0x10, 0x04, 0x12, 0x06, 0x52, 0x65, 0x73, 0x69, 0x73, 0x74, 0x10, 0x03, 0x12, 0x0c, 0x0a, 0x08, 0x4e, 0x6f, 0x74,
0x0f, 0x0a, 0x0b, 0x4e, 0x6f, 0x74, 0x5f, 0x43, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x10, 0x05, 0x5f, 0x47, 0x61, 0x69, 0x6e, 0x10, 0x04, 0x12, 0x0f, 0x0a, 0x0b, 0x4e, 0x6f, 0x74, 0x5f, 0x43,
0x12, 0x0e, 0x0a, 0x0a, 0x4e, 0x6f, 0x74, 0x5f, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x10, 0x06, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x10, 0x05, 0x12, 0x0e, 0x0a, 0x0a, 0x4e, 0x6f, 0x74, 0x5f,
0x12, 0x10, 0x0a, 0x0c, 0x50, 0x75, 0x72, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x10, 0x06, 0x12, 0x10, 0x0a, 0x0c, 0x50, 0x75, 0x72, 0x69,
0x10, 0x07, 0x12, 0x0c, 0x0a, 0x08, 0x44, 0x69, 0x73, 0x70, 0x65, 0x72, 0x73, 0x65, 0x10, 0x08, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x10, 0x07, 0x12, 0x0c, 0x0a, 0x08, 0x44, 0x69,
0x12, 0x0e, 0x0a, 0x0a, 0x47, 0x61, 0x69, 0x6e, 0x5f, 0x72, 0x6f, 0x75, 0x6e, 0x64, 0x10, 0x09, 0x73, 0x70, 0x65, 0x72, 0x73, 0x65, 0x10, 0x08, 0x12, 0x0e, 0x0a, 0x0a, 0x47, 0x61, 0x69, 0x6e,
0x12, 0x0f, 0x0a, 0x0b, 0x41, 0x64, 0x64, 0x5f, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x65, 0x10, 0x5f, 0x72, 0x6f, 0x75, 0x6e, 0x64, 0x10, 0x09, 0x12, 0x0f, 0x0a, 0x0b, 0x41, 0x64, 0x64, 0x5f,
0x0a, 0x12, 0x0f, 0x0a, 0x0b, 0x53, 0x75, 0x62, 0x5f, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x65, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x65, 0x10, 0x0a, 0x12, 0x0f, 0x0a, 0x0b, 0x53, 0x75, 0x62,
0x10, 0x0b, 0x12, 0x0c, 0x0a, 0x08, 0x53, 0x74, 0x61, 0x6e, 0x64, 0x6f, 0x66, 0x66, 0x10, 0x0c, 0x5f, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x65, 0x10, 0x0b, 0x12, 0x0c, 0x0a, 0x08, 0x53, 0x74,
0x12, 0x0a, 0x0a, 0x06, 0x55, 0x6e, 0x64, 0x65, 0x61, 0x64, 0x10, 0x0d, 0x12, 0x0c, 0x0a, 0x08, 0x61, 0x6e, 0x64, 0x6f, 0x66, 0x66, 0x10, 0x0c, 0x12, 0x0a, 0x0a, 0x06, 0x55, 0x6e, 0x64, 0x65,
0x50, 0x6f, 0x69, 0x73, 0x6f, 0x6e, 0x65, 0x64, 0x10, 0x0e, 0x12, 0x09, 0x0a, 0x05, 0x42, 0x6c, 0x61, 0x64, 0x10, 0x0d, 0x12, 0x0c, 0x0a, 0x08, 0x50, 0x6f, 0x69, 0x73, 0x6f, 0x6e, 0x65, 0x64,
0x65, 0x65, 0x64, 0x10, 0x0f, 0x12, 0x0c, 0x0a, 0x08, 0x52, 0x65, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x10, 0x0e, 0x12, 0x09, 0x0a, 0x05, 0x42, 0x6c, 0x65, 0x65, 0x64, 0x10, 0x0f, 0x12, 0x0c, 0x0a,
0x79, 0x10, 0x10, 0x12, 0x0c, 0x0a, 0x08, 0x42, 0x65, 0x61, 0x74, 0x42, 0x61, 0x63, 0x6b, 0x10, 0x08, 0x52, 0x65, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x79, 0x10, 0x10, 0x12, 0x0c, 0x0a, 0x08, 0x42,
0x11, 0x12, 0x0c, 0x0a, 0x08, 0x44, 0x69, 0x73, 0x65, 0x61, 0x73, 0x65, 0x64, 0x10, 0x12, 0x12, 0x65, 0x61, 0x74, 0x42, 0x61, 0x63, 0x6b, 0x10, 0x11, 0x12, 0x0c, 0x0a, 0x08, 0x44, 0x69, 0x73,
0x0c, 0x0a, 0x08, 0x4c, 0x6f, 0x73, 0x74, 0x48, 0x6f, 0x6c, 0x64, 0x10, 0x13, 0x12, 0x0e, 0x0a, 0x65, 0x61, 0x73, 0x65, 0x64, 0x10, 0x12, 0x12, 0x0c, 0x0a, 0x08, 0x4c, 0x6f, 0x73, 0x74, 0x48,
0x0a, 0x55, 0x6e, 0x64, 0x65, 0x72, 0x53, 0x74, 0x61, 0x6e, 0x64, 0x10, 0x14, 0x42, 0x06, 0x5a, 0x6f, 0x6c, 0x64, 0x10, 0x13, 0x12, 0x0e, 0x0a, 0x0a, 0x55, 0x6e, 0x64, 0x65, 0x72, 0x53, 0x74,
0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, 0x61, 0x6e, 0x64, 0x10, 0x14, 0x12, 0x11, 0x0a, 0x0d, 0x49, 0x6e, 0x76, 0x69, 0x6e, 0x63, 0x69,
0x62, 0x69, 0x6c, 0x69, 0x74, 0x79, 0x10, 0x15, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62,
0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
} }
var ( var (

View File

@ -25,18 +25,20 @@ type DBFriend struct {
sizeCache protoimpl.SizeCache sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields unknownFields protoimpl.UnknownFields
Uid string `protobuf:"bytes,1,opt,name=uid,proto3" json:"uid" bson:"uid"` //用户ID Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id" bson:"_id"` //用户ID
FriendIds []string `protobuf:"bytes,2,rep,name=friendIds,proto3" json:"friendIds" bson:"friendIds"` //好友ID Uid string `protobuf:"bytes,2,opt,name=uid,proto3" json:"uid" bson:"uid"` //用户ID
ApplyIds []string `protobuf:"bytes,3,rep,name=applyIds,proto3" json:"applyIds" bson:"applyIds"` //申请用户ID Info *BaseUserInfo `protobuf:"bytes,3,opt,name=info,proto3" json:"info"`
BlackIds []string `protobuf:"bytes,4,rep,name=blackIds,proto3" json:"blackIds" bson:"blackIds"` //黑名单ID FriendIds []string `protobuf:"bytes,4,rep,name=friendIds,proto3" json:"friendIds" bson:"friendIds"` //好友ID
ZanIds []string `protobuf:"bytes,5,rep,name=zanIds,proto3" json:"zanIds" bson:"zanIds"` //点赞好友ID ApplyIds []string `protobuf:"bytes,5,rep,name=applyIds,proto3" json:"applyIds" bson:"applyIds"` //申请用户ID
GetZandIds []string `protobuf:"bytes,6,rep,name=getZandIds,proto3" json:"getZandIds" bson:"getZandIds"` //已接收赞好友ID BlackIds []string `protobuf:"bytes,6,rep,name=blackIds,proto3" json:"blackIds" bson:"blackIds"` //黑名单ID
AssistHeroId string `protobuf:"bytes,7,opt,name=assistHeroId,proto3" json:"assistHeroId" bson:"assistHeroId"` //助战英雄ID ZanIds []string `protobuf:"bytes,7,rep,name=zanIds,proto3" json:"zanIds" bson:"zanIds"` //点赞好友ID
Received int32 `protobuf:"varint,8,opt,name=received,proto3" json:"received" bson:"received"` //领取奖励状态0未领1可领2已领 GetZandIds []string `protobuf:"bytes,8,rep,name=getZandIds,proto3" json:"getZandIds" bson:"getZandIds"` //已接收赞好友ID
UpdateTime int64 `protobuf:"varint,9,opt,name=updateTime,proto3" json:"updateTime" bson:"updateTime"` // 更新时间 AssistHeroId string `protobuf:"bytes,9,opt,name=assistHeroId,proto3" json:"assistHeroId" bson:"assistHeroId"` //助战英雄ID
Hero *DBHero `protobuf:"bytes,10,opt,name=hero,proto3" json:"hero" bson:"hero"` //助战英雄副本 Received int32 `protobuf:"varint,10,opt,name=received,proto3" json:"received" bson:"received"` //领取奖励状态0未领1可领2已领
AssistScore int32 `protobuf:"varint,11,opt,name=assistScore,proto3" json:"assistScore" bson:"assistScore"` //助战分数合计 UpdateTime int64 `protobuf:"varint,11,opt,name=updateTime,proto3" json:"updateTime" bson:"updateTime"` // 更新时间
Record []*AssistRecord `protobuf:"bytes,12,rep,name=record,proto3" json:"record" bson:"record"` // 助战记录 Hero *DBHero `protobuf:"bytes,12,opt,name=hero,proto3" json:"hero" bson:"hero"` //助战英雄副本
AssistScore int32 `protobuf:"varint,13,opt,name=assistScore,proto3" json:"assistScore" bson:"assistScore"` //助战分数合计
Record []*AssistRecord `protobuf:"bytes,14,rep,name=record,proto3" json:"record" bson:"record"` // 助战记录
} }
func (x *DBFriend) Reset() { func (x *DBFriend) Reset() {
@ -71,6 +73,13 @@ func (*DBFriend) Descriptor() ([]byte, []int) {
return file_friend_friend_db_proto_rawDescGZIP(), []int{0} return file_friend_friend_db_proto_rawDescGZIP(), []int{0}
} }
func (x *DBFriend) GetId() string {
if x != nil {
return x.Id
}
return ""
}
func (x *DBFriend) GetUid() string { func (x *DBFriend) GetUid() string {
if x != nil { if x != nil {
return x.Uid return x.Uid
@ -78,6 +87,13 @@ func (x *DBFriend) GetUid() string {
return "" return ""
} }
func (x *DBFriend) GetInfo() *BaseUserInfo {
if x != nil {
return x.Info
}
return nil
}
func (x *DBFriend) GetFriendIds() []string { func (x *DBFriend) GetFriendIds() []string {
if x != nil { if x != nil {
return x.FriendIds return x.FriendIds
@ -312,48 +328,52 @@ var File_friend_friend_db_proto protoreflect.FileDescriptor
var file_friend_friend_db_proto_rawDesc = []byte{ var file_friend_friend_db_proto_rawDesc = []byte{
0x0a, 0x16, 0x66, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x2f, 0x66, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x5f, 0x0a, 0x16, 0x66, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x2f, 0x66, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x5f,
0x64, 0x62, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x12, 0x68, 0x65, 0x72, 0x6f, 0x2f, 0x68, 0x64, 0x62, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x12, 0x68, 0x65, 0x72, 0x6f, 0x2f, 0x68,
0x65, 0x72, 0x6f, 0x5f, 0x64, 0x62, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xf0, 0x02, 0x0a, 0x65, 0x72, 0x6f, 0x5f, 0x64, 0x62, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x0a, 0x63, 0x6f,
0x08, 0x44, 0x42, 0x46, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x12, 0x10, 0x0a, 0x03, 0x75, 0x69, 0x64, 0x6d, 0x6d, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xa3, 0x03, 0x0a, 0x08, 0x44, 0x42, 0x46,
0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x75, 0x69, 0x64, 0x12, 0x1c, 0x0a, 0x09, 0x66, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28,
0x72, 0x69, 0x65, 0x6e, 0x64, 0x49, 0x64, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x09, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x10, 0x0a, 0x03, 0x75, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01,
0x66, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x49, 0x64, 0x73, 0x12, 0x1a, 0x0a, 0x08, 0x61, 0x70, 0x70, 0x28, 0x09, 0x52, 0x03, 0x75, 0x69, 0x64, 0x12, 0x21, 0x0a, 0x04, 0x69, 0x6e, 0x66, 0x6f, 0x18,
0x6c, 0x79, 0x49, 0x64, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x09, 0x52, 0x08, 0x61, 0x70, 0x70, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x42, 0x61, 0x73, 0x65, 0x55, 0x73, 0x65, 0x72,
0x6c, 0x79, 0x49, 0x64, 0x73, 0x12, 0x1a, 0x0a, 0x08, 0x62, 0x6c, 0x61, 0x63, 0x6b, 0x49, 0x64, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x04, 0x69, 0x6e, 0x66, 0x6f, 0x12, 0x1c, 0x0a, 0x09, 0x66, 0x72,
0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x09, 0x52, 0x08, 0x62, 0x6c, 0x61, 0x63, 0x6b, 0x49, 0x64, 0x69, 0x65, 0x6e, 0x64, 0x49, 0x64, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x09, 0x52, 0x09, 0x66,
0x73, 0x12, 0x16, 0x0a, 0x06, 0x7a, 0x61, 0x6e, 0x49, 0x64, 0x73, 0x18, 0x05, 0x20, 0x03, 0x28, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x49, 0x64, 0x73, 0x12, 0x1a, 0x0a, 0x08, 0x61, 0x70, 0x70, 0x6c,
0x09, 0x52, 0x06, 0x7a, 0x61, 0x6e, 0x49, 0x64, 0x73, 0x12, 0x1e, 0x0a, 0x0a, 0x67, 0x65, 0x74, 0x79, 0x49, 0x64, 0x73, 0x18, 0x05, 0x20, 0x03, 0x28, 0x09, 0x52, 0x08, 0x61, 0x70, 0x70, 0x6c,
0x5a, 0x61, 0x6e, 0x64, 0x49, 0x64, 0x73, 0x18, 0x06, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0a, 0x67, 0x79, 0x49, 0x64, 0x73, 0x12, 0x1a, 0x0a, 0x08, 0x62, 0x6c, 0x61, 0x63, 0x6b, 0x49, 0x64, 0x73,
0x65, 0x74, 0x5a, 0x61, 0x6e, 0x64, 0x49, 0x64, 0x73, 0x12, 0x22, 0x0a, 0x0c, 0x61, 0x73, 0x73, 0x18, 0x06, 0x20, 0x03, 0x28, 0x09, 0x52, 0x08, 0x62, 0x6c, 0x61, 0x63, 0x6b, 0x49, 0x64, 0x73,
0x69, 0x73, 0x74, 0x48, 0x65, 0x72, 0x6f, 0x49, 0x64, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x12, 0x16, 0x0a, 0x06, 0x7a, 0x61, 0x6e, 0x49, 0x64, 0x73, 0x18, 0x07, 0x20, 0x03, 0x28, 0x09,
0x0c, 0x61, 0x73, 0x73, 0x69, 0x73, 0x74, 0x48, 0x65, 0x72, 0x6f, 0x49, 0x64, 0x12, 0x1a, 0x0a, 0x52, 0x06, 0x7a, 0x61, 0x6e, 0x49, 0x64, 0x73, 0x12, 0x1e, 0x0a, 0x0a, 0x67, 0x65, 0x74, 0x5a,
0x08, 0x72, 0x65, 0x63, 0x65, 0x69, 0x76, 0x65, 0x64, 0x18, 0x08, 0x20, 0x01, 0x28, 0x05, 0x52, 0x61, 0x6e, 0x64, 0x49, 0x64, 0x73, 0x18, 0x08, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0a, 0x67, 0x65,
0x08, 0x72, 0x65, 0x63, 0x65, 0x69, 0x76, 0x65, 0x64, 0x12, 0x1e, 0x0a, 0x0a, 0x75, 0x70, 0x64, 0x74, 0x5a, 0x61, 0x6e, 0x64, 0x49, 0x64, 0x73, 0x12, 0x22, 0x0a, 0x0c, 0x61, 0x73, 0x73, 0x69,
0x61, 0x74, 0x65, 0x54, 0x69, 0x6d, 0x65, 0x18, 0x09, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0a, 0x75, 0x73, 0x74, 0x48, 0x65, 0x72, 0x6f, 0x49, 0x64, 0x18, 0x09, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c,
0x70, 0x64, 0x61, 0x74, 0x65, 0x54, 0x69, 0x6d, 0x65, 0x12, 0x1b, 0x0a, 0x04, 0x68, 0x65, 0x72, 0x61, 0x73, 0x73, 0x69, 0x73, 0x74, 0x48, 0x65, 0x72, 0x6f, 0x49, 0x64, 0x12, 0x1a, 0x0a, 0x08,
0x6f, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x07, 0x2e, 0x44, 0x42, 0x48, 0x65, 0x72, 0x6f, 0x72, 0x65, 0x63, 0x65, 0x69, 0x76, 0x65, 0x64, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x05, 0x52, 0x08,
0x52, 0x04, 0x68, 0x65, 0x72, 0x6f, 0x12, 0x20, 0x0a, 0x0b, 0x61, 0x73, 0x73, 0x69, 0x73, 0x74, 0x72, 0x65, 0x63, 0x65, 0x69, 0x76, 0x65, 0x64, 0x12, 0x1e, 0x0a, 0x0a, 0x75, 0x70, 0x64, 0x61,
0x53, 0x63, 0x6f, 0x72, 0x65, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0b, 0x61, 0x73, 0x73, 0x74, 0x65, 0x54, 0x69, 0x6d, 0x65, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0a, 0x75, 0x70,
0x69, 0x73, 0x74, 0x53, 0x63, 0x6f, 0x72, 0x65, 0x12, 0x25, 0x0a, 0x06, 0x72, 0x65, 0x63, 0x6f, 0x64, 0x61, 0x74, 0x65, 0x54, 0x69, 0x6d, 0x65, 0x12, 0x1b, 0x0a, 0x04, 0x68, 0x65, 0x72, 0x6f,
0x72, 0x64, 0x18, 0x0c, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x41, 0x73, 0x73, 0x69, 0x73, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x07, 0x2e, 0x44, 0x42, 0x48, 0x65, 0x72, 0x6f, 0x52,
0x74, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x52, 0x06, 0x72, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x22, 0x04, 0x68, 0x65, 0x72, 0x6f, 0x12, 0x20, 0x0a, 0x0b, 0x61, 0x73, 0x73, 0x69, 0x73, 0x74, 0x53,
0x64, 0x0a, 0x0c, 0x41, 0x73, 0x73, 0x69, 0x73, 0x74, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x12, 0x63, 0x6f, 0x72, 0x65, 0x18, 0x0d, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0b, 0x61, 0x73, 0x73, 0x69,
0x10, 0x0a, 0x03, 0x75, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x75, 0x69, 0x73, 0x74, 0x53, 0x63, 0x6f, 0x72, 0x65, 0x12, 0x25, 0x0a, 0x06, 0x72, 0x65, 0x63, 0x6f, 0x72,
0x64, 0x12, 0x1e, 0x0a, 0x0a, 0x61, 0x73, 0x73, 0x69, 0x73, 0x74, 0x54, 0x69, 0x6d, 0x65, 0x18, 0x64, 0x18, 0x0e, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x41, 0x73, 0x73, 0x69, 0x73, 0x74,
0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0a, 0x61, 0x73, 0x73, 0x69, 0x73, 0x74, 0x54, 0x69, 0x6d, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x52, 0x06, 0x72, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x22, 0x64,
0x65, 0x12, 0x22, 0x0a, 0x0c, 0x61, 0x73, 0x73, 0x69, 0x73, 0x74, 0x48, 0x65, 0x72, 0x6f, 0x49, 0x0a, 0x0c, 0x41, 0x73, 0x73, 0x69, 0x73, 0x74, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x12, 0x10,
0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x61, 0x73, 0x73, 0x69, 0x73, 0x74, 0x48, 0x0a, 0x03, 0x75, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x75, 0x69, 0x64,
0x65, 0x72, 0x6f, 0x49, 0x64, 0x22, 0xa6, 0x01, 0x0a, 0x0c, 0x51, 0x69, 0x65, 0x63, 0x75, 0x6f, 0x12, 0x1e, 0x0a, 0x0a, 0x61, 0x73, 0x73, 0x69, 0x73, 0x74, 0x54, 0x69, 0x6d, 0x65, 0x18, 0x02,
0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x12, 0x10, 0x0a, 0x03, 0x75, 0x69, 0x64, 0x18, 0x01, 0x20, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0a, 0x61, 0x73, 0x73, 0x69, 0x73, 0x74, 0x54, 0x69, 0x6d, 0x65,
0x01, 0x28, 0x09, 0x52, 0x03, 0x75, 0x69, 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x74, 0x61, 0x72, 0x67, 0x12, 0x22, 0x0a, 0x0c, 0x61, 0x73, 0x73, 0x69, 0x73, 0x74, 0x48, 0x65, 0x72, 0x6f, 0x49, 0x64,
0x65, 0x74, 0x49, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x74, 0x61, 0x72, 0x67, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x61, 0x73, 0x73, 0x69, 0x73, 0x74, 0x48, 0x65,
0x65, 0x74, 0x49, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x03, 0x72, 0x6f, 0x49, 0x64, 0x22, 0xa6, 0x01, 0x0a, 0x0c, 0x51, 0x69, 0x65, 0x63, 0x75, 0x6f, 0x52,
0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x18, 0x0a, 0x07, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x12, 0x10, 0x0a, 0x03, 0x75, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01,
0x6d, 0x61, 0x74, 0x63, 0x68, 0x49, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x6d, 0x28, 0x09, 0x52, 0x03, 0x75, 0x69, 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x74, 0x61, 0x72, 0x67, 0x65,
0x61, 0x74, 0x63, 0x68, 0x49, 0x64, 0x12, 0x1c, 0x0a, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x74, 0x49, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x74, 0x61, 0x72, 0x67, 0x65,
0x61, 0x6d, 0x70, 0x18, 0x05, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x49, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x03, 0x20,
0x74, 0x61, 0x6d, 0x70, 0x12, 0x18, 0x0a, 0x07, 0x65, 0x6e, 0x64, 0x54, 0x69, 0x6d, 0x65, 0x18, 0x01, 0x28, 0x05, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x18, 0x0a, 0x07, 0x6d,
0x06, 0x20, 0x01, 0x28, 0x03, 0x52, 0x07, 0x65, 0x6e, 0x64, 0x54, 0x69, 0x6d, 0x65, 0x42, 0x06, 0x61, 0x74, 0x63, 0x68, 0x49, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x6d, 0x61,
0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, 0x74, 0x63, 0x68, 0x49, 0x64, 0x12, 0x1c, 0x0a, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61,
0x6d, 0x70, 0x18, 0x05, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74,
0x61, 0x6d, 0x70, 0x12, 0x18, 0x0a, 0x07, 0x65, 0x6e, 0x64, 0x54, 0x69, 0x6d, 0x65, 0x18, 0x06,
0x20, 0x01, 0x28, 0x03, 0x52, 0x07, 0x65, 0x6e, 0x64, 0x54, 0x69, 0x6d, 0x65, 0x42, 0x06, 0x5a,
0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
} }
var ( var (
@ -373,16 +393,18 @@ var file_friend_friend_db_proto_goTypes = []interface{}{
(*DBFriend)(nil), // 0: DBFriend (*DBFriend)(nil), // 0: DBFriend
(*AssistRecord)(nil), // 1: AssistRecord (*AssistRecord)(nil), // 1: AssistRecord
(*QiecuoRecord)(nil), // 2: QiecuoRecord (*QiecuoRecord)(nil), // 2: QiecuoRecord
(*DBHero)(nil), // 3: DBHero (*BaseUserInfo)(nil), // 3: BaseUserInfo
(*DBHero)(nil), // 4: DBHero
} }
var file_friend_friend_db_proto_depIdxs = []int32{ var file_friend_friend_db_proto_depIdxs = []int32{
3, // 0: DBFriend.hero:type_name -> DBHero 3, // 0: DBFriend.info:type_name -> BaseUserInfo
1, // 1: DBFriend.record:type_name -> AssistRecord 4, // 1: DBFriend.hero:type_name -> DBHero
2, // [2:2] is the sub-list for method output_type 1, // 2: DBFriend.record:type_name -> AssistRecord
2, // [2:2] is the sub-list for method input_type 3, // [3:3] is the sub-list for method output_type
2, // [2:2] is the sub-list for extension type_name 3, // [3:3] is the sub-list for method input_type
2, // [2:2] is the sub-list for extension extendee 3, // [3:3] is the sub-list for extension type_name
0, // [0:2] is the sub-list for field 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_friend_friend_db_proto_init() } func init() { file_friend_friend_db_proto_init() }
@ -391,6 +413,7 @@ func file_friend_friend_db_proto_init() {
return return
} }
file_hero_hero_db_proto_init() file_hero_hero_db_proto_init()
file_comm_proto_init()
if !protoimpl.UnsafeEnabled { if !protoimpl.UnsafeEnabled {
file_friend_friend_db_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { file_friend_friend_db_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*DBFriend); i { switch v := v.(*DBFriend); i {

View File

@ -99,7 +99,7 @@ func main() {
log.SetLoglevel(log.DebugLevel), log.SetLoglevel(log.DebugLevel),
log.SetUniqueLog(true), log.SetUniqueLog(true),
log.SetIsDebug(true)); err != nil { log.SetIsDebug(true)); err != nil {
panic(fmt.Sprintf("Sys log Init err:%v", err)) panic(fmt.Sprintf("Sys log Init err:%v !", err))
} else { } else {
log.Infof("Sys log Init success !") log.Infof("Sys log Init success !")
} }

View File

@ -154,6 +154,8 @@ func (this *SCompGateRoute) ReceiveMsg(ctx context.Context, args *pb.AgentMessag
} else { } else {
reply.Reply = session.Polls() reply.Reply = session.Polls()
// log.Debugf("[Handle Api] t:%v m:%s uid:%s req:%v reply:%v", time.Since(stime), method, args.UserId, msg, reply) // log.Debugf("[Handle Api] t:%v m:%s uid:%s req:%v reply:%v", time.Since(stime), method, args.UserId, msg, reply)
nt := time.Since(stime).Milliseconds()
if nt < 100 {
log.Debug("[Handle Api]", log.Debug("[Handle Api]",
log.Field{Key: "t", Value: time.Since(stime).Milliseconds()}, log.Field{Key: "t", Value: time.Since(stime).Milliseconds()},
log.Field{Key: "m", Value: method}, log.Field{Key: "m", Value: method},
@ -161,6 +163,15 @@ func (this *SCompGateRoute) ReceiveMsg(ctx context.Context, args *pb.AgentMessag
log.Field{Key: "req", Value: msg}, log.Field{Key: "req", Value: msg},
log.Field{Key: "reply", Value: reply.String()}, log.Field{Key: "reply", Value: reply.String()},
) )
} else {
log.Error("[Handle Api]",
log.Field{Key: "t", Value: time.Since(stime).Milliseconds()},
log.Field{Key: "m", Value: method},
log.Field{Key: "uid", Value: args.UserId},
log.Field{Key: "req", Value: msg},
log.Field{Key: "reply", Value: reply.String()},
)
}
} }
} else { //未找到消息处理函数 } else { //未找到消息处理函数
log.Errorf("[Handle Api] no found handle %s", method) log.Errorf("[Handle Api] no found handle %s", method)

View File

@ -22,7 +22,7 @@ func (this *ServiceBase) InitSys() {
this.RPCXService.InitSys() this.RPCXService.InitSys()
//初始化配置中心系统 每个服务都会用到的就在这个初始化就好 //初始化配置中心系统 每个服务都会用到的就在这个初始化就好
if err := configure.OnInit(this.GetSettings().Sys["configure"]); err != nil { if err := configure.OnInit(this.GetSettings().Sys["configure"]); err != nil {
panic(fmt.Sprintf("init sys.configure err: %s !", err.Error())) panic(fmt.Sprintf("init sys.configure err: %s", err.Error()))
} else { } else {
configure.Start() configure.Start()
log.Infof("init sys.configure success!") log.Infof("init sys.configure success!")

View File

@ -819,6 +819,94 @@ func (this *DBModel) GetList(uid string, data interface{}) (err error) {
return err return err
} }
// 随机读取列表数据
func (this *DBModel) RandGetList(uid string, num int32, data interface{}) (err error) {
//defer log.Debug("DBModel GetList", log.Field{Key: "TableName", Value: this.TableName}, log.Field{Key: "uid", Value: uid}, log.Field{Key: "data", Value: data})
defer func() { //程序异常 收集异常信息传递给前端显示
if r := recover(); r != nil {
buf := make([]byte, 4096)
l := runtime.Stack(buf, false)
err = fmt.Errorf("%v: %s", r, buf[:l])
log.Errorf("[DB GetList] TableName:%s uid:%s err:%v", this.TableName, uid, err)
}
}()
var (
dtype reflect2.Type
dkind reflect.Kind
sType reflect2.Type
sliceType *reflect2.UnsafeSliceType
sliceelemType reflect2.Type
decoder codecore.IDecoderMapJson
dptr unsafe.Pointer
elemPtr unsafe.Pointer
n int
ok bool
keys map[string]string
tempdata map[string]string
result []*redis.StringStringMapCmd
)
keys = make(map[string]string)
dptr = reflect2.PtrOf(data)
dtype = reflect2.TypeOf(data)
dkind = dtype.Kind()
if dkind != reflect.Ptr {
err = fmt.Errorf("MCompModel: GetList(non-pointer %T)", data)
return
}
sType = dtype.(*reflect2.UnsafePtrType).Elem()
if sType.Kind() != reflect.Slice {
err = fmt.Errorf("MCompModel: GetList(data no slice %T)", data)
return
}
sliceType = sType.(*reflect2.UnsafeSliceType)
sliceelemType = sliceType.Elem()
if sliceelemType.Kind() != reflect.Ptr {
err = fmt.Errorf("MCompModel: GetList(sliceelemType non-pointer %T)", data)
return
}
if decoder, ok = codec.DecoderOf(sliceelemType, defconf).(codecore.IDecoderMapJson); !ok {
err = fmt.Errorf("MCompModel: GetList(data not support MarshalMapJson %T)", data)
return
}
sliceelemType = sliceelemType.(*reflect2.UnsafePtrType).Elem()
pipe := this.Redis.RedisPipe(context.TODO())
if keys, err = this.Redis.HGetAllToMapString(this.ukey(uid)); err == nil {
result = make([]*redis.StringStringMapCmd, 0)
for _, v := range keys {
cmd := pipe.HGetAllToMapString(v)
result = append(result, cmd)
if len(result) >= int(num) {
break
}
}
pipe.Exec()
for _, v := range result {
tempdata, err = v.Result()
sliceType.UnsafeGrow(dptr, n+1)
elemPtr = sliceType.UnsafeGetIndex(dptr, n)
if *((*unsafe.Pointer)(elemPtr)) == nil {
newPtr := sliceelemType.UnsafeNew()
if err = decoder.DecodeForMapJson(newPtr, json.GetReader([]byte{}), tempdata); err != nil {
log.Errorf("err:%v", err)
return
}
*((*unsafe.Pointer)(elemPtr)) = newPtr
} else {
decoder.DecodeForMapJson(*((*unsafe.Pointer)(elemPtr)), json.GetReader([]byte{}), tempdata)
}
n++
}
}
if this.Expired > 0 {
childs := make(map[string]struct{}, len(keys))
for _, v := range keys {
childs[v] = struct{}{}
}
this.conn.UpDateModelExpired(this.ukey(uid), childs, this.Expired)
}
return err
}
// 获取队列数据 // 获取队列数据
func (this *DBModel) GetQueues(key string, count int, data interface{}) (err error) { func (this *DBModel) GetQueues(key string, count int, data interface{}) (err error) {
//defer log.Debug("DBModel GetQueues", log.Field{Key: "TableName", Value: this.TableName}, log.Field{Key: "key", Value: key}, log.Field{Key: "data", Value: data}) //defer log.Debug("DBModel GetQueues", log.Field{Key: "TableName", Value: this.TableName}, log.Field{Key: "key", Value: key}, log.Field{Key: "data", Value: data})