好友推荐优化
This commit is contained in:
parent
b35a40ceff
commit
a9c63d7fa5
@ -178,12 +178,12 @@ type (
|
||||
GetUserExpand(uid string) (result *pb.DBUserExpand, err error)
|
||||
//更新用户expand
|
||||
ChangeUserExpand(uid string, value map[string]interface{}) error
|
||||
// 本服在线玩家列表
|
||||
//本服在线玩家列表
|
||||
UserOnlineList() ([]*pb.CacheUser, error)
|
||||
//随机获取在线列表
|
||||
UserRandOnlineList(num int32) ([]*pb.CacheUser, error)
|
||||
//是否在线
|
||||
IsOnline(uid string) bool
|
||||
// 跨服在线玩家列表
|
||||
CrossUserOnlineList() ([]*pb.CacheUser, error)
|
||||
// 跨服用户会话
|
||||
CrossUserSession(uid string) *pb.CacheUser
|
||||
// 跨服搜索玩家
|
||||
|
@ -138,6 +138,11 @@ func (this *MCompModel) GetList(uid string, data interface{}) (err error) {
|
||||
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) {
|
||||
return this.DBModel.GetQueues(key, count, data)
|
||||
|
@ -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) {
|
||||
|
||||
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 {
|
||||
errdata = &pb.ErrorData{
|
||||
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 {
|
||||
errdata = &pb.ErrorData{
|
||||
Code: pb.ErrorCode_DBError,
|
||||
@ -35,11 +44,25 @@ func (this *apiComp) Randlist(session comm.IUserSession, req *pb.FriendRandlistR
|
||||
}
|
||||
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
|
||||
for _, v := range cuList {
|
||||
var newList []*pb.DBFriend
|
||||
for _, v := range onlines {
|
||||
// 将自己从在线玩家中过滤掉
|
||||
if v.Uid == session.GetUserId() {
|
||||
continue
|
||||
@ -49,54 +72,32 @@ func (this *apiComp) Randlist(session comm.IUserSession, req *pb.FriendRandlistR
|
||||
continue
|
||||
}
|
||||
|
||||
//检查目标v中的申请列表中是否有自己,
|
||||
target, err := this.module.modelFriend.GetFriend(v.Uid)
|
||||
if err != nil {
|
||||
errdata = &pb.ErrorData{
|
||||
Code: pb.ErrorCode_FriendSelfNoData,
|
||||
Title: pb.ErrorCode_FriendSelfNoData.ToString(),
|
||||
}
|
||||
return
|
||||
}
|
||||
if _, ok := utils.Findx(target.ApplyIds, self.Uid); ok {
|
||||
if target, ok = friendMaps[v.Uid]; !ok {
|
||||
continue
|
||||
} else {
|
||||
if _, ok := utils.Findx(target.ApplyIds, self.Uid); ok {
|
||||
continue
|
||||
}
|
||||
}
|
||||
|
||||
//将黑名单中的玩家过滤
|
||||
if _, ok := utils.Findx(self.BlackIds, v.Uid); ok {
|
||||
continue
|
||||
}
|
||||
newList = append(newList, v)
|
||||
newList = append(newList, target)
|
||||
}
|
||||
var randOnlineUsers []string
|
||||
if len(newList) > recommend {
|
||||
randArr := utils.RandomNumbers(0, len(newList), recommend)
|
||||
for _, v := range randArr {
|
||||
if newList[v] != nil {
|
||||
randOnlineUsers = append(randOnlineUsers, newList[v].Uid)
|
||||
}
|
||||
userList := make([]*pb.FriendBase, 0)
|
||||
for _, user := range newList {
|
||||
base := &pb.FriendBase{
|
||||
ServerId: user.Info.Sid,
|
||||
UserId: user.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 {
|
||||
this.module.Debug("未找到玩家信息",
|
||||
log.Field{Key: "uid", Value: uid})
|
||||
log.Field{Key: "uid", Value: user.Uid})
|
||||
continue
|
||||
}
|
||||
|
||||
@ -106,7 +107,6 @@ func (this *apiComp) Randlist(session comm.IUserSession, req *pb.FriendRandlistR
|
||||
} else {
|
||||
userList = append(userList, base)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
rsp := &pb.FriendRandlistResp{
|
||||
|
@ -3,11 +3,11 @@ package friend
|
||||
import (
|
||||
"go_dreamfactory/comm"
|
||||
"go_dreamfactory/lego/core"
|
||||
"go_dreamfactory/lego/sys/redis"
|
||||
"go_dreamfactory/lego/sys/mgo"
|
||||
"go_dreamfactory/modules"
|
||||
"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/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) {
|
||||
friend = &pb.DBFriend{Uid: uid}
|
||||
if this.moduole.IsCross() {
|
||||
err = this.Get(uid, friend)
|
||||
if err != nil {
|
||||
if err == redis.RedisNil || err == mongo.ErrNoDocuments {
|
||||
if err = this.Add(uid, friend); err != nil {
|
||||
return
|
||||
}
|
||||
}
|
||||
// log.Error("未获得好友数据", log.Fields{"uid": uid})
|
||||
}
|
||||
} else {
|
||||
var (
|
||||
model *db.DBModel
|
||||
)
|
||||
if model, err = this.moduole.GetCrossDBModel(this.TableName); err != nil {
|
||||
func (this *ModelFriend) GetFriend(uid string) (info *pb.DBFriend, err error) {
|
||||
info = &pb.DBFriend{}
|
||||
if err = this.Get(uid, info); err != nil && err != mgo.MongodbNil {
|
||||
this.moduole.Errorln(err)
|
||||
return
|
||||
}
|
||||
var user *pb.DBUser
|
||||
if err == mgo.MongodbNil {
|
||||
if user, err = this.moduole.ModuleUser.GetUser(uid); err != nil {
|
||||
this.moduole.Errorln(err)
|
||||
return
|
||||
}
|
||||
model.Get(uid, friend)
|
||||
if err != nil {
|
||||
if err == redis.RedisNil || err == mongo.ErrNoDocuments {
|
||||
if err = model.Add(uid, friend); err != nil {
|
||||
return
|
||||
}
|
||||
}
|
||||
info = &pb.DBFriend{
|
||||
Id: primitive.NewObjectID().Hex(),
|
||||
Uid: uid,
|
||||
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(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
|
||||
}
|
||||
|
@ -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))
|
||||
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
|
||||
}
|
||||
|
||||
@ -65,7 +57,13 @@ func (this *ModuleRobot_Arena) DoPipeline(robot IRobot) (err error) {
|
||||
player *pb.ArenaPlayer
|
||||
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)
|
||||
heros = heromodule.getbattlehero()
|
||||
|
||||
|
@ -74,7 +74,7 @@ func (this *ModuleRobot_Friend) DoPipeline(robot IRobot) (err error) {
|
||||
return
|
||||
}
|
||||
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,
|
||||
}); errdata != nil {
|
||||
err = errors.New(fmt.Sprintf("code:%d message:%s", errdata.Code, errdata.Message))
|
||||
|
@ -198,15 +198,23 @@ func (this *User) CleanSession(uid, sessionid string) {
|
||||
// 在线玩家列表
|
||||
func (this *User) UserOnlineList() ([]*pb.CacheUser, error) {
|
||||
var cache []*pb.CacheUser
|
||||
if !this.IsCross() {
|
||||
if err := this.modelSession.GetList(comm.RDS_EMPTY, &cache); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
} else {
|
||||
var err error
|
||||
if cache, err = this.CrossUserOnlineList(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
// if !this.IsCross() {
|
||||
if err := this.modelSession.GetList(comm.RDS_EMPTY, &cache); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
// } else {
|
||||
// var err error
|
||||
// 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 cache, nil
|
||||
}
|
||||
|
@ -23,27 +23,28 @@ const (
|
||||
type EffectTipsType int32
|
||||
|
||||
const (
|
||||
EffectTipsType_Eff_Success EffectTipsType = 0
|
||||
EffectTipsType_Not_Success EffectTipsType = 1 //没有成功
|
||||
EffectTipsType_Immunity EffectTipsType = 2 //免疫
|
||||
EffectTipsType_Resist EffectTipsType = 3 //抵抗
|
||||
EffectTipsType_Not_Gain EffectTipsType = 4 //无法获得增益
|
||||
EffectTipsType_Not_Control EffectTipsType = 5 //免疫控制
|
||||
EffectTipsType_Not_Action EffectTipsType = 6 //无法行动
|
||||
EffectTipsType_Purification EffectTipsType = 7 //净化
|
||||
EffectTipsType_Disperse EffectTipsType = 8 //驱散
|
||||
EffectTipsType_Gain_round EffectTipsType = 9 //获得回合
|
||||
EffectTipsType_Add_Operate EffectTipsType = 10 //增加行动值
|
||||
EffectTipsType_Sub_Operate EffectTipsType = 11 //减少行动值
|
||||
EffectTipsType_Standoff EffectTipsType = 12 //对峙
|
||||
EffectTipsType_Undead EffectTipsType = 13 //不死
|
||||
EffectTipsType_Poisoned EffectTipsType = 14 //中毒
|
||||
EffectTipsType_Bleed EffectTipsType = 15 //流血
|
||||
EffectTipsType_Recovery EffectTipsType = 16 //复苏
|
||||
EffectTipsType_BeatBack EffectTipsType = 17 //反击
|
||||
EffectTipsType_Diseased EffectTipsType = 18 //禁疗
|
||||
EffectTipsType_LostHold EffectTipsType = 19 //失手
|
||||
EffectTipsType_UnderStand EffectTipsType = 20 //会心
|
||||
EffectTipsType_Eff_Success EffectTipsType = 0
|
||||
EffectTipsType_Not_Success EffectTipsType = 1 //没有成功
|
||||
EffectTipsType_Immunity EffectTipsType = 2 //免疫
|
||||
EffectTipsType_Resist EffectTipsType = 3 //抵抗
|
||||
EffectTipsType_Not_Gain EffectTipsType = 4 //无法获得增益
|
||||
EffectTipsType_Not_Control EffectTipsType = 5 //免疫控制
|
||||
EffectTipsType_Not_Action EffectTipsType = 6 //无法行动
|
||||
EffectTipsType_Purification EffectTipsType = 7 //净化
|
||||
EffectTipsType_Disperse EffectTipsType = 8 //驱散
|
||||
EffectTipsType_Gain_round EffectTipsType = 9 //获得回合
|
||||
EffectTipsType_Add_Operate EffectTipsType = 10 //增加行动值
|
||||
EffectTipsType_Sub_Operate EffectTipsType = 11 //减少行动值
|
||||
EffectTipsType_Standoff EffectTipsType = 12 //对峙
|
||||
EffectTipsType_Undead EffectTipsType = 13 //不死
|
||||
EffectTipsType_Poisoned EffectTipsType = 14 //中毒
|
||||
EffectTipsType_Bleed EffectTipsType = 15 //流血
|
||||
EffectTipsType_Recovery EffectTipsType = 16 //复苏
|
||||
EffectTipsType_BeatBack EffectTipsType = 17 //反击
|
||||
EffectTipsType_Diseased EffectTipsType = 18 //禁疗
|
||||
EffectTipsType_LostHold EffectTipsType = 19 //失手
|
||||
EffectTipsType_UnderStand EffectTipsType = 20 //会心
|
||||
EffectTipsType_Invincibility EffectTipsType = 21 //无敌
|
||||
)
|
||||
|
||||
// Enum value maps for EffectTipsType.
|
||||
@ -70,29 +71,31 @@ var (
|
||||
18: "Diseased",
|
||||
19: "LostHold",
|
||||
20: "UnderStand",
|
||||
21: "Invincibility",
|
||||
}
|
||||
EffectTipsType_value = map[string]int32{
|
||||
"Eff_Success": 0,
|
||||
"Not_Success": 1,
|
||||
"Immunity": 2,
|
||||
"Resist": 3,
|
||||
"Not_Gain": 4,
|
||||
"Not_Control": 5,
|
||||
"Not_Action": 6,
|
||||
"Purification": 7,
|
||||
"Disperse": 8,
|
||||
"Gain_round": 9,
|
||||
"Add_Operate": 10,
|
||||
"Sub_Operate": 11,
|
||||
"Standoff": 12,
|
||||
"Undead": 13,
|
||||
"Poisoned": 14,
|
||||
"Bleed": 15,
|
||||
"Recovery": 16,
|
||||
"BeatBack": 17,
|
||||
"Diseased": 18,
|
||||
"LostHold": 19,
|
||||
"UnderStand": 20,
|
||||
"Eff_Success": 0,
|
||||
"Not_Success": 1,
|
||||
"Immunity": 2,
|
||||
"Resist": 3,
|
||||
"Not_Gain": 4,
|
||||
"Not_Control": 5,
|
||||
"Not_Action": 6,
|
||||
"Purification": 7,
|
||||
"Disperse": 8,
|
||||
"Gain_round": 9,
|
||||
"Add_Operate": 10,
|
||||
"Sub_Operate": 11,
|
||||
"Standoff": 12,
|
||||
"Undead": 13,
|
||||
"Poisoned": 14,
|
||||
"Bleed": 15,
|
||||
"Recovery": 16,
|
||||
"BeatBack": 17,
|
||||
"Diseased": 18,
|
||||
"LostHold": 19,
|
||||
"UnderStand": 20,
|
||||
"Invincibility": 21,
|
||||
}
|
||||
)
|
||||
|
||||
@ -1490,7 +1493,7 @@ type ComPlayEffect struct {
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
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() {
|
||||
@ -1532,11 +1535,11 @@ func (x *ComPlayEffect) GetEffectName() string {
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *ComPlayEffect) GetSide() int32 {
|
||||
func (x *ComPlayEffect) GetNodePath() string {
|
||||
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, 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,
|
||||
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,
|
||||
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,
|
||||
0x01, 0x28, 0x05, 0x52, 0x04, 0x73, 0x69, 0x64, 0x65, 0x22, 0x2c, 0x0a, 0x10, 0x43, 0x6f, 0x6d,
|
||||
0x45, 0x6d, 0x69, 0x74, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x64, 0x6f, 0x77, 0x6e, 0x12, 0x18, 0x0a,
|
||||
0x07, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x07,
|
||||
0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x22, 0x44, 0x0a, 0x0d, 0x43, 0x6f, 0x6d, 0x45, 0x66,
|
||||
0x66, 0x65, 0x63, 0x74, 0x54, 0x69, 0x70, 0x73, 0x12, 0x23, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65,
|
||||
0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x0f, 0x2e, 0x45, 0x66, 0x66, 0x65, 0x63, 0x74, 0x54,
|
||||
0x69, 0x70, 0x73, 0x54, 0x79, 0x70, 0x65, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x0e, 0x0a,
|
||||
0x02, 0x74, 0x6f, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x02, 0x74, 0x6f, 0x22, 0x26, 0x0a,
|
||||
0x0e, 0x43, 0x6f, 0x6d, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x45, 0x66, 0x66, 0x65, 0x63, 0x74, 0x12,
|
||||
0x14, 0x0a, 0x05, 0x72, 0x6f, 0x6c, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x05, 0x52, 0x05,
|
||||
0x72, 0x6f, 0x6c, 0x65, 0x73, 0x22, 0x53, 0x0a, 0x0d, 0x43, 0x6f, 0x6d, 0x53, 0x68, 0x69, 0x65,
|
||||
0x6c, 0x64, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x10, 0x0a, 0x03, 0x72, 0x69, 0x64, 0x18, 0x01, 0x20,
|
||||
0x01, 0x28, 0x05, 0x52, 0x03, 0x72, 0x69, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75,
|
||||
0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x1a,
|
||||
0x0a, 0x08, 0x63, 0x75, 0x72, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05,
|
||||
0x52, 0x08, 0x63, 0x75, 0x72, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x26, 0x0a, 0x0e, 0x43, 0x6f,
|
||||
0x6d, 0x53, 0x77, 0x69, 0x74, 0x63, 0x68, 0x53, 0x63, 0x65, 0x6e, 0x65, 0x12, 0x14, 0x0a, 0x05,
|
||||
0x73, 0x63, 0x65, 0x6e, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x73, 0x63, 0x65,
|
||||
0x6e, 0x65, 0x22, 0x4e, 0x0a, 0x0f, 0x43, 0x6f, 0x6d, 0x52, 0x65, 0x70, 0x6c, 0x61, 0x63, 0x65,
|
||||
0x53, 0x6b, 0x69, 0x6c, 0x6c, 0x12, 0x0e, 0x0a, 0x02, 0x74, 0x6f, 0x18, 0x01, 0x20, 0x01, 0x28,
|
||||
0x05, 0x52, 0x02, 0x74, 0x6f, 0x12, 0x2b, 0x0a, 0x09, 0x73, 0x6b, 0x69, 0x6c, 0x6c, 0x49, 0x6e,
|
||||
0x66, 0x6f, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x43, 0x6f, 0x6d, 0x53, 0x6b,
|
||||
0x69, 0x6c, 0x6c, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x09, 0x73, 0x6b, 0x69, 0x6c, 0x6c, 0x49, 0x6e,
|
||||
0x66, 0x6f, 0x2a, 0xc8, 0x02, 0x0a, 0x0e, 0x45, 0x66, 0x66, 0x65, 0x63, 0x74, 0x54, 0x69, 0x70,
|
||||
0x73, 0x54, 0x79, 0x70, 0x65, 0x12, 0x0f, 0x0a, 0x0b, 0x45, 0x66, 0x66, 0x5f, 0x53, 0x75, 0x63,
|
||||
0x63, 0x65, 0x73, 0x73, 0x10, 0x00, 0x12, 0x0f, 0x0a, 0x0b, 0x4e, 0x6f, 0x74, 0x5f, 0x53, 0x75,
|
||||
0x63, 0x63, 0x65, 0x73, 0x73, 0x10, 0x01, 0x12, 0x0c, 0x0a, 0x08, 0x49, 0x6d, 0x6d, 0x75, 0x6e,
|
||||
0x69, 0x74, 0x79, 0x10, 0x02, 0x12, 0x0a, 0x0a, 0x06, 0x52, 0x65, 0x73, 0x69, 0x73, 0x74, 0x10,
|
||||
0x03, 0x12, 0x0c, 0x0a, 0x08, 0x4e, 0x6f, 0x74, 0x5f, 0x47, 0x61, 0x69, 0x6e, 0x10, 0x04, 0x12,
|
||||
0x0f, 0x0a, 0x0b, 0x4e, 0x6f, 0x74, 0x5f, 0x43, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x10, 0x05,
|
||||
0x12, 0x0e, 0x0a, 0x0a, 0x4e, 0x6f, 0x74, 0x5f, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x10, 0x06,
|
||||
0x12, 0x10, 0x0a, 0x0c, 0x50, 0x75, 0x72, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e,
|
||||
0x10, 0x07, 0x12, 0x0c, 0x0a, 0x08, 0x44, 0x69, 0x73, 0x70, 0x65, 0x72, 0x73, 0x65, 0x10, 0x08,
|
||||
0x12, 0x0e, 0x0a, 0x0a, 0x47, 0x61, 0x69, 0x6e, 0x5f, 0x72, 0x6f, 0x75, 0x6e, 0x64, 0x10, 0x09,
|
||||
0x12, 0x0f, 0x0a, 0x0b, 0x41, 0x64, 0x64, 0x5f, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x65, 0x10,
|
||||
0x0a, 0x12, 0x0f, 0x0a, 0x0b, 0x53, 0x75, 0x62, 0x5f, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x65,
|
||||
0x10, 0x0b, 0x12, 0x0c, 0x0a, 0x08, 0x53, 0x74, 0x61, 0x6e, 0x64, 0x6f, 0x66, 0x66, 0x10, 0x0c,
|
||||
0x12, 0x0a, 0x0a, 0x06, 0x55, 0x6e, 0x64, 0x65, 0x61, 0x64, 0x10, 0x0d, 0x12, 0x0c, 0x0a, 0x08,
|
||||
0x50, 0x6f, 0x69, 0x73, 0x6f, 0x6e, 0x65, 0x64, 0x10, 0x0e, 0x12, 0x09, 0x0a, 0x05, 0x42, 0x6c,
|
||||
0x65, 0x65, 0x64, 0x10, 0x0f, 0x12, 0x0c, 0x0a, 0x08, 0x52, 0x65, 0x63, 0x6f, 0x76, 0x65, 0x72,
|
||||
0x79, 0x10, 0x10, 0x12, 0x0c, 0x0a, 0x08, 0x42, 0x65, 0x61, 0x74, 0x42, 0x61, 0x63, 0x6b, 0x10,
|
||||
0x11, 0x12, 0x0c, 0x0a, 0x08, 0x44, 0x69, 0x73, 0x65, 0x61, 0x73, 0x65, 0x64, 0x10, 0x12, 0x12,
|
||||
0x0c, 0x0a, 0x08, 0x4c, 0x6f, 0x73, 0x74, 0x48, 0x6f, 0x6c, 0x64, 0x10, 0x13, 0x12, 0x0e, 0x0a,
|
||||
0x0a, 0x55, 0x6e, 0x64, 0x65, 0x72, 0x53, 0x74, 0x61, 0x6e, 0x64, 0x10, 0x14, 0x42, 0x06, 0x5a,
|
||||
0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||
0x74, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x6e, 0x6f, 0x64, 0x65, 0x50, 0x61, 0x74,
|
||||
0x68, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x6e, 0x6f, 0x64, 0x65, 0x50, 0x61, 0x74,
|
||||
0x68, 0x22, 0x2c, 0x0a, 0x10, 0x43, 0x6f, 0x6d, 0x45, 0x6d, 0x69, 0x74, 0x43, 0x6f, 0x75, 0x6e,
|
||||
0x74, 0x64, 0x6f, 0x77, 0x6e, 0x12, 0x18, 0x0a, 0x07, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65,
|
||||
0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x07, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x22,
|
||||
0x44, 0x0a, 0x0d, 0x43, 0x6f, 0x6d, 0x45, 0x66, 0x66, 0x65, 0x63, 0x74, 0x54, 0x69, 0x70, 0x73,
|
||||
0x12, 0x23, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x0f,
|
||||
0x2e, 0x45, 0x66, 0x66, 0x65, 0x63, 0x74, 0x54, 0x69, 0x70, 0x73, 0x54, 0x79, 0x70, 0x65, 0x52,
|
||||
0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x74, 0x6f, 0x18, 0x02, 0x20, 0x01, 0x28,
|
||||
0x05, 0x52, 0x02, 0x74, 0x6f, 0x22, 0x26, 0x0a, 0x0e, 0x43, 0x6f, 0x6d, 0x43, 0x68, 0x61, 0x69,
|
||||
0x6e, 0x45, 0x66, 0x66, 0x65, 0x63, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x72, 0x6f, 0x6c, 0x65, 0x73,
|
||||
0x18, 0x01, 0x20, 0x03, 0x28, 0x05, 0x52, 0x05, 0x72, 0x6f, 0x6c, 0x65, 0x73, 0x22, 0x53, 0x0a,
|
||||
0x0d, 0x43, 0x6f, 0x6d, 0x53, 0x68, 0x69, 0x65, 0x6c, 0x64, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x10,
|
||||
0x0a, 0x03, 0x72, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x03, 0x72, 0x69, 0x64,
|
||||
0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52,
|
||||
0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x63, 0x75, 0x72, 0x56, 0x61, 0x6c,
|
||||
0x75, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x08, 0x63, 0x75, 0x72, 0x56, 0x61, 0x6c,
|
||||
0x75, 0x65, 0x22, 0x26, 0x0a, 0x0e, 0x43, 0x6f, 0x6d, 0x53, 0x77, 0x69, 0x74, 0x63, 0x68, 0x53,
|
||||
0x63, 0x65, 0x6e, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x73, 0x63, 0x65, 0x6e, 0x65, 0x18, 0x01, 0x20,
|
||||
0x01, 0x28, 0x09, 0x52, 0x05, 0x73, 0x63, 0x65, 0x6e, 0x65, 0x22, 0x4e, 0x0a, 0x0f, 0x43, 0x6f,
|
||||
0x6d, 0x52, 0x65, 0x70, 0x6c, 0x61, 0x63, 0x65, 0x53, 0x6b, 0x69, 0x6c, 0x6c, 0x12, 0x0e, 0x0a,
|
||||
0x02, 0x74, 0x6f, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x02, 0x74, 0x6f, 0x12, 0x2b, 0x0a,
|
||||
0x09, 0x73, 0x6b, 0x69, 0x6c, 0x6c, 0x49, 0x6e, 0x66, 0x6f, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b,
|
||||
0x32, 0x0d, 0x2e, 0x43, 0x6f, 0x6d, 0x53, 0x6b, 0x69, 0x6c, 0x6c, 0x49, 0x6e, 0x66, 0x6f, 0x52,
|
||||
0x09, 0x73, 0x6b, 0x69, 0x6c, 0x6c, 0x49, 0x6e, 0x66, 0x6f, 0x2a, 0xdb, 0x02, 0x0a, 0x0e, 0x45,
|
||||
0x66, 0x66, 0x65, 0x63, 0x74, 0x54, 0x69, 0x70, 0x73, 0x54, 0x79, 0x70, 0x65, 0x12, 0x0f, 0x0a,
|
||||
0x0b, 0x45, 0x66, 0x66, 0x5f, 0x53, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x10, 0x00, 0x12, 0x0f,
|
||||
0x0a, 0x0b, 0x4e, 0x6f, 0x74, 0x5f, 0x53, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x10, 0x01, 0x12,
|
||||
0x0c, 0x0a, 0x08, 0x49, 0x6d, 0x6d, 0x75, 0x6e, 0x69, 0x74, 0x79, 0x10, 0x02, 0x12, 0x0a, 0x0a,
|
||||
0x06, 0x52, 0x65, 0x73, 0x69, 0x73, 0x74, 0x10, 0x03, 0x12, 0x0c, 0x0a, 0x08, 0x4e, 0x6f, 0x74,
|
||||
0x5f, 0x47, 0x61, 0x69, 0x6e, 0x10, 0x04, 0x12, 0x0f, 0x0a, 0x0b, 0x4e, 0x6f, 0x74, 0x5f, 0x43,
|
||||
0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x10, 0x05, 0x12, 0x0e, 0x0a, 0x0a, 0x4e, 0x6f, 0x74, 0x5f,
|
||||
0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x10, 0x06, 0x12, 0x10, 0x0a, 0x0c, 0x50, 0x75, 0x72, 0x69,
|
||||
0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x10, 0x07, 0x12, 0x0c, 0x0a, 0x08, 0x44, 0x69,
|
||||
0x73, 0x70, 0x65, 0x72, 0x73, 0x65, 0x10, 0x08, 0x12, 0x0e, 0x0a, 0x0a, 0x47, 0x61, 0x69, 0x6e,
|
||||
0x5f, 0x72, 0x6f, 0x75, 0x6e, 0x64, 0x10, 0x09, 0x12, 0x0f, 0x0a, 0x0b, 0x41, 0x64, 0x64, 0x5f,
|
||||
0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x65, 0x10, 0x0a, 0x12, 0x0f, 0x0a, 0x0b, 0x53, 0x75, 0x62,
|
||||
0x5f, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x65, 0x10, 0x0b, 0x12, 0x0c, 0x0a, 0x08, 0x53, 0x74,
|
||||
0x61, 0x6e, 0x64, 0x6f, 0x66, 0x66, 0x10, 0x0c, 0x12, 0x0a, 0x0a, 0x06, 0x55, 0x6e, 0x64, 0x65,
|
||||
0x61, 0x64, 0x10, 0x0d, 0x12, 0x0c, 0x0a, 0x08, 0x50, 0x6f, 0x69, 0x73, 0x6f, 0x6e, 0x65, 0x64,
|
||||
0x10, 0x0e, 0x12, 0x09, 0x0a, 0x05, 0x42, 0x6c, 0x65, 0x65, 0x64, 0x10, 0x0f, 0x12, 0x0c, 0x0a,
|
||||
0x08, 0x52, 0x65, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x79, 0x10, 0x10, 0x12, 0x0c, 0x0a, 0x08, 0x42,
|
||||
0x65, 0x61, 0x74, 0x42, 0x61, 0x63, 0x6b, 0x10, 0x11, 0x12, 0x0c, 0x0a, 0x08, 0x44, 0x69, 0x73,
|
||||
0x65, 0x61, 0x73, 0x65, 0x64, 0x10, 0x12, 0x12, 0x0c, 0x0a, 0x08, 0x4c, 0x6f, 0x73, 0x74, 0x48,
|
||||
0x6f, 0x6c, 0x64, 0x10, 0x13, 0x12, 0x0e, 0x0a, 0x0a, 0x55, 0x6e, 0x64, 0x65, 0x72, 0x53, 0x74,
|
||||
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 (
|
||||
|
@ -25,18 +25,20 @@ type DBFriend struct {
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
Uid string `protobuf:"bytes,1,opt,name=uid,proto3" json:"uid" bson:"uid"` //用户ID
|
||||
FriendIds []string `protobuf:"bytes,2,rep,name=friendIds,proto3" json:"friendIds" bson:"friendIds"` //好友ID
|
||||
ApplyIds []string `protobuf:"bytes,3,rep,name=applyIds,proto3" json:"applyIds" bson:"applyIds"` //申请用户ID
|
||||
BlackIds []string `protobuf:"bytes,4,rep,name=blackIds,proto3" json:"blackIds" bson:"blackIds"` //黑名单ID
|
||||
ZanIds []string `protobuf:"bytes,5,rep,name=zanIds,proto3" json:"zanIds" bson:"zanIds"` //点赞好友ID
|
||||
GetZandIds []string `protobuf:"bytes,6,rep,name=getZandIds,proto3" json:"getZandIds" bson:"getZandIds"` //已接收赞好友ID
|
||||
AssistHeroId string `protobuf:"bytes,7,opt,name=assistHeroId,proto3" json:"assistHeroId" bson:"assistHeroId"` //助战英雄ID
|
||||
Received int32 `protobuf:"varint,8,opt,name=received,proto3" json:"received" bson:"received"` //领取奖励状态0未领1可领2已领
|
||||
UpdateTime int64 `protobuf:"varint,9,opt,name=updateTime,proto3" json:"updateTime" bson:"updateTime"` // 更新时间
|
||||
Hero *DBHero `protobuf:"bytes,10,opt,name=hero,proto3" json:"hero" bson:"hero"` //助战英雄副本
|
||||
AssistScore int32 `protobuf:"varint,11,opt,name=assistScore,proto3" json:"assistScore" bson:"assistScore"` //助战分数合计
|
||||
Record []*AssistRecord `protobuf:"bytes,12,rep,name=record,proto3" json:"record" bson:"record"` // 助战记录
|
||||
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
|
||||
Info *BaseUserInfo `protobuf:"bytes,3,opt,name=info,proto3" json:"info"`
|
||||
FriendIds []string `protobuf:"bytes,4,rep,name=friendIds,proto3" json:"friendIds" bson:"friendIds"` //好友ID
|
||||
ApplyIds []string `protobuf:"bytes,5,rep,name=applyIds,proto3" json:"applyIds" bson:"applyIds"` //申请用户ID
|
||||
BlackIds []string `protobuf:"bytes,6,rep,name=blackIds,proto3" json:"blackIds" bson:"blackIds"` //黑名单ID
|
||||
ZanIds []string `protobuf:"bytes,7,rep,name=zanIds,proto3" json:"zanIds" bson:"zanIds"` //点赞好友ID
|
||||
GetZandIds []string `protobuf:"bytes,8,rep,name=getZandIds,proto3" json:"getZandIds" bson:"getZandIds"` //已接收赞好友ID
|
||||
AssistHeroId string `protobuf:"bytes,9,opt,name=assistHeroId,proto3" json:"assistHeroId" bson:"assistHeroId"` //助战英雄ID
|
||||
Received int32 `protobuf:"varint,10,opt,name=received,proto3" json:"received" bson:"received"` //领取奖励状态0未领1可领2已领
|
||||
UpdateTime int64 `protobuf:"varint,11,opt,name=updateTime,proto3" json:"updateTime" bson:"updateTime"` // 更新时间
|
||||
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() {
|
||||
@ -71,6 +73,13 @@ func (*DBFriend) Descriptor() ([]byte, []int) {
|
||||
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 {
|
||||
if x != nil {
|
||||
return x.Uid
|
||||
@ -78,6 +87,13 @@ func (x *DBFriend) GetUid() string {
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *DBFriend) GetInfo() *BaseUserInfo {
|
||||
if x != nil {
|
||||
return x.Info
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *DBFriend) GetFriendIds() []string {
|
||||
if x != nil {
|
||||
return x.FriendIds
|
||||
@ -312,48 +328,52 @@ var File_friend_friend_db_proto protoreflect.FileDescriptor
|
||||
var file_friend_friend_db_proto_rawDesc = []byte{
|
||||
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,
|
||||
0x65, 0x72, 0x6f, 0x5f, 0x64, 0x62, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xf0, 0x02, 0x0a,
|
||||
0x08, 0x44, 0x42, 0x46, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x12, 0x10, 0x0a, 0x03, 0x75, 0x69, 0x64,
|
||||
0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x75, 0x69, 0x64, 0x12, 0x1c, 0x0a, 0x09, 0x66,
|
||||
0x72, 0x69, 0x65, 0x6e, 0x64, 0x49, 0x64, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x09,
|
||||
0x66, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x49, 0x64, 0x73, 0x12, 0x1a, 0x0a, 0x08, 0x61, 0x70, 0x70,
|
||||
0x6c, 0x79, 0x49, 0x64, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x09, 0x52, 0x08, 0x61, 0x70, 0x70,
|
||||
0x6c, 0x79, 0x49, 0x64, 0x73, 0x12, 0x1a, 0x0a, 0x08, 0x62, 0x6c, 0x61, 0x63, 0x6b, 0x49, 0x64,
|
||||
0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x09, 0x52, 0x08, 0x62, 0x6c, 0x61, 0x63, 0x6b, 0x49, 0x64,
|
||||
0x73, 0x12, 0x16, 0x0a, 0x06, 0x7a, 0x61, 0x6e, 0x49, 0x64, 0x73, 0x18, 0x05, 0x20, 0x03, 0x28,
|
||||
0x09, 0x52, 0x06, 0x7a, 0x61, 0x6e, 0x49, 0x64, 0x73, 0x12, 0x1e, 0x0a, 0x0a, 0x67, 0x65, 0x74,
|
||||
0x5a, 0x61, 0x6e, 0x64, 0x49, 0x64, 0x73, 0x18, 0x06, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0a, 0x67,
|
||||
0x65, 0x74, 0x5a, 0x61, 0x6e, 0x64, 0x49, 0x64, 0x73, 0x12, 0x22, 0x0a, 0x0c, 0x61, 0x73, 0x73,
|
||||
0x69, 0x73, 0x74, 0x48, 0x65, 0x72, 0x6f, 0x49, 0x64, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52,
|
||||
0x0c, 0x61, 0x73, 0x73, 0x69, 0x73, 0x74, 0x48, 0x65, 0x72, 0x6f, 0x49, 0x64, 0x12, 0x1a, 0x0a,
|
||||
0x08, 0x72, 0x65, 0x63, 0x65, 0x69, 0x76, 0x65, 0x64, 0x18, 0x08, 0x20, 0x01, 0x28, 0x05, 0x52,
|
||||
0x08, 0x72, 0x65, 0x63, 0x65, 0x69, 0x76, 0x65, 0x64, 0x12, 0x1e, 0x0a, 0x0a, 0x75, 0x70, 0x64,
|
||||
0x61, 0x74, 0x65, 0x54, 0x69, 0x6d, 0x65, 0x18, 0x09, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0a, 0x75,
|
||||
0x70, 0x64, 0x61, 0x74, 0x65, 0x54, 0x69, 0x6d, 0x65, 0x12, 0x1b, 0x0a, 0x04, 0x68, 0x65, 0x72,
|
||||
0x6f, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x07, 0x2e, 0x44, 0x42, 0x48, 0x65, 0x72, 0x6f,
|
||||
0x52, 0x04, 0x68, 0x65, 0x72, 0x6f, 0x12, 0x20, 0x0a, 0x0b, 0x61, 0x73, 0x73, 0x69, 0x73, 0x74,
|
||||
0x53, 0x63, 0x6f, 0x72, 0x65, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0b, 0x61, 0x73, 0x73,
|
||||
0x69, 0x73, 0x74, 0x53, 0x63, 0x6f, 0x72, 0x65, 0x12, 0x25, 0x0a, 0x06, 0x72, 0x65, 0x63, 0x6f,
|
||||
0x72, 0x64, 0x18, 0x0c, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x41, 0x73, 0x73, 0x69, 0x73,
|
||||
0x74, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x52, 0x06, 0x72, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x22,
|
||||
0x64, 0x0a, 0x0c, 0x41, 0x73, 0x73, 0x69, 0x73, 0x74, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x12,
|
||||
0x10, 0x0a, 0x03, 0x75, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x75, 0x69,
|
||||
0x64, 0x12, 0x1e, 0x0a, 0x0a, 0x61, 0x73, 0x73, 0x69, 0x73, 0x74, 0x54, 0x69, 0x6d, 0x65, 0x18,
|
||||
0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0a, 0x61, 0x73, 0x73, 0x69, 0x73, 0x74, 0x54, 0x69, 0x6d,
|
||||
0x65, 0x12, 0x22, 0x0a, 0x0c, 0x61, 0x73, 0x73, 0x69, 0x73, 0x74, 0x48, 0x65, 0x72, 0x6f, 0x49,
|
||||
0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x61, 0x73, 0x73, 0x69, 0x73, 0x74, 0x48,
|
||||
0x65, 0x72, 0x6f, 0x49, 0x64, 0x22, 0xa6, 0x01, 0x0a, 0x0c, 0x51, 0x69, 0x65, 0x63, 0x75, 0x6f,
|
||||
0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x12, 0x10, 0x0a, 0x03, 0x75, 0x69, 0x64, 0x18, 0x01, 0x20,
|
||||
0x01, 0x28, 0x09, 0x52, 0x03, 0x75, 0x69, 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x74, 0x61, 0x72, 0x67,
|
||||
0x65, 0x74, 0x49, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x74, 0x61, 0x72, 0x67,
|
||||
0x65, 0x74, 0x49, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x03,
|
||||
0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x18, 0x0a, 0x07,
|
||||
0x6d, 0x61, 0x74, 0x63, 0x68, 0x49, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x6d,
|
||||
0x61, 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,
|
||||
0x65, 0x72, 0x6f, 0x5f, 0x64, 0x62, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x0a, 0x63, 0x6f,
|
||||
0x6d, 0x6d, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xa3, 0x03, 0x0a, 0x08, 0x44, 0x42, 0x46,
|
||||
0x72, 0x69, 0x65, 0x6e, 0x64, 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, 0x21, 0x0a, 0x04, 0x69, 0x6e, 0x66, 0x6f, 0x18,
|
||||
0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x42, 0x61, 0x73, 0x65, 0x55, 0x73, 0x65, 0x72,
|
||||
0x49, 0x6e, 0x66, 0x6f, 0x52, 0x04, 0x69, 0x6e, 0x66, 0x6f, 0x12, 0x1c, 0x0a, 0x09, 0x66, 0x72,
|
||||
0x69, 0x65, 0x6e, 0x64, 0x49, 0x64, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x09, 0x52, 0x09, 0x66,
|
||||
0x72, 0x69, 0x65, 0x6e, 0x64, 0x49, 0x64, 0x73, 0x12, 0x1a, 0x0a, 0x08, 0x61, 0x70, 0x70, 0x6c,
|
||||
0x79, 0x49, 0x64, 0x73, 0x18, 0x05, 0x20, 0x03, 0x28, 0x09, 0x52, 0x08, 0x61, 0x70, 0x70, 0x6c,
|
||||
0x79, 0x49, 0x64, 0x73, 0x12, 0x1a, 0x0a, 0x08, 0x62, 0x6c, 0x61, 0x63, 0x6b, 0x49, 0x64, 0x73,
|
||||
0x18, 0x06, 0x20, 0x03, 0x28, 0x09, 0x52, 0x08, 0x62, 0x6c, 0x61, 0x63, 0x6b, 0x49, 0x64, 0x73,
|
||||
0x12, 0x16, 0x0a, 0x06, 0x7a, 0x61, 0x6e, 0x49, 0x64, 0x73, 0x18, 0x07, 0x20, 0x03, 0x28, 0x09,
|
||||
0x52, 0x06, 0x7a, 0x61, 0x6e, 0x49, 0x64, 0x73, 0x12, 0x1e, 0x0a, 0x0a, 0x67, 0x65, 0x74, 0x5a,
|
||||
0x61, 0x6e, 0x64, 0x49, 0x64, 0x73, 0x18, 0x08, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0a, 0x67, 0x65,
|
||||
0x74, 0x5a, 0x61, 0x6e, 0x64, 0x49, 0x64, 0x73, 0x12, 0x22, 0x0a, 0x0c, 0x61, 0x73, 0x73, 0x69,
|
||||
0x73, 0x74, 0x48, 0x65, 0x72, 0x6f, 0x49, 0x64, 0x18, 0x09, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c,
|
||||
0x61, 0x73, 0x73, 0x69, 0x73, 0x74, 0x48, 0x65, 0x72, 0x6f, 0x49, 0x64, 0x12, 0x1a, 0x0a, 0x08,
|
||||
0x72, 0x65, 0x63, 0x65, 0x69, 0x76, 0x65, 0x64, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x05, 0x52, 0x08,
|
||||
0x72, 0x65, 0x63, 0x65, 0x69, 0x76, 0x65, 0x64, 0x12, 0x1e, 0x0a, 0x0a, 0x75, 0x70, 0x64, 0x61,
|
||||
0x74, 0x65, 0x54, 0x69, 0x6d, 0x65, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0a, 0x75, 0x70,
|
||||
0x64, 0x61, 0x74, 0x65, 0x54, 0x69, 0x6d, 0x65, 0x12, 0x1b, 0x0a, 0x04, 0x68, 0x65, 0x72, 0x6f,
|
||||
0x18, 0x0c, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x07, 0x2e, 0x44, 0x42, 0x48, 0x65, 0x72, 0x6f, 0x52,
|
||||
0x04, 0x68, 0x65, 0x72, 0x6f, 0x12, 0x20, 0x0a, 0x0b, 0x61, 0x73, 0x73, 0x69, 0x73, 0x74, 0x53,
|
||||
0x63, 0x6f, 0x72, 0x65, 0x18, 0x0d, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0b, 0x61, 0x73, 0x73, 0x69,
|
||||
0x73, 0x74, 0x53, 0x63, 0x6f, 0x72, 0x65, 0x12, 0x25, 0x0a, 0x06, 0x72, 0x65, 0x63, 0x6f, 0x72,
|
||||
0x64, 0x18, 0x0e, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x41, 0x73, 0x73, 0x69, 0x73, 0x74,
|
||||
0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x52, 0x06, 0x72, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x22, 0x64,
|
||||
0x0a, 0x0c, 0x41, 0x73, 0x73, 0x69, 0x73, 0x74, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x12, 0x10,
|
||||
0x0a, 0x03, 0x75, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x75, 0x69, 0x64,
|
||||
0x12, 0x1e, 0x0a, 0x0a, 0x61, 0x73, 0x73, 0x69, 0x73, 0x74, 0x54, 0x69, 0x6d, 0x65, 0x18, 0x02,
|
||||
0x20, 0x01, 0x28, 0x03, 0x52, 0x0a, 0x61, 0x73, 0x73, 0x69, 0x73, 0x74, 0x54, 0x69, 0x6d, 0x65,
|
||||
0x12, 0x22, 0x0a, 0x0c, 0x61, 0x73, 0x73, 0x69, 0x73, 0x74, 0x48, 0x65, 0x72, 0x6f, 0x49, 0x64,
|
||||
0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x61, 0x73, 0x73, 0x69, 0x73, 0x74, 0x48, 0x65,
|
||||
0x72, 0x6f, 0x49, 0x64, 0x22, 0xa6, 0x01, 0x0a, 0x0c, 0x51, 0x69, 0x65, 0x63, 0x75, 0x6f, 0x52,
|
||||
0x65, 0x63, 0x6f, 0x72, 0x64, 0x12, 0x10, 0x0a, 0x03, 0x75, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01,
|
||||
0x28, 0x09, 0x52, 0x03, 0x75, 0x69, 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x74, 0x61, 0x72, 0x67, 0x65,
|
||||
0x74, 0x49, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x74, 0x61, 0x72, 0x67, 0x65,
|
||||
0x74, 0x49, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x03, 0x20,
|
||||
0x01, 0x28, 0x05, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x18, 0x0a, 0x07, 0x6d,
|
||||
0x61, 0x74, 0x63, 0x68, 0x49, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x6d, 0x61,
|
||||
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 (
|
||||
@ -373,16 +393,18 @@ var file_friend_friend_db_proto_goTypes = []interface{}{
|
||||
(*DBFriend)(nil), // 0: DBFriend
|
||||
(*AssistRecord)(nil), // 1: AssistRecord
|
||||
(*QiecuoRecord)(nil), // 2: QiecuoRecord
|
||||
(*DBHero)(nil), // 3: DBHero
|
||||
(*BaseUserInfo)(nil), // 3: BaseUserInfo
|
||||
(*DBHero)(nil), // 4: DBHero
|
||||
}
|
||||
var file_friend_friend_db_proto_depIdxs = []int32{
|
||||
3, // 0: DBFriend.hero:type_name -> DBHero
|
||||
1, // 1: DBFriend.record:type_name -> AssistRecord
|
||||
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
|
||||
3, // 0: DBFriend.info:type_name -> BaseUserInfo
|
||||
4, // 1: DBFriend.hero:type_name -> DBHero
|
||||
1, // 2: DBFriend.record:type_name -> AssistRecord
|
||||
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_friend_friend_db_proto_init() }
|
||||
@ -391,6 +413,7 @@ func file_friend_friend_db_proto_init() {
|
||||
return
|
||||
}
|
||||
file_hero_hero_db_proto_init()
|
||||
file_comm_proto_init()
|
||||
if !protoimpl.UnsafeEnabled {
|
||||
file_friend_friend_db_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*DBFriend); i {
|
||||
|
@ -99,7 +99,7 @@ func main() {
|
||||
log.SetLoglevel(log.DebugLevel),
|
||||
log.SetUniqueLog(true),
|
||||
log.SetIsDebug(true)); err != nil {
|
||||
panic(fmt.Sprintf("Sys log Init err:%v", err))
|
||||
panic(fmt.Sprintf("Sys log Init err:%v !", err))
|
||||
} else {
|
||||
log.Infof("Sys log Init success !")
|
||||
}
|
||||
|
@ -154,13 +154,24 @@ func (this *SCompGateRoute) ReceiveMsg(ctx context.Context, args *pb.AgentMessag
|
||||
} else {
|
||||
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.Debug("[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()},
|
||||
)
|
||||
nt := time.Since(stime).Milliseconds()
|
||||
if nt < 100 {
|
||||
log.Debug("[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 {
|
||||
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 { //未找到消息处理函数
|
||||
log.Errorf("[Handle Api] no found handle %s", method)
|
||||
|
@ -22,7 +22,7 @@ func (this *ServiceBase) InitSys() {
|
||||
this.RPCXService.InitSys()
|
||||
//初始化配置中心系统 每个服务都会用到的就在这个初始化就好
|
||||
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 {
|
||||
configure.Start()
|
||||
log.Infof("init sys.configure success!")
|
||||
|
@ -819,6 +819,94 @@ func (this *DBModel) GetList(uid string, data interface{}) (err error) {
|
||||
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) {
|
||||
//defer log.Debug("DBModel GetQueues", log.Field{Key: "TableName", Value: this.TableName}, log.Field{Key: "key", Value: key}, log.Field{Key: "data", Value: data})
|
||||
|
Loading…
Reference in New Issue
Block a user