From f0fbbb13c13e1e5a6fdfedbbd173bedd5324a018 Mon Sep 17 00:00:00 2001 From: meixiongfeng <766881921@qq.com> Date: Mon, 25 Dec 2023 11:10:31 +0800 Subject: [PATCH 1/8] =?UTF-8?q?=20=E5=A5=BD=E5=8F=8B=E7=B3=BB=E7=BB=9F-?= =?UTF-8?q?=E7=94=B3=E8=AF=B7=E5=88=97=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- modules/friend/api_cross_apply.go | 14 ++++++++++ pb/entertain_db.pb.go | 43 +++++++++++++++---------------- pb/friend_db.pb.go | 14 ++++++++-- 3 files changed, 47 insertions(+), 24 deletions(-) diff --git a/modules/friend/api_cross_apply.go b/modules/friend/api_cross_apply.go index 6b56ee154..ce967054b 100644 --- a/modules/friend/api_cross_apply.go +++ b/modules/friend/api_cross_apply.go @@ -154,6 +154,20 @@ func (this *apiComp) Apply(session comm.IUserSession, req *pb.FriendApplyReq) (e log.Field{Key: "err", Value: err.Error()}, ) } + if _, ok := utils.Find(self.Weapplyids, req.FriendId); !ok { + target.Weapplyids = append(target.Weapplyids, req.FriendId) + if err = this.module.modelFriend.Change(session.GetUserId(), map[string]interface{}{ + "weapplyids": target.Weapplyids, + }); err != nil { + errdata = &pb.ErrorData{ + Code: pb.ErrorCode_DBError, + Title: pb.ErrorCode_DBError.ToString(), + Message: err.Error(), + } + return + } + } + resp := &pb.FriendApplyResp{ UserId: session.GetUserId(), FriendId: req.FriendId, diff --git a/pb/entertain_db.pb.go b/pb/entertain_db.pb.go index 58518dbf0..d4c5dc9e0 100644 --- a/pb/entertain_db.pb.go +++ b/pb/entertain_db.pb.go @@ -399,28 +399,27 @@ type DBXXLData struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id" bson:"_id"` //ID - Uid string `protobuf:"bytes,2,opt,name=uid,proto3" json:"uid" bson:"uid"` //用户ID - Reward map[int32]int32 `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 配置表唯一ID - Card map[string]int32 `protobuf:"bytes,4,rep,name=card,proto3" json:"card" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3"` // key 卡id value 数量(可为0) - Rtime int64 `protobuf:"varint,5,opt,name=rtime,proto3" json:"rtime"` // 刷新时间 (客户端不用) - Playtype []int32 `protobuf:"varint,6,rep,packed,name=playtype,proto3" json:"playtype"` // 每天随机玩法 - // map boxid = 7; // 宝箱 key 宝箱id value 可领取的时间 - Box []*BoxData `protobuf:"bytes,7,rep,name=box,proto3" json:"box"` - Roomid string `protobuf:"bytes,8,opt,name=roomid,proto3" json:"roomid"` // 房间id 重连用 - ServicePath string `protobuf:"bytes,9,opt,name=servicePath,proto3" json:"servicePath"` // 目标服务节点 重连RPC用 - Etime int64 `protobuf:"varint,10,opt,name=etime,proto3" json:"etime"` // 赛季结束时间 - Touxiang int32 `protobuf:"varint,11,opt,name=touxiang,proto3" json:"touxiang"` // 今天投降的次数 - Skill map[int32]int32 `protobuf:"bytes,12,rep,name=skill,proto3" json:"skill" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3"` // key 技能id value 数量(可为0) - Liansheng int32 `protobuf:"varint,13,opt,name=liansheng,proto3" json:"liansheng"` // 连胜 - Freeprogress int32 `protobuf:"varint,14,opt,name=freeprogress,proto3" json:"freeprogress"` //已领取进度 - Payprogress int32 `protobuf:"varint,15,opt,name=payprogress,proto3" json:"payprogress"` - Vip bool `protobuf:"varint,16,opt,name=vip,proto3" json:"vip"` // 是否购买 - Maxconsumeexp int32 `protobuf:"varint,17,opt,name=maxconsumeexp,proto3" json:"maxconsumeexp"` // 最大赛季积分 - Consumeexp int32 `protobuf:"varint,18,opt,name=consumeexp,proto3" json:"consumeexp"` //赛季积分 - Maxsocre int32 `protobuf:"varint,19,opt,name=maxsocre,proto3" json:"maxsocre"` // 单局最大得分 - Uinfo *BaseUserInfo `protobuf:"bytes,20,opt,name=uinfo,proto3" json:"uinfo"` //用户基础 - Taskprogess int32 `protobuf:"varint,21,opt,name=taskprogess,proto3" json:"taskprogess"` // 任务奖励进度 + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id" bson:"_id"` //ID + Uid string `protobuf:"bytes,2,opt,name=uid,proto3" json:"uid" bson:"uid"` //用户ID + Reward map[int32]int32 `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 配置表唯一ID + Card map[string]int32 `protobuf:"bytes,4,rep,name=card,proto3" json:"card" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3"` // key 卡id value 数量(可为0) + Rtime int64 `protobuf:"varint,5,opt,name=rtime,proto3" json:"rtime"` // 刷新时间 (客户端不用) + Playtype []int32 `protobuf:"varint,6,rep,packed,name=playtype,proto3" json:"playtype"` // 每天随机玩法 + Box []*BoxData `protobuf:"bytes,7,rep,name=box,proto3" json:"box"` + Roomid string `protobuf:"bytes,8,opt,name=roomid,proto3" json:"roomid"` // 房间id 重连用 + ServicePath string `protobuf:"bytes,9,opt,name=servicePath,proto3" json:"servicePath"` // 目标服务节点 重连RPC用 + Etime int64 `protobuf:"varint,10,opt,name=etime,proto3" json:"etime"` // 赛季结束时间 + Touxiang int32 `protobuf:"varint,11,opt,name=touxiang,proto3" json:"touxiang"` // 今天投降的次数 + Skill map[int32]int32 `protobuf:"bytes,12,rep,name=skill,proto3" json:"skill" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3"` // key 技能id value 数量(可为0) + Liansheng int32 `protobuf:"varint,13,opt,name=liansheng,proto3" json:"liansheng"` // 连胜 + Freeprogress int32 `protobuf:"varint,14,opt,name=freeprogress,proto3" json:"freeprogress"` //已领取进度 + Payprogress int32 `protobuf:"varint,15,opt,name=payprogress,proto3" json:"payprogress"` + Vip bool `protobuf:"varint,16,opt,name=vip,proto3" json:"vip"` // 是否购买 + Maxconsumeexp int32 `protobuf:"varint,17,opt,name=maxconsumeexp,proto3" json:"maxconsumeexp"` // 最大赛季积分 + Consumeexp int32 `protobuf:"varint,18,opt,name=consumeexp,proto3" json:"consumeexp"` //赛季积分 + Maxsocre int32 `protobuf:"varint,19,opt,name=maxsocre,proto3" json:"maxsocre"` // 单局最大得分 + Uinfo *BaseUserInfo `protobuf:"bytes,20,opt,name=uinfo,proto3" json:"uinfo"` //用户基础 + Taskprogess int32 `protobuf:"varint,21,opt,name=taskprogess,proto3" json:"taskprogess"` // 任务奖励进度 } func (x *DBXXLData) Reset() { diff --git a/pb/friend_db.pb.go b/pb/friend_db.pb.go index 2b203750a..a09beea2f 100644 --- a/pb/friend_db.pb.go +++ b/pb/friend_db.pb.go @@ -39,6 +39,7 @@ type DBFriend struct { 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"` // 助战记录 + Weapplyids []string `protobuf:"bytes,15,rep,name=weapplyids,proto3" json:"weapplyids" bson:"weapplyids"` //我申请的用户ID } func (x *DBFriend) Reset() { @@ -171,6 +172,13 @@ func (x *DBFriend) GetRecord() []*AssistRecord { return nil } +func (x *DBFriend) GetWeapplyids() []string { + if x != nil { + return x.Weapplyids + } + return nil +} + //助战记录 type AssistRecord struct { state protoimpl.MessageState @@ -329,7 +337,7 @@ 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, 0x1a, 0x0a, 0x63, 0x6f, - 0x6d, 0x6d, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xa3, 0x03, 0x0a, 0x08, 0x44, 0x42, 0x46, + 0x6d, 0x6d, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xc3, 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, @@ -355,7 +363,9 @@ var file_friend_friend_db_proto_rawDesc = []byte{ 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, + 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x52, 0x06, 0x72, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x12, 0x1e, + 0x0a, 0x0a, 0x77, 0x65, 0x61, 0x70, 0x70, 0x6c, 0x79, 0x69, 0x64, 0x73, 0x18, 0x0f, 0x20, 0x03, + 0x28, 0x09, 0x52, 0x0a, 0x77, 0x65, 0x61, 0x70, 0x70, 0x6c, 0x79, 0x69, 0x64, 0x73, 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, From 0e3e9613bba67d554eafc4ea93dee6e63cd44f81 Mon Sep 17 00:00:00 2001 From: meixiongfeng <766881921@qq.com> Date: Mon, 25 Dec 2023 11:27:58 +0800 Subject: [PATCH 2/8] =?UTF-8?q?=E5=A5=BD=E5=8F=8B=E7=94=B3=E8=AF=B7?= =?UTF-8?q?=E5=88=97=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- modules/friend/api_cross_apply.go | 5 +++-- pb/friend_msg.pb.go | 16 +++++++++++++--- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/modules/friend/api_cross_apply.go b/modules/friend/api_cross_apply.go index ce967054b..525d5a373 100644 --- a/modules/friend/api_cross_apply.go +++ b/modules/friend/api_cross_apply.go @@ -169,8 +169,9 @@ func (this *apiComp) Apply(session comm.IUserSession, req *pb.FriendApplyReq) (e } resp := &pb.FriendApplyResp{ - UserId: session.GetUserId(), - FriendId: req.FriendId, + UserId: session.GetUserId(), + FriendId: req.FriendId, + Weapplyids: self.Weapplyids, } session.SendMsg(string(this.module.GetType()), FriendSubTypeApply, resp) diff --git a/pb/friend_msg.pb.go b/pb/friend_msg.pb.go index c1630366b..773aec533 100644 --- a/pb/friend_msg.pb.go +++ b/pb/friend_msg.pb.go @@ -404,8 +404,9 @@ type FriendApplyResp struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - UserId string `protobuf:"bytes,1,opt,name=userId,proto3" json:"userId"` //用户ID - FriendId string `protobuf:"bytes,2,opt,name=friendId,proto3" json:"friendId"` //好友ID + UserId string `protobuf:"bytes,1,opt,name=userId,proto3" json:"userId"` //用户ID + FriendId string `protobuf:"bytes,2,opt,name=friendId,proto3" json:"friendId"` //好友ID + Weapplyids []string `protobuf:"bytes,3,rep,name=weapplyids,proto3" json:"weapplyids"` // 我申请的用户ID } func (x *FriendApplyResp) Reset() { @@ -454,6 +455,13 @@ func (x *FriendApplyResp) GetFriendId() string { return "" } +func (x *FriendApplyResp) GetWeapplyids() []string { + if x != nil { + return x.Weapplyids + } + return nil +} + //删除好友 type FriendDelReq struct { state protoimpl.MessageState @@ -2394,11 +2402,13 @@ var file_friend_friend_msg_proto_rawDesc = []byte{ 0x64, 0x42, 0x61, 0x73, 0x65, 0x52, 0x04, 0x6c, 0x69, 0x73, 0x74, 0x22, 0x2c, 0x0a, 0x0e, 0x46, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x41, 0x70, 0x70, 0x6c, 0x79, 0x52, 0x65, 0x71, 0x12, 0x1a, 0x0a, 0x08, 0x66, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x08, 0x66, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x49, 0x64, 0x22, 0x45, 0x0a, 0x0f, 0x46, 0x72, 0x69, + 0x08, 0x66, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x49, 0x64, 0x22, 0x65, 0x0a, 0x0f, 0x46, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x41, 0x70, 0x70, 0x6c, 0x79, 0x52, 0x65, 0x73, 0x70, 0x12, 0x16, 0x0a, 0x06, 0x75, 0x73, 0x65, 0x72, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x75, 0x73, 0x65, 0x72, 0x49, 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x66, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x49, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x66, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x49, 0x64, + 0x12, 0x1e, 0x0a, 0x0a, 0x77, 0x65, 0x61, 0x70, 0x70, 0x6c, 0x79, 0x69, 0x64, 0x73, 0x18, 0x03, + 0x20, 0x03, 0x28, 0x09, 0x52, 0x0a, 0x77, 0x65, 0x61, 0x70, 0x70, 0x6c, 0x79, 0x69, 0x64, 0x73, 0x22, 0x2a, 0x0a, 0x0c, 0x46, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x44, 0x65, 0x6c, 0x52, 0x65, 0x71, 0x12, 0x1a, 0x0a, 0x08, 0x66, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x66, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x49, 0x64, 0x22, 0x43, 0x0a, 0x0d, From 8fa045418460b1e27eb6e938e858aae01ea62f28 Mon Sep 17 00:00:00 2001 From: meixiongfeng <766881921@qq.com> Date: Mon, 25 Dec 2023 14:11:41 +0800 Subject: [PATCH 3/8] =?UTF-8?q?=E5=A5=BD=E5=8F=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- modules/friend/api_cross_apply.go | 5 ++--- pb/friend_msg.pb.go | 16 +++------------- 2 files changed, 5 insertions(+), 16 deletions(-) diff --git a/modules/friend/api_cross_apply.go b/modules/friend/api_cross_apply.go index 525d5a373..ce967054b 100644 --- a/modules/friend/api_cross_apply.go +++ b/modules/friend/api_cross_apply.go @@ -169,9 +169,8 @@ func (this *apiComp) Apply(session comm.IUserSession, req *pb.FriendApplyReq) (e } resp := &pb.FriendApplyResp{ - UserId: session.GetUserId(), - FriendId: req.FriendId, - Weapplyids: self.Weapplyids, + UserId: session.GetUserId(), + FriendId: req.FriendId, } session.SendMsg(string(this.module.GetType()), FriendSubTypeApply, resp) diff --git a/pb/friend_msg.pb.go b/pb/friend_msg.pb.go index 773aec533..c1630366b 100644 --- a/pb/friend_msg.pb.go +++ b/pb/friend_msg.pb.go @@ -404,9 +404,8 @@ type FriendApplyResp struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - UserId string `protobuf:"bytes,1,opt,name=userId,proto3" json:"userId"` //用户ID - FriendId string `protobuf:"bytes,2,opt,name=friendId,proto3" json:"friendId"` //好友ID - Weapplyids []string `protobuf:"bytes,3,rep,name=weapplyids,proto3" json:"weapplyids"` // 我申请的用户ID + UserId string `protobuf:"bytes,1,opt,name=userId,proto3" json:"userId"` //用户ID + FriendId string `protobuf:"bytes,2,opt,name=friendId,proto3" json:"friendId"` //好友ID } func (x *FriendApplyResp) Reset() { @@ -455,13 +454,6 @@ func (x *FriendApplyResp) GetFriendId() string { return "" } -func (x *FriendApplyResp) GetWeapplyids() []string { - if x != nil { - return x.Weapplyids - } - return nil -} - //删除好友 type FriendDelReq struct { state protoimpl.MessageState @@ -2402,13 +2394,11 @@ var file_friend_friend_msg_proto_rawDesc = []byte{ 0x64, 0x42, 0x61, 0x73, 0x65, 0x52, 0x04, 0x6c, 0x69, 0x73, 0x74, 0x22, 0x2c, 0x0a, 0x0e, 0x46, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x41, 0x70, 0x70, 0x6c, 0x79, 0x52, 0x65, 0x71, 0x12, 0x1a, 0x0a, 0x08, 0x66, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x08, 0x66, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x49, 0x64, 0x22, 0x65, 0x0a, 0x0f, 0x46, 0x72, 0x69, + 0x08, 0x66, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x49, 0x64, 0x22, 0x45, 0x0a, 0x0f, 0x46, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x41, 0x70, 0x70, 0x6c, 0x79, 0x52, 0x65, 0x73, 0x70, 0x12, 0x16, 0x0a, 0x06, 0x75, 0x73, 0x65, 0x72, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x75, 0x73, 0x65, 0x72, 0x49, 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x66, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x49, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x66, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x49, 0x64, - 0x12, 0x1e, 0x0a, 0x0a, 0x77, 0x65, 0x61, 0x70, 0x70, 0x6c, 0x79, 0x69, 0x64, 0x73, 0x18, 0x03, - 0x20, 0x03, 0x28, 0x09, 0x52, 0x0a, 0x77, 0x65, 0x61, 0x70, 0x70, 0x6c, 0x79, 0x69, 0x64, 0x73, 0x22, 0x2a, 0x0a, 0x0c, 0x46, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x44, 0x65, 0x6c, 0x52, 0x65, 0x71, 0x12, 0x1a, 0x0a, 0x08, 0x66, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x66, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x49, 0x64, 0x22, 0x43, 0x0a, 0x0d, From 39cc62ee400105269c7dac31691d79da8c530394 Mon Sep 17 00:00:00 2001 From: meixiongfeng <766881921@qq.com> Date: Mon, 25 Dec 2023 14:56:52 +0800 Subject: [PATCH 4/8] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E6=8A=BD=E5=8D=A1?= =?UTF-8?q?=E8=AE=B0=E5=BD=95=E6=9F=A5=E8=AF=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- comm/const.go | 3 +- modules/friend/api_cross_apply.go | 4 +- modules/hero/api_drawCard.go | 12 +- modules/hero/api_rank.go | 23 +++ modules/hero/api_selectcard.go | 30 +++- modules/hero/model_drawrecord.go | 63 ++++++++ modules/hero/model_hero.go | 257 ------------------------------ modules/hero/module.go | 46 +----- pb/hero_db.pb.go | 185 ++++++++++++++++----- pb/hero_msg.pb.go | 208 +++++++++++++++++++----- 10 files changed, 439 insertions(+), 392 deletions(-) create mode 100644 modules/hero/api_rank.go create mode 100644 modules/hero/model_drawrecord.go diff --git a/comm/const.go b/comm/const.go index 331aefcef..2985b7a7e 100644 --- a/comm/const.go +++ b/comm/const.go @@ -438,7 +438,8 @@ const ( // 三消Rank TableEntertainRank = "xxlrank" //排名 - TableEntertainRecode = "xxlrecode" //战报 + TableEntertainRecode = "xxlrecode" //战报 + TableDrawRecode = "drawrecode" //抽卡记录 ) // RPC服务接口定义处 diff --git a/modules/friend/api_cross_apply.go b/modules/friend/api_cross_apply.go index ce967054b..08b98a359 100644 --- a/modules/friend/api_cross_apply.go +++ b/modules/friend/api_cross_apply.go @@ -155,9 +155,9 @@ func (this *apiComp) Apply(session comm.IUserSession, req *pb.FriendApplyReq) (e ) } if _, ok := utils.Find(self.Weapplyids, req.FriendId); !ok { - target.Weapplyids = append(target.Weapplyids, req.FriendId) + self.Weapplyids = append(self.Weapplyids, req.FriendId) if err = this.module.modelFriend.Change(session.GetUserId(), map[string]interface{}{ - "weapplyids": target.Weapplyids, + "weapplyids": self.Weapplyids, }); err != nil { errdata = &pb.ErrorData{ Code: pb.ErrorCode_DBError, diff --git a/modules/hero/api_drawCard.go b/modules/hero/api_drawCard.go index 7a36bac4a..e268bfc80 100644 --- a/modules/hero/api_drawCard.go +++ b/modules/hero/api_drawCard.go @@ -6,6 +6,8 @@ import ( "go_dreamfactory/pb" "go_dreamfactory/sys/configure" cfg "go_dreamfactory/sys/configure/structs" + + "go.mongodb.org/mongo-driver/bson/primitive" ) func (this *apiComp) DrawCardCheck(session comm.IUserSession, req *pb.HeroDrawCardReq) (errdata *pb.ErrorData) { @@ -122,7 +124,7 @@ func (this *apiComp) DrawCard(session comm.IUserSession, req *pb.HeroDrawCardReq } // 校验是否达到保底卡池 - if drawConf.Protect >= drawCount { + if drawConf.Protect >= drawCount && drawConf.Protect != 0 { IsBaodiPool = true } ///// 获取消耗 end @@ -326,6 +328,14 @@ func (this *apiComp) DrawCard(session comm.IUserSession, req *pb.HeroDrawCardReq if req.DrawType != 1 { // 任务统计 go this.module.AsynHandleSession(session.Clone(), func(session comm.IUserSession) { + + this.module.modelDrawRecode.InstertDrawCardRecord(&pb.DBHeroDrawRecord{ + Id: primitive.NewObjectID().Hex(), + Uid: session.GetUserId(), + HeroId: szCards, + Drawtype: req.DrawType, + Ctime: configure.Now().Unix(), + }) var szHero []*pb.DBHero for _, hero := range add { // 奖励一次性发放 if user, err := this.module.ModuleUser.GetUser(session.GetUserId()); err == nil { // 广播 首次获得英雄 diff --git a/modules/hero/api_rank.go b/modules/hero/api_rank.go new file mode 100644 index 000000000..f768d17b7 --- /dev/null +++ b/modules/hero/api_rank.go @@ -0,0 +1,23 @@ +package hero + +import ( + "go_dreamfactory/comm" + "go_dreamfactory/pb" +) + +// 参数校验 +func (this *apiComp) DrawRecordCheck(session comm.IUserSession, req *pb.HeroDrawRecordReq) (errdata *pb.ErrorData) { + + return +} + +func (this *apiComp) DrawRecord(session comm.IUserSession, req *pb.HeroDrawRecordReq) (errdata *pb.ErrorData) { + var () + + if errdata = this.DrawRecordCheck(session, req); errdata != nil { + return + } + + session.SendMsg(string(this.module.GetType()), "drawrecord", &pb.HeroDrawRecordResp{}) + return +} diff --git a/modules/hero/api_selectcard.go b/modules/hero/api_selectcard.go index 206288963..b4d53de1d 100644 --- a/modules/hero/api_selectcard.go +++ b/modules/hero/api_selectcard.go @@ -3,7 +3,10 @@ package hero import ( "go_dreamfactory/comm" "go_dreamfactory/pb" + "go_dreamfactory/sys/configure" cfg "go_dreamfactory/sys/configure/structs" + + "go.mongodb.org/mongo-driver/bson/primitive" ) //参数校验 @@ -23,6 +26,7 @@ func (this *apiComp) SelectCard(session comm.IUserSession, req *pb.HeroSelectCar szAtno []*pb.AtnoData curSzCard []string heroRecord *pb.DBHeroRecord + szStar []int32 //星级 ) if heroRecord, err = this.module.modelRecord.GetHeroRecord(session.GetUserId()); err != nil { @@ -84,8 +88,19 @@ func (this *apiComp) SelectCard(session comm.IUserSession, req *pb.HeroSelectCar } szHero = append(szHero, hero) } - this.module.HeroLibrary(session, curSzCard, szHero) - this.module.DispenseAtno(session, allres, true) + + for _, heroId := range curSzCard { + if HeroConf, err := this.module.configure.GetHeroConfig(heroId); err != nil { + errdata = &pb.ErrorData{ + Code: pb.ErrorCode_ConfigNoFound, + Message: err.Error(), + } + return + } else { + szStar = append(szStar, HeroConf.Star) + } + } + this.module.DispenseAtno(session, allres, true) heroRecord.Newcomplete = true @@ -109,5 +124,16 @@ func (this *apiComp) SelectCard(session comm.IUserSession, req *pb.HeroSelectCar Record: heroRecord, Atno: szAtno, }) + go this.module.AsynHandleSession(session.Clone(), func(session comm.IUserSession) { + this.module.modelDrawRecode.InstertDrawCardRecord(&pb.DBHeroDrawRecord{ + Id: primitive.NewObjectID().Hex(), + Uid: session.GetUserId(), + HeroId: curSzCard, + Drawtype: 1, + Ctime: configure.Now().Unix(), + }) + this.module.HeroLibrary(session, curSzCard, szHero) + this.module.SendTaskMsg(session, szStar, 10, 1, curSzCard) + }) return } diff --git a/modules/hero/model_drawrecord.go b/modules/hero/model_drawrecord.go new file mode 100644 index 000000000..2175bfb1e --- /dev/null +++ b/modules/hero/model_drawrecord.go @@ -0,0 +1,63 @@ +package hero + +import ( + "context" + "go_dreamfactory/comm" + "go_dreamfactory/lego/core" + "go_dreamfactory/modules" + "go_dreamfactory/pb" + + "go.mongodb.org/mongo-driver/bson" + "go.mongodb.org/mongo-driver/mongo" + "go.mongodb.org/mongo-driver/mongo/options" + "go.mongodb.org/mongo-driver/x/bsonx" +) + +type modelDrawRecode struct { + modules.MCompModel + module *Hero +} + +// 组件初始化接口 +func (this *modelDrawRecode) Init(service core.IService, module core.IModule, comp core.IModuleComp, opt core.IModuleOptions) (err error) { + this.TableName = comm.TableDrawRecode + this.MCompModel.Init(service, module, comp, opt) + this.module = module.(*Hero) + + // 通过uid创建索引 + this.DB.CreateIndex(core.SqlTable(this.TableName), mongo.IndexModel{ + Keys: bsonx.Doc{{Key: "uid", Value: bsonx.Int32(1)}}, + }) + + return +} + +func (this *modelDrawRecode) InstertDrawCardRecord(record *pb.DBHeroDrawRecord) (err error) { + if _, err = this.DBModel.DB.InsertOne(core.SqlTable(this.TableName), record); err != nil { + this.module.Errorln(err) + return + } + return +} + +func (this *modelDrawRecode) getDrawCardRecord(uid string) (results []*pb.DBHeroDrawRecord, err error) { + var ( + cursor *mongo.Cursor + ) + results = make([]*pb.DBHeroDrawRecord, 0) + if cursor, err = this.DBModel.DB.Find(comm.TableEntertainRecode, bson.M{"uid": uid}, options.Find().SetSort(bson.M{"ctime": -1}), + options.Find().SetLimit(int64(comm.MaxRankList))); err != nil { + this.module.Errorln(err) + return + } else { + for cursor.Next(context.Background()) { + temp := &pb.DBHeroDrawRecord{} + if err = cursor.Decode(temp); err != nil { + this.module.Errorln(err) + return + } + results = append(results, temp) + } + } + return +} diff --git a/modules/hero/model_hero.go b/modules/hero/model_hero.go index 460423cca..d019ddfca 100644 --- a/modules/hero/model_hero.go +++ b/modules/hero/model_hero.go @@ -883,263 +883,6 @@ func (this *ModelHero) CheckDrawCardRes(session comm.IUserSession, drawConf *cfg return } -func (this *ModelHero) GetDrawCardReward(session comm.IUserSession, szCards []string) (wish *pb.UserAtno, szStar []int32, rsp []*pb.AtnoData, errdata *pb.ErrorData) { - var reward []*cfg.Gameatn - - for _, heroId := range szCards { - if c, err := this.module.configure.GetHeroConfig(heroId); err != nil { - szStar = append(szStar, c.Star) // 获得许愿石 - var tmp *cfg.Gameatn - if c.Star == 4 { - tmp = this.module.ModuleTools.GetGlobalConf().RewardStar4 - reward = append(reward, tmp) - } else if c.Star == 5 { - tmp = this.module.ModuleTools.GetGlobalConf().RewardStar5 - reward = append(reward, tmp) - } - if tmp != nil { - if wish == nil { - wish = &pb.UserAtno{ - A: tmp.A, - T: tmp.T, - N: tmp.N, - } - } else { - wish.N += tmp.N - } - } - } - reward = append(reward, &cfg.Gameatn{ - A: "hero", - T: heroId, - N: 1, - }) - - } - var atno []*pb.UserAtno - if errdata, atno = this.module.DispenseAtno(session, reward, true); errdata == nil { - rsp = append(rsp, &pb.AtnoData{Atno: atno}) - } - go this.module.AsynHandleSession(session.Clone(), func(session comm.IUserSession) { - this.module.WriteUserLog(session.GetUserId(), szCards, comm.GMResAddType, "GetDrawCardReward", rsp) - }) - return -} - -// 模拟获得英雄 -func (this *ModelHero) imitateHero(session comm.IUserSession, heroCfgId string) (hero *pb.DBHero, atno []*pb.UserAtno, err error) { - heros := make([]*pb.DBHero, 0) - uid := session.GetUserId() - heroCfg, _ := this.module.configure.GetHeroConfig(heroCfgId) - bFirst := true - if heroCfg == nil { - err = errors.New("not found hero configID") - this.module.Errorf("not found hero configID:%s", heroCfgId) - return - } - - if err = this.GetList(uid, &heros); err != nil { - this.module.Errorf("err:%v", err) - } - - for _, obj := range heros { - if obj.HeroID == heroCfgId { - hero = obj - bFirst = false - atno = append(atno, &pb.UserAtno{ // 有英雄的时候 数量给0 - A: "hero", - T: hero.HeroID, - N: 0, - O: hero.Id, - }) - break - } - } - - if bFirst { // 没有当前英雄 - hero, err = this.initHeroOverlying(uid, heroCfgId, 1) - if err != nil { - return - } - atno = append(atno, &pb.UserAtno{ - A: "hero", - T: hero.HeroID, - N: 1, - O: hero.Id, - }) - } - - rst, err := this.module.ModuleUser.GetUserExpand(session.GetUserId()) - if err != nil { - return - } - if rst.Expitem == nil { - rst.Expitem = make(map[string]int32) - } - if rst.Herofrag == nil { - rst.Herofrag = make(map[string]int32) - } - // 转碎片处理 - - bAdd := false - //守护之星 获得 - if heroCfg.Herofragnum > 0 { - if v, ok := rst.Herofrag[hero.HeroID]; !ok { - rst.Herofrag[hero.HeroID] = 1 - bAdd = true - } else if heroCfg.Herofragnum > v { - rst.Herofrag[hero.HeroID] += 1 - bAdd = true - } - } - if bAdd { - for _, v := range heroCfg.Herofrag { - atno = append(atno, &pb.UserAtno{ - A: v.A, - T: v.T, - N: v.N, - }) - } - } else { - list := this.module.ModuleTools.GetGlobalConf().Moonshopmoney - if list != nil { - for pos, v := range list { - if int32(pos)+3 == heroCfg.Star && v > 0 { - - atno = append(atno, &pb.UserAtno{ - A: "attr", - T: "moongold", - N: v, - }) - break - } - } - } - } - bAdd = false // 初始化 - // expitem 获得 - if heroCfg.Expitemnum > 0 { - if v, ok := rst.Expitem[hero.HeroID]; ok { - if heroCfg.Expitemnum > v { - rst.Expitem[hero.HeroID] += 1 - bAdd = true - } - } else { - rst.Expitem[hero.HeroID] = 1 - bAdd = true - } - } - if bAdd { - for _, v := range heroCfg.Expitem { - atno = append(atno, &pb.UserAtno{ - A: v.A, - T: v.T, - N: v.N, - }) - } - } - - return -} - -func (this *ModelHero) drawcardcreateHero(session comm.IUserSession, ids []string) (hs []*pb.DBHero, szAtno []*pb.AtnoData, err error) { - heros := make([]*pb.DBHero, 0) - uid := session.GetUserId() - rst, _ := this.module.ModuleUser.GetUserExpand(session.GetUserId()) - list := this.module.ModuleTools.GetGlobalConf().Moonshopmoney // 3星卡技能满了后1个碎片转化的货币数量3星/4星/5星 - if err = this.GetList(uid, &heros); err != nil { - this.module.Errorf("err:%v", err) - } - for _, heroCfgId := range ids { - hero := &pb.DBHero{} - res := make([]*cfg.Gameatn, 0) - heroCfg, _ := this.module.configure.GetHeroConfig(heroCfgId) - - for _, obj := range heros { - if obj.HeroID == heroCfgId { - hero = obj - hs = append(hs, nil) - break - } - } - - if hero.Id == "" { // 没有当前英雄 - if hero, err = this.initHeroOverlying(uid, heroCfgId, 1); err == nil { - hs = append(hs, hero) - heros = append(heros, hero) - } else { - return - } - } - - // 转碎片处理 - bAdd := false - //守护之星 获得 - if heroCfg.Herofragnum > 0 { - if v, ok := rst.Herofrag[hero.HeroID]; !ok { - rst.Herofrag[hero.HeroID] = 1 - bAdd = true - } else if heroCfg.Herofragnum > v { - rst.Herofrag[hero.HeroID] += 1 - bAdd = true - } - } - if bAdd { - res = append(res, heroCfg.Herofrag...) - } else { - for pos, v := range list { - if int32(pos)+3 == heroCfg.Star && v > 0 { - res = append(res, &cfg.Gameatn{ - A: "attr", - T: "moongold", - N: v, - }) - break - } - } - } - bAdd = false // 初始化 - // expitem 获得 - if heroCfg.Expitemnum > 0 { - if v, ok := rst.Expitem[hero.HeroID]; ok { - if heroCfg.Expitemnum > v { - rst.Expitem[hero.HeroID] += 1 - bAdd = true - } - } else { - rst.Expitem[hero.HeroID] = 1 - bAdd = true - } - } - if bAdd { - res = append(res, heroCfg.Expitem...) - } - - _, atno := this.module.DispenseAtno(session, res, true) - - atno = append(atno, &pb.UserAtno{ - A: "hero", - T: hero.HeroID, - N: 1, - O: hero.Id, - }) - - szAtno = append(szAtno, &pb.AtnoData{ - Atno: atno, - }) - go this.module.AsynHandleSession(session.Clone(), func(session comm.IUserSession) { - this.module.WriteUserLog(session.GetUserId(), heroCfgId, comm.GMResAddType, "create hero", atno) - }) - } - - this.module.ModuleUser.ChangeUserExpand(session.GetUserId(), map[string]interface{}{ - "herofrag": rst.Herofrag, - "expitem": rst.Expitem, - }) - - return -} - // 模拟获得英雄 func (this *ModelHero) ImitateHeros(session comm.IUserSession, cids []string, itype int32) (addres [][]*cfg.Gameatn, add []*pb.DBHero, err error) { diff --git a/modules/hero/module.go b/modules/hero/module.go index 5eac964e1..1dc4d1acd 100644 --- a/modules/hero/module.go +++ b/modules/hero/module.go @@ -34,6 +34,7 @@ type Hero struct { chat comm.IChat passon comm.IPasson mail comm.Imail + modelDrawRecode *modelDrawRecode // 抽卡记录 } // 模块名 @@ -58,6 +59,7 @@ func (this *Hero) OnInstallComp() { this.modelRecord = this.RegisterComp(new(ModelRecord)).(*ModelRecord) this.modelTalent = this.RegisterComp(new(ModelTalent)).(*ModelTalent) this.configure = this.RegisterComp(new(configureComp)).(*configureComp) + this.modelDrawRecode = this.RegisterComp(new(modelDrawRecode)).(*modelDrawRecode) } func (this *Hero) Start() (err error) { if err = this.ModuleBase.Start(); err != nil { @@ -1046,46 +1048,6 @@ func (this *Hero) GetRandomCardByCardPool(uid string, count int32) (cards []stri return } -func (this *Hero) DrawCardHero(session comm.IUserSession, heroCfgId []string) (hero []*pb.DBHero, szAtno []*pb.AtnoData, errdata *pb.ErrorData) { - var ( - szAddHero []string - tasks []*pb.BuriedParam - err error - ) - if hero, szAtno, err = this.modelHero.drawcardcreateHero(session, heroCfgId); err != nil { - return - } - - for _, id := range heroCfgId { - if cfg, err := this.configure.GetHeroConfig(id); err == nil { - tasks = append(tasks, comm.GetBuriedParam(comm.Rtype1, 1, utils.ToInt32(id))) - tasks = append(tasks, comm.GetBuriedParam2(comm.Rtype30, id, cfg.Color)) - tasks = append(tasks, comm.GetBuriedParam(comm.Rtype31, 1, cfg.Color)) - } else { - errdata = &pb.ErrorData{ - Code: pb.ErrorCode_ConfigNoFound, - Title: pb.ErrorCode_ConfigNoFound.ToString(), - Message: err.Error(), - } - } - } - - go this.AsynHandleSession(session.Clone(), func(session comm.IUserSession) { - this.ModuleBuried.TriggerBuried(session, tasks...) - }) - for _, obj := range hero { - if obj != nil { - szAddHero = append(szAddHero, obj.HeroID) - } - } - if db.IsCross() { - go this.moduleFetter.SendRpcAddHero(session.GetUserId(), szAddHero, session.GetServiecTag()) - } else { - go this.moduleFetter.AddHerosFetterData(session.GetUserId(), szAddHero) // 异步调用 - } - - return -} func (this *Hero) HeroLibrary(session comm.IUserSession, cids []string, addHero []*pb.DBHero) { var ( tasks []*pb.BuriedParam @@ -1106,9 +1068,7 @@ func (this *Hero) HeroLibrary(session comm.IUserSession, cids []string, addHero this.moduleFetter.AddHerosFetterData(session.GetUserId(), add) // 异步调用 } - this.AsynHandleSession(session.Clone(), func(session comm.IUserSession) { - this.ModuleBuried.TriggerBuried(session, tasks...) - }) + this.ModuleBuried.TriggerBuried(session, tasks...) if len(addHero) > 0 { session.SendMsg("hero", "change", &pb.HeroChangePush{List: addHero}) } diff --git a/pb/hero_db.pb.go b/pb/hero_db.pb.go index 10159f7ca..0e6d4d337 100644 --- a/pb/hero_db.pb.go +++ b/pb/hero_db.pb.go @@ -633,6 +633,86 @@ func (x *DBHeroTalent) GetTalent() map[int32]int32 { return nil } +// 英雄抽卡记录 +type DBHeroDrawRecord struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id" bson:"_id"` //ID 主键id + Uid string `protobuf:"bytes,2,opt,name=uid,proto3" json:"uid" bson:"uid"` //用户ID + HeroId []string `protobuf:"bytes,3,rep,name=heroId,proto3" json:"heroId"` // 英雄ID + Drawtype int32 `protobuf:"varint,4,opt,name=drawtype,proto3" json:"drawtype"` // 卡池 + Ctime int64 `protobuf:"varint,5,opt,name=ctime,proto3" json:"ctime"` // 抽卡时间 +} + +func (x *DBHeroDrawRecord) Reset() { + *x = DBHeroDrawRecord{} + if protoimpl.UnsafeEnabled { + mi := &file_hero_hero_db_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *DBHeroDrawRecord) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DBHeroDrawRecord) ProtoMessage() {} + +func (x *DBHeroDrawRecord) ProtoReflect() protoreflect.Message { + mi := &file_hero_hero_db_proto_msgTypes[3] + 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 DBHeroDrawRecord.ProtoReflect.Descriptor instead. +func (*DBHeroDrawRecord) Descriptor() ([]byte, []int) { + return file_hero_hero_db_proto_rawDescGZIP(), []int{3} +} + +func (x *DBHeroDrawRecord) GetId() string { + if x != nil { + return x.Id + } + return "" +} + +func (x *DBHeroDrawRecord) GetUid() string { + if x != nil { + return x.Uid + } + return "" +} + +func (x *DBHeroDrawRecord) GetHeroId() []string { + if x != nil { + return x.HeroId + } + return nil +} + +func (x *DBHeroDrawRecord) GetDrawtype() int32 { + if x != nil { + return x.Drawtype + } + return 0 +} + +func (x *DBHeroDrawRecord) GetCtime() int64 { + if x != nil { + return x.Ctime + } + return 0 +} + var File_hero_hero_db_proto protoreflect.FileDescriptor var file_hero_hero_db_proto_rawDesc = []byte{ @@ -827,7 +907,15 @@ var file_hero_hero_db_proto_rawDesc = []byte{ 0x6e, 0x74, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, - 0x02, 0x38, 0x01, 0x2a, 0x2f, 0x0a, 0x08, 0x48, 0x65, 0x72, 0x6f, 0x54, 0x79, 0x70, 0x65, 0x12, + 0x02, 0x38, 0x01, 0x22, 0x7e, 0x0a, 0x10, 0x44, 0x42, 0x48, 0x65, 0x72, 0x6f, 0x44, 0x72, 0x61, + 0x77, 0x52, 0x65, 0x63, 0x6f, 0x72, 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, 0x16, 0x0a, 0x06, 0x68, 0x65, 0x72, + 0x6f, 0x49, 0x64, 0x18, 0x03, 0x20, 0x03, 0x28, 0x09, 0x52, 0x06, 0x68, 0x65, 0x72, 0x6f, 0x49, + 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x64, 0x72, 0x61, 0x77, 0x74, 0x79, 0x70, 0x65, 0x18, 0x04, 0x20, + 0x01, 0x28, 0x05, 0x52, 0x08, 0x64, 0x72, 0x61, 0x77, 0x74, 0x79, 0x70, 0x65, 0x12, 0x14, 0x0a, + 0x05, 0x63, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x63, 0x74, + 0x69, 0x6d, 0x65, 0x2a, 0x2f, 0x0a, 0x08, 0x48, 0x65, 0x72, 0x6f, 0x54, 0x79, 0x70, 0x65, 0x12, 0x0f, 0x0a, 0x0b, 0x48, 0x65, 0x72, 0x6f, 0x54, 0x79, 0x70, 0x65, 0x4e, 0x69, 0x6c, 0x10, 0x00, 0x12, 0x12, 0x0a, 0x0e, 0x48, 0x65, 0x72, 0x6f, 0x54, 0x79, 0x70, 0x65, 0x4b, 0x6f, 0x6e, 0x67, 0x46, 0x75, 0x10, 0x01, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, @@ -847,54 +935,55 @@ func file_hero_hero_db_proto_rawDescGZIP() []byte { } var file_hero_hero_db_proto_enumTypes = make([]protoimpl.EnumInfo, 1) -var file_hero_hero_db_proto_msgTypes = make([]protoimpl.MessageInfo, 19) +var file_hero_hero_db_proto_msgTypes = make([]protoimpl.MessageInfo, 20) var file_hero_hero_db_proto_goTypes = []interface{}{ (HeroType)(0), // 0: HeroType (*DBHero)(nil), // 1: DBHero (*DBHeroRecord)(nil), // 2: DBHeroRecord (*DBHeroTalent)(nil), // 3: DBHeroTalent - nil, // 4: DBHero.PropertyEntry - nil, // 5: DBHero.AddPropertyEntry - nil, // 6: DBHero.JuexPropertyEntry - nil, // 7: DBHero.TalentPropertyEntry - nil, // 8: DBHero.HoroscopePropertyEntry - nil, // 9: DBHero.FettersEntry - nil, // 10: DBHeroRecord.ConditionEntry - nil, // 11: DBHeroRecord.Star5HeroEntry - nil, // 12: DBHeroRecord.RaceEntry - nil, // 13: DBHeroRecord.Baodi4Entry - nil, // 14: DBHeroRecord.Baodi5Entry - nil, // 15: DBHeroRecord.CountEntry - nil, // 16: DBHeroRecord.PeachEntry - nil, // 17: DBHeroRecord.LimitEntry - nil, // 18: DBHeroRecord.WishEntry - nil, // 19: DBHeroTalent.TalentEntry - (*SkillData)(nil), // 20: SkillData - (*DB_EquipmentSuit)(nil), // 21: DB_EquipmentSuit + (*DBHeroDrawRecord)(nil), // 4: DBHeroDrawRecord + nil, // 5: DBHero.PropertyEntry + nil, // 6: DBHero.AddPropertyEntry + nil, // 7: DBHero.JuexPropertyEntry + nil, // 8: DBHero.TalentPropertyEntry + nil, // 9: DBHero.HoroscopePropertyEntry + nil, // 10: DBHero.FettersEntry + nil, // 11: DBHeroRecord.ConditionEntry + nil, // 12: DBHeroRecord.Star5HeroEntry + nil, // 13: DBHeroRecord.RaceEntry + nil, // 14: DBHeroRecord.Baodi4Entry + nil, // 15: DBHeroRecord.Baodi5Entry + nil, // 16: DBHeroRecord.CountEntry + nil, // 17: DBHeroRecord.PeachEntry + nil, // 18: DBHeroRecord.LimitEntry + nil, // 19: DBHeroRecord.WishEntry + nil, // 20: DBHeroTalent.TalentEntry + (*SkillData)(nil), // 21: SkillData + (*DB_EquipmentSuit)(nil), // 22: DB_EquipmentSuit } var file_hero_hero_db_proto_depIdxs = []int32{ - 20, // 0: DBHero.normalSkill:type_name -> SkillData - 4, // 1: DBHero.property:type_name -> DBHero.PropertyEntry - 5, // 2: DBHero.addProperty:type_name -> DBHero.AddPropertyEntry - 6, // 3: DBHero.juexProperty:type_name -> DBHero.JuexPropertyEntry + 21, // 0: DBHero.normalSkill:type_name -> SkillData + 5, // 1: DBHero.property:type_name -> DBHero.PropertyEntry + 6, // 2: DBHero.addProperty:type_name -> DBHero.AddPropertyEntry + 7, // 3: DBHero.juexProperty:type_name -> DBHero.JuexPropertyEntry 0, // 4: DBHero.status:type_name -> HeroType - 21, // 5: DBHero.suits:type_name -> DB_EquipmentSuit - 7, // 6: DBHero.talentProperty:type_name -> DBHero.TalentPropertyEntry - 20, // 7: DBHero.equipSkill:type_name -> SkillData - 8, // 8: DBHero.horoscopeProperty:type_name -> DBHero.HoroscopePropertyEntry - 9, // 9: DBHero.fetters:type_name -> DBHero.FettersEntry - 20, // 10: DBHero.awakenskill:type_name -> SkillData - 20, // 11: DBHero.talentskill:type_name -> SkillData - 10, // 12: DBHeroRecord.condition:type_name -> DBHeroRecord.ConditionEntry - 11, // 13: DBHeroRecord.star5Hero:type_name -> DBHeroRecord.Star5HeroEntry - 12, // 14: DBHeroRecord.race:type_name -> DBHeroRecord.RaceEntry - 13, // 15: DBHeroRecord.baodi4:type_name -> DBHeroRecord.Baodi4Entry - 14, // 16: DBHeroRecord.baodi5:type_name -> DBHeroRecord.Baodi5Entry - 15, // 17: DBHeroRecord.count:type_name -> DBHeroRecord.CountEntry - 16, // 18: DBHeroRecord.peach:type_name -> DBHeroRecord.PeachEntry - 17, // 19: DBHeroRecord.limit:type_name -> DBHeroRecord.LimitEntry - 18, // 20: DBHeroRecord.wish:type_name -> DBHeroRecord.WishEntry - 19, // 21: DBHeroTalent.talent:type_name -> DBHeroTalent.TalentEntry + 22, // 5: DBHero.suits:type_name -> DB_EquipmentSuit + 8, // 6: DBHero.talentProperty:type_name -> DBHero.TalentPropertyEntry + 21, // 7: DBHero.equipSkill:type_name -> SkillData + 9, // 8: DBHero.horoscopeProperty:type_name -> DBHero.HoroscopePropertyEntry + 10, // 9: DBHero.fetters:type_name -> DBHero.FettersEntry + 21, // 10: DBHero.awakenskill:type_name -> SkillData + 21, // 11: DBHero.talentskill:type_name -> SkillData + 11, // 12: DBHeroRecord.condition:type_name -> DBHeroRecord.ConditionEntry + 12, // 13: DBHeroRecord.star5Hero:type_name -> DBHeroRecord.Star5HeroEntry + 13, // 14: DBHeroRecord.race:type_name -> DBHeroRecord.RaceEntry + 14, // 15: DBHeroRecord.baodi4:type_name -> DBHeroRecord.Baodi4Entry + 15, // 16: DBHeroRecord.baodi5:type_name -> DBHeroRecord.Baodi5Entry + 16, // 17: DBHeroRecord.count:type_name -> DBHeroRecord.CountEntry + 17, // 18: DBHeroRecord.peach:type_name -> DBHeroRecord.PeachEntry + 18, // 19: DBHeroRecord.limit:type_name -> DBHeroRecord.LimitEntry + 19, // 20: DBHeroRecord.wish:type_name -> DBHeroRecord.WishEntry + 20, // 21: DBHeroTalent.talent:type_name -> DBHeroTalent.TalentEntry 22, // [22:22] is the sub-list for method output_type 22, // [22:22] is the sub-list for method input_type 22, // [22:22] is the sub-list for extension type_name @@ -946,6 +1035,18 @@ func file_hero_hero_db_proto_init() { return nil } } + file_hero_hero_db_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*DBHeroDrawRecord); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } } type x struct{} out := protoimpl.TypeBuilder{ @@ -953,7 +1054,7 @@ func file_hero_hero_db_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_hero_hero_db_proto_rawDesc, NumEnums: 1, - NumMessages: 19, + NumMessages: 20, NumExtensions: 0, NumServices: 0, }, diff --git a/pb/hero_msg.pb.go b/pb/hero_msg.pb.go index 97c7d4f9f..d403da9a3 100644 --- a/pb/hero_msg.pb.go +++ b/pb/hero_msg.pb.go @@ -2251,6 +2251,92 @@ func (x *HeroSelectCardResp) GetAtno() []*AtnoData { return nil } +// 抽卡记录 +type HeroDrawRecordReq struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *HeroDrawRecordReq) Reset() { + *x = HeroDrawRecordReq{} + if protoimpl.UnsafeEnabled { + mi := &file_hero_hero_msg_proto_msgTypes[43] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *HeroDrawRecordReq) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*HeroDrawRecordReq) ProtoMessage() {} + +func (x *HeroDrawRecordReq) ProtoReflect() protoreflect.Message { + mi := &file_hero_hero_msg_proto_msgTypes[43] + 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 HeroDrawRecordReq.ProtoReflect.Descriptor instead. +func (*HeroDrawRecordReq) Descriptor() ([]byte, []int) { + return file_hero_hero_msg_proto_rawDescGZIP(), []int{43} +} + +type HeroDrawRecordResp struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Record *DBHeroDrawRecord `protobuf:"bytes,1,opt,name=record,proto3" json:"record"` // 扩展数据 +} + +func (x *HeroDrawRecordResp) Reset() { + *x = HeroDrawRecordResp{} + if protoimpl.UnsafeEnabled { + mi := &file_hero_hero_msg_proto_msgTypes[44] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *HeroDrawRecordResp) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*HeroDrawRecordResp) ProtoMessage() {} + +func (x *HeroDrawRecordResp) ProtoReflect() protoreflect.Message { + mi := &file_hero_hero_msg_proto_msgTypes[44] + 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 HeroDrawRecordResp.ProtoReflect.Descriptor instead. +func (*HeroDrawRecordResp) Descriptor() ([]byte, []int) { + return file_hero_hero_msg_proto_rawDescGZIP(), []int{44} +} + +func (x *HeroDrawRecordResp) GetRecord() *DBHeroDrawRecord { + if x != nil { + return x.Record + } + return nil +} + var File_hero_hero_msg_proto protoreflect.FileDescriptor var file_hero_hero_msg_proto_rawDesc = []byte{ @@ -2460,8 +2546,14 @@ var file_hero_hero_msg_proto_rawDesc = []byte{ 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x44, 0x42, 0x48, 0x65, 0x72, 0x6f, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x52, 0x06, 0x72, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x12, 0x1d, 0x0a, 0x04, 0x61, 0x74, 0x6e, 0x6f, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x09, 0x2e, 0x41, 0x74, 0x6e, - 0x6f, 0x44, 0x61, 0x74, 0x61, 0x52, 0x04, 0x61, 0x74, 0x6e, 0x6f, 0x42, 0x06, 0x5a, 0x04, 0x2e, - 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x6f, 0x44, 0x61, 0x74, 0x61, 0x52, 0x04, 0x61, 0x74, 0x6e, 0x6f, 0x22, 0x13, 0x0a, 0x11, 0x48, + 0x65, 0x72, 0x6f, 0x44, 0x72, 0x61, 0x77, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x52, 0x65, 0x71, + 0x22, 0x3f, 0x0a, 0x12, 0x48, 0x65, 0x72, 0x6f, 0x44, 0x72, 0x61, 0x77, 0x52, 0x65, 0x63, 0x6f, + 0x72, 0x64, 0x52, 0x65, 0x73, 0x70, 0x12, 0x29, 0x0a, 0x06, 0x72, 0x65, 0x63, 0x6f, 0x72, 0x64, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x44, 0x42, 0x48, 0x65, 0x72, 0x6f, 0x44, + 0x72, 0x61, 0x77, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x52, 0x06, 0x72, 0x65, 0x63, 0x6f, 0x72, + 0x64, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x33, } var ( @@ -2476,7 +2568,7 @@ func file_hero_hero_msg_proto_rawDescGZIP() []byte { return file_hero_hero_msg_proto_rawDescData } -var file_hero_hero_msg_proto_msgTypes = make([]protoimpl.MessageInfo, 49) +var file_hero_hero_msg_proto_msgTypes = make([]protoimpl.MessageInfo, 51) var file_hero_hero_msg_proto_goTypes = []interface{}{ (*HeroInfoReq)(nil), // 0: HeroInfoReq (*HeroInfoResp)(nil), // 1: HeroInfoResp @@ -2521,50 +2613,54 @@ var file_hero_hero_msg_proto_goTypes = []interface{}{ (*HeroSaveCardResp)(nil), // 40: HeroSaveCardResp (*HeroSelectCardReq)(nil), // 41: HeroSelectCardReq (*HeroSelectCardResp)(nil), // 42: HeroSelectCardResp - nil, // 43: HeroStrengthenUplvReq.ItemEntry - nil, // 44: HeroStrengthenUpSkillReq.ItemEntry - nil, // 45: HeroPropertyPush.PropertyEntry - nil, // 46: HeroPropertyPush.AddPropertyEntry - nil, // 47: HeroFusionReq.HerosEntry - nil, // 48: HeroPeachRewardResp.PeachEntry - (*DBHero)(nil), // 49: DBHero - (*UserAtno)(nil), // 50: UserAtno - (*DBHeroRecord)(nil), // 51: DBHeroRecord - (*DBHeroTalent)(nil), // 52: DBHeroTalent + (*HeroDrawRecordReq)(nil), // 43: HeroDrawRecordReq + (*HeroDrawRecordResp)(nil), // 44: HeroDrawRecordResp + nil, // 45: HeroStrengthenUplvReq.ItemEntry + nil, // 46: HeroStrengthenUpSkillReq.ItemEntry + nil, // 47: HeroPropertyPush.PropertyEntry + nil, // 48: HeroPropertyPush.AddPropertyEntry + nil, // 49: HeroFusionReq.HerosEntry + nil, // 50: HeroPeachRewardResp.PeachEntry + (*DBHero)(nil), // 51: DBHero + (*UserAtno)(nil), // 52: UserAtno + (*DBHeroRecord)(nil), // 53: DBHeroRecord + (*DBHeroTalent)(nil), // 54: DBHeroTalent + (*DBHeroDrawRecord)(nil), // 55: DBHeroDrawRecord } var file_hero_hero_msg_proto_depIdxs = []int32{ - 49, // 0: HeroInfoResp.base:type_name -> DBHero - 49, // 1: HeroListResp.list:type_name -> DBHero - 43, // 2: HeroStrengthenUplvReq.item:type_name -> HeroStrengthenUplvReq.ItemEntry - 49, // 3: HeroStrengthenUplvResp.hero:type_name -> DBHero - 49, // 4: HeroStrengthenUpStarResp.hero:type_name -> DBHero - 44, // 5: HeroStrengthenUpSkillReq.item:type_name -> HeroStrengthenUpSkillReq.ItemEntry - 49, // 6: HeroStrengthenUpSkillResp.hero:type_name -> DBHero - 49, // 7: HeroAwakenResp.hero:type_name -> DBHero - 45, // 8: HeroPropertyPush.property:type_name -> HeroPropertyPush.PropertyEntry - 46, // 9: HeroPropertyPush.addProperty:type_name -> HeroPropertyPush.AddPropertyEntry - 49, // 10: HeroLockResp.hero:type_name -> DBHero - 49, // 11: HeroGetSpecifiedResp.hero:type_name -> DBHero - 50, // 12: AtnoData.atno:type_name -> UserAtno + 51, // 0: HeroInfoResp.base:type_name -> DBHero + 51, // 1: HeroListResp.list:type_name -> DBHero + 45, // 2: HeroStrengthenUplvReq.item:type_name -> HeroStrengthenUplvReq.ItemEntry + 51, // 3: HeroStrengthenUplvResp.hero:type_name -> DBHero + 51, // 4: HeroStrengthenUpStarResp.hero:type_name -> DBHero + 46, // 5: HeroStrengthenUpSkillReq.item:type_name -> HeroStrengthenUpSkillReq.ItemEntry + 51, // 6: HeroStrengthenUpSkillResp.hero:type_name -> DBHero + 51, // 7: HeroAwakenResp.hero:type_name -> DBHero + 47, // 8: HeroPropertyPush.property:type_name -> HeroPropertyPush.PropertyEntry + 48, // 9: HeroPropertyPush.addProperty:type_name -> HeroPropertyPush.AddPropertyEntry + 51, // 10: HeroLockResp.hero:type_name -> DBHero + 51, // 11: HeroGetSpecifiedResp.hero:type_name -> DBHero + 52, // 12: AtnoData.atno:type_name -> UserAtno 19, // 13: HeroDrawCardResp.data:type_name -> AtnoData - 50, // 14: HeroDrawCardResp.wish:type_name -> UserAtno - 51, // 15: HeroDrawCardResp.record:type_name -> DBHeroRecord - 49, // 16: HeroChangePush.list:type_name -> DBHero - 51, // 17: HeroDrawCardFloorResp.record:type_name -> DBHeroRecord - 47, // 18: HeroFusionReq.heros:type_name -> HeroFusionReq.HerosEntry - 52, // 19: HeroTalentListResp.telnet:type_name -> DBHeroTalent - 52, // 20: HeroTalentLearnResp.telnet:type_name -> DBHeroTalent - 52, // 21: HeroTalentResetResp.telnet:type_name -> DBHeroTalent - 48, // 22: HeroPeachRewardResp.peach:type_name -> HeroPeachRewardResp.PeachEntry - 50, // 23: HeroPeachRewardResp.atno:type_name -> UserAtno - 51, // 24: HeroSaveCardResp.record:type_name -> DBHeroRecord - 51, // 25: HeroSelectCardResp.record:type_name -> DBHeroRecord + 52, // 14: HeroDrawCardResp.wish:type_name -> UserAtno + 53, // 15: HeroDrawCardResp.record:type_name -> DBHeroRecord + 51, // 16: HeroChangePush.list:type_name -> DBHero + 53, // 17: HeroDrawCardFloorResp.record:type_name -> DBHeroRecord + 49, // 18: HeroFusionReq.heros:type_name -> HeroFusionReq.HerosEntry + 54, // 19: HeroTalentListResp.telnet:type_name -> DBHeroTalent + 54, // 20: HeroTalentLearnResp.telnet:type_name -> DBHeroTalent + 54, // 21: HeroTalentResetResp.telnet:type_name -> DBHeroTalent + 50, // 22: HeroPeachRewardResp.peach:type_name -> HeroPeachRewardResp.PeachEntry + 52, // 23: HeroPeachRewardResp.atno:type_name -> UserAtno + 53, // 24: HeroSaveCardResp.record:type_name -> DBHeroRecord + 53, // 25: HeroSelectCardResp.record:type_name -> DBHeroRecord 19, // 26: HeroSelectCardResp.atno:type_name -> AtnoData - 27, // [27:27] is the sub-list for method output_type - 27, // [27:27] is the sub-list for method input_type - 27, // [27:27] is the sub-list for extension type_name - 27, // [27:27] is the sub-list for extension extendee - 0, // [0:27] is the sub-list for field type_name + 55, // 27: HeroDrawRecordResp.record:type_name -> DBHeroDrawRecord + 28, // [28:28] is the sub-list for method output_type + 28, // [28:28] is the sub-list for method input_type + 28, // [28:28] is the sub-list for extension type_name + 28, // [28:28] is the sub-list for extension extendee + 0, // [0:28] is the sub-list for field type_name } func init() { file_hero_hero_msg_proto_init() } @@ -3091,6 +3187,30 @@ func file_hero_hero_msg_proto_init() { return nil } } + file_hero_hero_msg_proto_msgTypes[43].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*HeroDrawRecordReq); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_hero_hero_msg_proto_msgTypes[44].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*HeroDrawRecordResp); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } } type x struct{} out := protoimpl.TypeBuilder{ @@ -3098,7 +3218,7 @@ func file_hero_hero_msg_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_hero_hero_msg_proto_rawDesc, NumEnums: 0, - NumMessages: 49, + NumMessages: 51, NumExtensions: 0, NumServices: 0, }, From 5aff3410438a32acf9535a744097891260738fcc Mon Sep 17 00:00:00 2001 From: meixiongfeng <766881921@qq.com> Date: Mon, 25 Dec 2023 15:55:45 +0800 Subject: [PATCH 5/8] =?UTF-8?q?=E5=A5=BD=E5=8F=8B=E5=90=8C=E6=84=8F?= =?UTF-8?q?=E6=97=B6=E6=B8=85=E7=90=86=E5=A5=BD=E5=8F=8B=E7=94=B3=E8=AF=B7?= =?UTF-8?q?=E6=95=B0=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- modules/friend/api_cross_agree.go | 8 ++++++-- modules/hero/module.go | 20 +++++++++----------- 2 files changed, 15 insertions(+), 13 deletions(-) diff --git a/modules/friend/api_cross_agree.go b/modules/friend/api_cross_agree.go index 233016837..034fb495d 100644 --- a/modules/friend/api_cross_agree.go +++ b/modules/friend/api_cross_agree.go @@ -120,9 +120,13 @@ func (this *apiComp) Agree(session comm.IUserSession, req *pb.FriendAgreeReq) (e } target.FriendIds = append(target.FriendIds, self.Uid) } + + target.Weapplyids = utils.DeleteString(target.Weapplyids, self.Uid) // 同意 移除已经申请的好友 + if err = this.module.modelFriend.Change(target.Uid, map[string]interface{}{ - "friendIds": target.FriendIds, - "applyIds": target.ApplyIds, + "friendIds": target.FriendIds, + "applyIds": target.ApplyIds, + "weapplyids": target.Weapplyids, }); err != nil { errdata = &pb.ErrorData{ Code: pb.ErrorCode_DBError, diff --git a/modules/hero/module.go b/modules/hero/module.go index 1dc4d1acd..92e56fa8f 100644 --- a/modules/hero/module.go +++ b/modules/hero/module.go @@ -228,21 +228,23 @@ func (this *Hero) CreateRepeatHeros(session comm.IUserSession, heros map[string] this.Errorf("create hero %s failed", heroCfgId) continue } - szAddHero = append(szAddHero, heroCfgId) + for _, v := range atno { if v.A == "hero" && v.N == 1 { changeList = append(changeList, hero) + szAddHero = append(szAddHero, heroCfgId) break } } } - if db.IsCross() { - go this.moduleFetter.SendRpcAddHero(session.GetUserId(), szAddHero, session.GetServiecTag()) - } else { - go this.moduleFetter.AddHerosFetterData(session.GetUserId(), szAddHero) - } + if len(changeList) > 0 { session.SendMsg("hero", "change", &pb.HeroChangePush{List: changeList}) + if db.IsCross() { + go this.moduleFetter.SendRpcAddHero(session.GetUserId(), szAddHero, session.GetServiecTag()) + } else { + go this.moduleFetter.AddHerosFetterData(session.GetUserId(), szAddHero) + } } return } @@ -910,14 +912,10 @@ func (this *Hero) CreateOneHero(session comm.IUserSession, heroCfgId string) (he } szAddHero = append(szAddHero, heroCfgId) - if db.IsCross() { - go this.moduleFetter.SendRpcAddHero(session.GetUserId(), szAddHero, session.GetServiecTag()) - } else { - go this.moduleFetter.AddHerosFetterData(session.GetUserId(), szAddHero) // 异步调用 - } for _, v := range atno { if v.A == "hero" && v.N == 1 { changeList = append(changeList, hero) + go this.moduleFetter.AddHerosFetterData(session.GetUserId(), szAddHero) // 异步调用 break } } From a0074c224b2f0e57c0881f81d79d01b4bd440bd6 Mon Sep 17 00:00:00 2001 From: meixiongfeng <766881921@qq.com> Date: Mon, 25 Dec 2023 17:15:00 +0800 Subject: [PATCH 6/8] =?UTF-8?q?=E4=B8=8A=E4=BC=A0=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- modules/friend/api_cross_list.go | 15 +++++++++ modules/integral/api_getlist.go | 2 +- modules/integral/api_reward.go | 4 +-- modules/integral/model_integral.go | 2 +- pb/friend_db.pb.go | 50 ++++++++++++++++++------------ pb/integral_db.pb.go | 18 +++++------ pb/integral_msg.pb.go | 6 ++-- 7 files changed, 61 insertions(+), 36 deletions(-) diff --git a/modules/friend/api_cross_list.go b/modules/friend/api_cross_list.go index 9d092e70c..daa1e5595 100644 --- a/modules/friend/api_cross_list.go +++ b/modules/friend/api_cross_list.go @@ -3,6 +3,7 @@ package friend import ( "go_dreamfactory/comm" "go_dreamfactory/pb" + "go_dreamfactory/sys/configure" "go_dreamfactory/utils" ) @@ -59,6 +60,20 @@ func (this *apiComp) List(session comm.IUserSession, req *pb.FriendListReq) (err list = append(list, base) } + if configure.Now().Unix() >= self.CleanTime || self.CleanTime == 0 { + self.CleanTime = configure.Now().Unix() + 3*24*3600 + self.Weapplyids = []string{} + if err = this.module.modelFriend.Change(session.GetUserId(), map[string]interface{}{ + "weapplyids": self.Weapplyids, + "cleanTime": self.CleanTime, + }); err != nil { + errdata = &pb.ErrorData{ + Code: pb.ErrorCode_FriendApplyError, + Title: pb.ErrorCode_FriendApplyError.ToString(), + } + return + } + } resp := &pb.FriendListResp{ List: list, Friend: self, diff --git a/modules/integral/api_getlist.go b/modules/integral/api_getlist.go index 38334f6fc..89d1db755 100644 --- a/modules/integral/api_getlist.go +++ b/modules/integral/api_getlist.go @@ -66,7 +66,7 @@ func (this *apiComp) GetList(session comm.IUserSession, req *pb.IntegralGetListR list.Reward1 = 0 list.Reward2 = 0 list.Buff = make(map[int32]int32) - list.Score = make(map[int32]int64) + list.Score = make(map[int32]int32) update["hid"] = list.Hid update["etime"] = list.Etime update["maxscore"] = list.Maxscore diff --git a/modules/integral/api_reward.go b/modules/integral/api_reward.go index bf6e1c9c9..8812abf2a 100644 --- a/modules/integral/api_reward.go +++ b/modules/integral/api_reward.go @@ -47,12 +47,12 @@ func (this *apiComp) GetReward(session comm.IUserSession, req *pb.IntegralGetRew for _, v := range conf { if req.Itype == 1 { - if list.Reward1 < v.Val && list.Maxscore > int64(v.Val) { + if list.Reward1 < v.Val && list.Maxscore > v.Val { res = append(res, v.Prize...) list.Reward1 = v.Val } } else { - if list.Reward2 < v.Val && list.Totalscore > int64(v.Val) { + if list.Reward2 < v.Val && list.Totalscore > v.Val { res = append(res, v.Prize...) list.Reward2 = v.Val } diff --git a/modules/integral/model_integral.go b/modules/integral/model_integral.go index f7b3abe31..d3600d4eb 100644 --- a/modules/integral/model_integral.go +++ b/modules/integral/model_integral.go @@ -42,7 +42,7 @@ func (this *modelIntegral) getIntegralList(uid string) (result *pb.DBIntegralBos result.Id = primitive.NewObjectID().Hex() result.Uid = uid result.Buff = make(map[int32]int32) - result.Score = make(map[int32]int64) + result.Score = make(map[int32]int32) // 获取当前的hid curTime := configure.Now().Unix() diff --git a/pb/friend_db.pb.go b/pb/friend_db.pb.go index a09beea2f..e69ccbf25 100644 --- a/pb/friend_db.pb.go +++ b/pb/friend_db.pb.go @@ -40,6 +40,7 @@ type DBFriend struct { 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"` // 助战记录 Weapplyids []string `protobuf:"bytes,15,rep,name=weapplyids,proto3" json:"weapplyids" bson:"weapplyids"` //我申请的用户ID + CleanTime int64 `protobuf:"varint,16,opt,name=cleanTime,proto3" json:"cleanTime" bson:"cleanTime"` //清理申请列表时间 } func (x *DBFriend) Reset() { @@ -179,6 +180,13 @@ func (x *DBFriend) GetWeapplyids() []string { return nil } +func (x *DBFriend) GetCleanTime() int64 { + if x != nil { + return x.CleanTime + } + return 0 +} + //助战记录 type AssistRecord struct { state protoimpl.MessageState @@ -337,7 +345,7 @@ 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, 0x1a, 0x0a, 0x63, 0x6f, - 0x6d, 0x6d, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xc3, 0x03, 0x0a, 0x08, 0x44, 0x42, 0x46, + 0x6d, 0x6d, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xe1, 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, @@ -365,25 +373,27 @@ var file_friend_friend_db_proto_rawDesc = []byte{ 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, 0x12, 0x1e, 0x0a, 0x0a, 0x77, 0x65, 0x61, 0x70, 0x70, 0x6c, 0x79, 0x69, 0x64, 0x73, 0x18, 0x0f, 0x20, 0x03, - 0x28, 0x09, 0x52, 0x0a, 0x77, 0x65, 0x61, 0x70, 0x70, 0x6c, 0x79, 0x69, 0x64, 0x73, 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, + 0x28, 0x09, 0x52, 0x0a, 0x77, 0x65, 0x61, 0x70, 0x70, 0x6c, 0x79, 0x69, 0x64, 0x73, 0x12, 0x1c, + 0x0a, 0x09, 0x63, 0x6c, 0x65, 0x61, 0x6e, 0x54, 0x69, 0x6d, 0x65, 0x18, 0x10, 0x20, 0x01, 0x28, + 0x03, 0x52, 0x09, 0x63, 0x6c, 0x65, 0x61, 0x6e, 0x54, 0x69, 0x6d, 0x65, 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 ( diff --git a/pb/integral_db.pb.go b/pb/integral_db.pb.go index eabc2290c..1a4bca67b 100644 --- a/pb/integral_db.pb.go +++ b/pb/integral_db.pb.go @@ -32,13 +32,13 @@ type DBIntegralBoss struct { CTime int64 `protobuf:"varint,5,opt,name=cTime,proto3" json:"cTime" bson:"cTime"` //修改时间 Etime int64 `protobuf:"varint,6,opt,name=etime,proto3" json:"etime"` // 活动结束时间 Hid int32 `protobuf:"varint,7,opt,name=hid,proto3" json:"hid"` // 活动id - Maxscore int64 `protobuf:"varint,8,opt,name=maxscore,proto3" json:"maxscore"` // 最大积分 - Totalscore int64 `protobuf:"varint,9,opt,name=totalscore,proto3" json:"totalscore"` // 累计积分 + Maxscore int32 `protobuf:"varint,8,opt,name=maxscore,proto3" json:"maxscore"` // 最大积分 + Totalscore int32 `protobuf:"varint,9,opt,name=totalscore,proto3" json:"totalscore"` // 累计积分 Reward1 int32 `protobuf:"varint,10,opt,name=reward1,proto3" json:"reward1"` // 类型1 奖励( Integralreward ) Reward2 int32 `protobuf:"varint,11,opt,name=reward2,proto3" json:"reward2"` // 类型2 奖励( Integralreward ) Buff map[int32]int32 `protobuf:"bytes,12,rep,name=buff,proto3" json:"buff" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3"` // 激活的buff (key Integralcondition value :0 未激活) 注:事件类型 才有值 Nandu int32 `protobuf:"varint,13,opt,name=nandu,proto3" json:"nandu"` // 已经解锁的难度 - Score map[int32]int64 `protobuf:"bytes,14,rep,name=score,proto3" json:"score" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3"` // key 难度 value 积分 + Score map[int32]int32 `protobuf:"bytes,14,rep,name=score,proto3" json:"score" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3"` // key 难度 value 积分 } func (x *DBIntegralBoss) Reset() { @@ -122,14 +122,14 @@ func (x *DBIntegralBoss) GetHid() int32 { return 0 } -func (x *DBIntegralBoss) GetMaxscore() int64 { +func (x *DBIntegralBoss) GetMaxscore() int32 { if x != nil { return x.Maxscore } return 0 } -func (x *DBIntegralBoss) GetTotalscore() int64 { +func (x *DBIntegralBoss) GetTotalscore() int32 { if x != nil { return x.Totalscore } @@ -164,7 +164,7 @@ func (x *DBIntegralBoss) GetNandu() int32 { return 0 } -func (x *DBIntegralBoss) GetScore() map[int32]int64 { +func (x *DBIntegralBoss) GetScore() map[int32]int32 { if x != nil { return x.Score } @@ -186,9 +186,9 @@ var file_integral_integral_db_proto_rawDesc = []byte{ 0x69, 0x6d, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x65, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x65, 0x74, 0x69, 0x6d, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x68, 0x69, 0x64, 0x18, 0x07, 0x20, 0x01, 0x28, 0x05, 0x52, 0x03, 0x68, 0x69, 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x6d, - 0x61, 0x78, 0x73, 0x63, 0x6f, 0x72, 0x65, 0x18, 0x08, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x6d, + 0x61, 0x78, 0x73, 0x63, 0x6f, 0x72, 0x65, 0x18, 0x08, 0x20, 0x01, 0x28, 0x05, 0x52, 0x08, 0x6d, 0x61, 0x78, 0x73, 0x63, 0x6f, 0x72, 0x65, 0x12, 0x1e, 0x0a, 0x0a, 0x74, 0x6f, 0x74, 0x61, 0x6c, - 0x73, 0x63, 0x6f, 0x72, 0x65, 0x18, 0x09, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0a, 0x74, 0x6f, 0x74, + 0x73, 0x63, 0x6f, 0x72, 0x65, 0x18, 0x09, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0a, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x73, 0x63, 0x6f, 0x72, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x72, 0x65, 0x77, 0x61, 0x72, 0x64, 0x31, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x05, 0x52, 0x07, 0x72, 0x65, 0x77, 0x61, 0x72, 0x64, 0x31, 0x12, 0x18, 0x0a, 0x07, 0x72, 0x65, 0x77, 0x61, 0x72, 0x64, 0x32, 0x18, 0x0b, 0x20, 0x01, @@ -206,7 +206,7 @@ var file_integral_integral_db_proto_rawDesc = []byte{ 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x1a, 0x38, 0x0a, 0x0a, 0x53, 0x63, 0x6f, 0x72, 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, 0x14, 0x0a, 0x05, 0x76, - 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, + 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 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, } diff --git a/pb/integral_msg.pb.go b/pb/integral_msg.pb.go index fc28452a7..7e5a5dfd0 100644 --- a/pb/integral_msg.pb.go +++ b/pb/integral_msg.pb.go @@ -223,7 +223,7 @@ type IntegralChallengeOverReq struct { Nandu int32 `protobuf:"varint,1,opt,name=nandu,proto3" json:"nandu"` // boos 难度 Report *BattleReport `protobuf:"bytes,2,opt,name=report,proto3" json:"report"` //战报 - Score int64 `protobuf:"varint,3,opt,name=score,proto3" json:"score"` //获得积分 或伤害 + Score int32 `protobuf:"varint,3,opt,name=score,proto3" json:"score"` //获得积分 或伤害 } func (x *IntegralChallengeOverReq) Reset() { @@ -272,7 +272,7 @@ func (x *IntegralChallengeOverReq) GetReport() *BattleReport { return nil } -func (x *IntegralChallengeOverReq) GetScore() int64 { +func (x *IntegralChallengeOverReq) GetScore() int32 { if x != nil { return x.Score } @@ -460,7 +460,7 @@ var file_integral_integral_msg_proto_rawDesc = []byte{ 0x01, 0x28, 0x05, 0x52, 0x05, 0x6e, 0x61, 0x6e, 0x64, 0x75, 0x12, 0x25, 0x0a, 0x06, 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x42, 0x61, 0x74, 0x74, 0x6c, 0x65, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x52, 0x06, 0x72, 0x65, 0x70, 0x6f, 0x72, - 0x74, 0x12, 0x14, 0x0a, 0x05, 0x73, 0x63, 0x6f, 0x72, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, + 0x74, 0x12, 0x14, 0x0a, 0x05, 0x73, 0x63, 0x6f, 0x72, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x73, 0x63, 0x6f, 0x72, 0x65, 0x22, 0x40, 0x0a, 0x19, 0x49, 0x6e, 0x74, 0x65, 0x67, 0x72, 0x61, 0x6c, 0x43, 0x68, 0x61, 0x6c, 0x6c, 0x65, 0x6e, 0x67, 0x65, 0x4f, 0x76, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x12, 0x23, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x01, 0x20, 0x01, From 5691ecc4caaf63cdce60b7ed8f10b39946af27ff Mon Sep 17 00:00:00 2001 From: meixiongfeng <766881921@qq.com> Date: Mon, 25 Dec 2023 18:31:07 +0800 Subject: [PATCH 7/8] =?UTF-8?q?=E7=A7=AF=E5=88=86boss=20=E6=8E=A8=E8=8D=90?= =?UTF-8?q?=E9=98=B5=E5=AE=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- comm/const.go | 3 + modules/hero/api_rank.go | 17 ++- modules/integral/api_rank.go | 57 +++++++++ modules/integral/model_integral.go | 11 +- modules/integral/model_rank.go | 68 ++++++++++ modules/integral/module.go | 3 + pb/hero_msg.pb.go | 6 +- pb/integral_db.pb.go | 197 ++++++++++++++++++++++------- pb/integral_msg.pb.go | 172 ++++++++++++++++++++++--- 9 files changed, 462 insertions(+), 72 deletions(-) create mode 100644 modules/integral/api_rank.go create mode 100644 modules/integral/model_rank.go diff --git a/comm/const.go b/comm/const.go index 2985b7a7e..75dbd9dab 100644 --- a/comm/const.go +++ b/comm/const.go @@ -440,6 +440,9 @@ const ( TableEntertainRecode = "xxlrecode" //战报 TableDrawRecode = "drawrecode" //抽卡记录 + + // 积分boss 排行 + TableIntegralRank = "integralrank" //排名 ) // RPC服务接口定义处 diff --git a/modules/hero/api_rank.go b/modules/hero/api_rank.go index f768d17b7..160531ec4 100644 --- a/modules/hero/api_rank.go +++ b/modules/hero/api_rank.go @@ -12,12 +12,25 @@ func (this *apiComp) DrawRecordCheck(session comm.IUserSession, req *pb.HeroDraw } func (this *apiComp) DrawRecord(session comm.IUserSession, req *pb.HeroDrawRecordReq) (errdata *pb.ErrorData) { - var () + var ( + results []*pb.DBHeroDrawRecord + err error + ) if errdata = this.DrawRecordCheck(session, req); errdata != nil { return } - session.SendMsg(string(this.module.GetType()), "drawrecord", &pb.HeroDrawRecordResp{}) + if results, err = this.module.modelDrawRecode.getDrawCardRecord(session.GetUserId()); err != nil { + errdata = &pb.ErrorData{ + Code: pb.ErrorCode_DBError, + Title: pb.ErrorCode_DBError.ToString(), + Message: err.Error(), + } + return + } + session.SendMsg(string(this.module.GetType()), "drawrecord", &pb.HeroDrawRecordResp{ + Record: results, + }) return } diff --git a/modules/integral/api_rank.go b/modules/integral/api_rank.go new file mode 100644 index 000000000..fac3984b4 --- /dev/null +++ b/modules/integral/api_rank.go @@ -0,0 +1,57 @@ +package integral + +import ( + "go_dreamfactory/comm" + "go_dreamfactory/pb" +) + +// 参数校验 +func (this *apiComp) RankListCheck(session comm.IUserSession, req *pb.IntegralRankListReq) (errdata *pb.ErrorData) { + + return +} + +// /排行榜获取 +func (this *apiComp) RankList(session comm.IUserSession, req *pb.IntegralRankListReq) (errdata *pb.ErrorData) { + var ( + uids []string + ranks []*pb.DBIntegralBoss + players []*pb.DBIntegralRank + err error + ) + + if errdata = this.RankListCheck(session, req); errdata != nil { + return + } + + if uids, err = this.module.modelRank.queryRankUser(); err != nil { + errdata = &pb.ErrorData{ + Code: pb.ErrorCode_DBError, + Title: pb.ErrorCode_DBError.ToString(), + Message: err.Error(), + } + return + } + if ranks, err = this.module.modelIntegral.queryPlayers(uids); err != nil { + errdata = &pb.ErrorData{ + Code: pb.ErrorCode_DBError, + Title: pb.ErrorCode_DBError.ToString(), + Message: err.Error(), + } + return + } + players = make([]*pb.DBIntegralRank, len(ranks)) + for i, v := range ranks { + // rank := int32(i + 1) + players[i] = &pb.DBIntegralRank{ + Id: v.Uid, + Uinfo: v.Uinfo, + Nandu: v.Nandu, + Score: v.Maxscore, + } + } + session.SendMsg(string(this.module.GetType()), "rank", &pb.IntegralRankListResp{ + Ranks: players, + }) + return +} diff --git a/modules/integral/model_integral.go b/modules/integral/model_integral.go index d3600d4eb..429eccc36 100644 --- a/modules/integral/model_integral.go +++ b/modules/integral/model_integral.go @@ -35,6 +35,15 @@ func (this *modelIntegral) modifyIntegralData(uid string, data map[string]interf return this.Change(uid, data) } +func (this *modelIntegral) queryPlayers(uIds []string) (result []*pb.DBIntegralBoss, err error) { + result = make([]*pb.DBIntegralBoss, 0) + if _, err = this.Gets(uIds, &result); err != nil && err != mgo.MongodbNil { + this.module.Errorln(err) + return + } + return +} + // 获取列表信息 func (this *modelIntegral) getIntegralList(uid string) (result *pb.DBIntegralBoss, err error) { result = &pb.DBIntegralBoss{} @@ -51,7 +60,7 @@ func (this *modelIntegral) getIntegralList(uid string) (result *pb.DBIntegralBos openTime := this.module.service.GetOpentime().Unix() for _, v := range szConf { if curTime >= int64(v.Openday)+openTime && curTime <= int64(v.Endday)+openTime { - result.Hid = v.Endday + result.Hid = v.Hdid result.Etime = int64(v.Endday) + openTime result.CTime = curTime break diff --git a/modules/integral/model_rank.go b/modules/integral/model_rank.go new file mode 100644 index 000000000..860351dd2 --- /dev/null +++ b/modules/integral/model_rank.go @@ -0,0 +1,68 @@ +package integral + +import ( + "context" + "go_dreamfactory/comm" + "go_dreamfactory/lego/core" + "go_dreamfactory/lego/sys/redis/pipe" + "go_dreamfactory/modules" + "go_dreamfactory/pb" + + "github.com/go-redis/redis/v8" +) + +type modelRank struct { + modules.MCompModel + module *Integral +} + +// 组件初始化接口 +func (this *modelRank) Init(service core.IService, module core.IModule, comp core.IModuleComp, opt core.IModuleOptions) (err error) { + this.TableName = comm.TableIntegralRank + this.MCompModel.Init(service, module, comp, opt) + this.module = module.(*Integral) + + return +} + +// 更新排名 +func (this *modelRank) updateRank(data *pb.DBIntegralRank) (err error) { + var ( + pipe *pipe.RedisPipe = this.DBModel.Redis.RedisPipe(context.TODO()) + menbers *redis.Z + cmd *redis.IntCmd + ) + + menbers = &redis.Z{Score: float64(data.Score), Member: data.Uinfo.Uid} + + if cmd = pipe.ZAdd(this.TableName, menbers); err != nil { + this.module.Errorln(err) + } + + if _, err = pipe.Exec(); err != nil { + this.module.Errorln(err) + return + } + if _, err = cmd.Result(); err != nil { + this.module.Errorln(err) + return + } + + return +} + +// 获取排行榜前50的用户名单 +func (this *modelRank) queryRankUser() (ranks []string, err error) { + var ( + result []string + ) + if result, err = this.DBModel.Redis.ZRevRange(this.TableName, 0, 50).Result(); err != nil { + this.module.Errorln(err) + return + } + ranks = make([]string, 0) + for i := 0; i < len(result); i += 1 { + ranks = append(ranks, result[i]) + } + return +} diff --git a/modules/integral/module.go b/modules/integral/module.go index 36116d445..635989379 100644 --- a/modules/integral/module.go +++ b/modules/integral/module.go @@ -17,6 +17,8 @@ type Integral struct { battle comm.IBattle service base.IRPCXService + + modelRank *modelRank } func NewModule() core.IModule { @@ -53,6 +55,7 @@ func (this *Integral) OnInstallComp() { this.api = this.RegisterComp(new(apiComp)).(*apiComp) this.modelIntegral = this.RegisterComp(new(modelIntegral)).(*modelIntegral) this.configure = this.RegisterComp(new(configureComp)).(*configureComp) + this.modelRank = this.RegisterComp(new(modelRank)).(*modelRank) } // 任务条件达成通知 diff --git a/pb/hero_msg.pb.go b/pb/hero_msg.pb.go index d403da9a3..45cb22e67 100644 --- a/pb/hero_msg.pb.go +++ b/pb/hero_msg.pb.go @@ -2295,7 +2295,7 @@ type HeroDrawRecordResp struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Record *DBHeroDrawRecord `protobuf:"bytes,1,opt,name=record,proto3" json:"record"` // 扩展数据 + Record []*DBHeroDrawRecord `protobuf:"bytes,1,rep,name=record,proto3" json:"record"` } func (x *HeroDrawRecordResp) Reset() { @@ -2330,7 +2330,7 @@ func (*HeroDrawRecordResp) Descriptor() ([]byte, []int) { return file_hero_hero_msg_proto_rawDescGZIP(), []int{44} } -func (x *HeroDrawRecordResp) GetRecord() *DBHeroDrawRecord { +func (x *HeroDrawRecordResp) GetRecord() []*DBHeroDrawRecord { if x != nil { return x.Record } @@ -2550,7 +2550,7 @@ var file_hero_hero_msg_proto_rawDesc = []byte{ 0x65, 0x72, 0x6f, 0x44, 0x72, 0x61, 0x77, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x52, 0x65, 0x71, 0x22, 0x3f, 0x0a, 0x12, 0x48, 0x65, 0x72, 0x6f, 0x44, 0x72, 0x61, 0x77, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x52, 0x65, 0x73, 0x70, 0x12, 0x29, 0x0a, 0x06, 0x72, 0x65, 0x63, 0x6f, 0x72, 0x64, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x44, 0x42, 0x48, 0x65, 0x72, 0x6f, 0x44, + 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x44, 0x42, 0x48, 0x65, 0x72, 0x6f, 0x44, 0x72, 0x61, 0x77, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x52, 0x06, 0x72, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, diff --git a/pb/integral_db.pb.go b/pb/integral_db.pb.go index 1a4bca67b..0749efd05 100644 --- a/pb/integral_db.pb.go +++ b/pb/integral_db.pb.go @@ -39,6 +39,7 @@ type DBIntegralBoss struct { Buff map[int32]int32 `protobuf:"bytes,12,rep,name=buff,proto3" json:"buff" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3"` // 激活的buff (key Integralcondition value :0 未激活) 注:事件类型 才有值 Nandu int32 `protobuf:"varint,13,opt,name=nandu,proto3" json:"nandu"` // 已经解锁的难度 Score map[int32]int32 `protobuf:"bytes,14,rep,name=score,proto3" json:"score" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3"` // key 难度 value 积分 + Uinfo *BaseUserInfo `protobuf:"bytes,15,opt,name=uinfo,proto3" json:"uinfo"` //用户基础 } func (x *DBIntegralBoss) Reset() { @@ -171,44 +172,133 @@ func (x *DBIntegralBoss) GetScore() map[int32]int32 { return nil } +func (x *DBIntegralBoss) GetUinfo() *BaseUserInfo { + if x != nil { + return x.Uinfo + } + return nil +} + +// 积分boss 排行 +type DBIntegralRank struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id" bson:"_id"` //ID + Uinfo *BaseUserInfo `protobuf:"bytes,2,opt,name=uinfo,proto3" json:"uinfo"` //用户基础 + Nandu int32 `protobuf:"varint,3,opt,name=nandu,proto3" json:"nandu"` + Score int32 `protobuf:"varint,4,opt,name=score,proto3" json:"score"` // 积分 +} + +func (x *DBIntegralRank) Reset() { + *x = DBIntegralRank{} + if protoimpl.UnsafeEnabled { + mi := &file_integral_integral_db_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *DBIntegralRank) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DBIntegralRank) ProtoMessage() {} + +func (x *DBIntegralRank) ProtoReflect() protoreflect.Message { + mi := &file_integral_integral_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 DBIntegralRank.ProtoReflect.Descriptor instead. +func (*DBIntegralRank) Descriptor() ([]byte, []int) { + return file_integral_integral_db_proto_rawDescGZIP(), []int{1} +} + +func (x *DBIntegralRank) GetId() string { + if x != nil { + return x.Id + } + return "" +} + +func (x *DBIntegralRank) GetUinfo() *BaseUserInfo { + if x != nil { + return x.Uinfo + } + return nil +} + +func (x *DBIntegralRank) GetNandu() int32 { + if x != nil { + return x.Nandu + } + return 0 +} + +func (x *DBIntegralRank) GetScore() int32 { + if x != nil { + return x.Score + } + return 0 +} + var File_integral_integral_db_proto protoreflect.FileDescriptor var file_integral_integral_db_proto_rawDesc = []byte{ 0x0a, 0x1a, 0x69, 0x6e, 0x74, 0x65, 0x67, 0x72, 0x61, 0x6c, 0x2f, 0x69, 0x6e, 0x74, 0x65, 0x67, - 0x72, 0x61, 0x6c, 0x5f, 0x64, 0x62, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xf6, 0x03, 0x0a, - 0x0e, 0x44, 0x42, 0x49, 0x6e, 0x74, 0x65, 0x67, 0x72, 0x61, 0x6c, 0x42, 0x6f, 0x73, 0x73, 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, 0x14, 0x0a, 0x05, 0x69, 0x74, 0x79, 0x70, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, - 0x52, 0x05, 0x69, 0x74, 0x79, 0x70, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, - 0x18, 0x04, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x14, 0x0a, - 0x05, 0x63, 0x54, 0x69, 0x6d, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x63, 0x54, - 0x69, 0x6d, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x65, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x06, 0x20, 0x01, - 0x28, 0x03, 0x52, 0x05, 0x65, 0x74, 0x69, 0x6d, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x68, 0x69, 0x64, - 0x18, 0x07, 0x20, 0x01, 0x28, 0x05, 0x52, 0x03, 0x68, 0x69, 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x6d, - 0x61, 0x78, 0x73, 0x63, 0x6f, 0x72, 0x65, 0x18, 0x08, 0x20, 0x01, 0x28, 0x05, 0x52, 0x08, 0x6d, - 0x61, 0x78, 0x73, 0x63, 0x6f, 0x72, 0x65, 0x12, 0x1e, 0x0a, 0x0a, 0x74, 0x6f, 0x74, 0x61, 0x6c, - 0x73, 0x63, 0x6f, 0x72, 0x65, 0x18, 0x09, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0a, 0x74, 0x6f, 0x74, - 0x61, 0x6c, 0x73, 0x63, 0x6f, 0x72, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x72, 0x65, 0x77, 0x61, 0x72, - 0x64, 0x31, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x05, 0x52, 0x07, 0x72, 0x65, 0x77, 0x61, 0x72, 0x64, - 0x31, 0x12, 0x18, 0x0a, 0x07, 0x72, 0x65, 0x77, 0x61, 0x72, 0x64, 0x32, 0x18, 0x0b, 0x20, 0x01, - 0x28, 0x05, 0x52, 0x07, 0x72, 0x65, 0x77, 0x61, 0x72, 0x64, 0x32, 0x12, 0x2d, 0x0a, 0x04, 0x62, - 0x75, 0x66, 0x66, 0x18, 0x0c, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x44, 0x42, 0x49, 0x6e, - 0x74, 0x65, 0x67, 0x72, 0x61, 0x6c, 0x42, 0x6f, 0x73, 0x73, 0x2e, 0x42, 0x75, 0x66, 0x66, 0x45, - 0x6e, 0x74, 0x72, 0x79, 0x52, 0x04, 0x62, 0x75, 0x66, 0x66, 0x12, 0x14, 0x0a, 0x05, 0x6e, 0x61, - 0x6e, 0x64, 0x75, 0x18, 0x0d, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x6e, 0x61, 0x6e, 0x64, 0x75, - 0x12, 0x30, 0x0a, 0x05, 0x73, 0x63, 0x6f, 0x72, 0x65, 0x18, 0x0e, 0x20, 0x03, 0x28, 0x0b, 0x32, - 0x1a, 0x2e, 0x44, 0x42, 0x49, 0x6e, 0x74, 0x65, 0x67, 0x72, 0x61, 0x6c, 0x42, 0x6f, 0x73, 0x73, - 0x2e, 0x53, 0x63, 0x6f, 0x72, 0x65, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x05, 0x73, 0x63, 0x6f, - 0x72, 0x65, 0x1a, 0x37, 0x0a, 0x09, 0x42, 0x75, 0x66, 0x66, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, - 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x03, 0x6b, 0x65, - 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, - 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x1a, 0x38, 0x0a, 0x0a, 0x53, - 0x63, 0x6f, 0x72, 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, 0x14, 0x0a, 0x05, 0x76, - 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 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, + 0x72, 0x61, 0x6c, 0x5f, 0x64, 0x62, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x0a, 0x63, 0x6f, + 0x6d, 0x6d, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x9b, 0x04, 0x0a, 0x0e, 0x44, 0x42, 0x49, + 0x6e, 0x74, 0x65, 0x67, 0x72, 0x61, 0x6c, 0x42, 0x6f, 0x73, 0x73, 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, 0x14, 0x0a, + 0x05, 0x69, 0x74, 0x79, 0x70, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x69, 0x74, + 0x79, 0x70, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x04, 0x20, 0x01, + 0x28, 0x05, 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x63, 0x54, 0x69, + 0x6d, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x63, 0x54, 0x69, 0x6d, 0x65, 0x12, + 0x14, 0x0a, 0x05, 0x65, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, + 0x65, 0x74, 0x69, 0x6d, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x68, 0x69, 0x64, 0x18, 0x07, 0x20, 0x01, + 0x28, 0x05, 0x52, 0x03, 0x68, 0x69, 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x6d, 0x61, 0x78, 0x73, 0x63, + 0x6f, 0x72, 0x65, 0x18, 0x08, 0x20, 0x01, 0x28, 0x05, 0x52, 0x08, 0x6d, 0x61, 0x78, 0x73, 0x63, + 0x6f, 0x72, 0x65, 0x12, 0x1e, 0x0a, 0x0a, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x73, 0x63, 0x6f, 0x72, + 0x65, 0x18, 0x09, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0a, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x73, 0x63, + 0x6f, 0x72, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x72, 0x65, 0x77, 0x61, 0x72, 0x64, 0x31, 0x18, 0x0a, + 0x20, 0x01, 0x28, 0x05, 0x52, 0x07, 0x72, 0x65, 0x77, 0x61, 0x72, 0x64, 0x31, 0x12, 0x18, 0x0a, + 0x07, 0x72, 0x65, 0x77, 0x61, 0x72, 0x64, 0x32, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x05, 0x52, 0x07, + 0x72, 0x65, 0x77, 0x61, 0x72, 0x64, 0x32, 0x12, 0x2d, 0x0a, 0x04, 0x62, 0x75, 0x66, 0x66, 0x18, + 0x0c, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x44, 0x42, 0x49, 0x6e, 0x74, 0x65, 0x67, 0x72, + 0x61, 0x6c, 0x42, 0x6f, 0x73, 0x73, 0x2e, 0x42, 0x75, 0x66, 0x66, 0x45, 0x6e, 0x74, 0x72, 0x79, + 0x52, 0x04, 0x62, 0x75, 0x66, 0x66, 0x12, 0x14, 0x0a, 0x05, 0x6e, 0x61, 0x6e, 0x64, 0x75, 0x18, + 0x0d, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x6e, 0x61, 0x6e, 0x64, 0x75, 0x12, 0x30, 0x0a, 0x05, + 0x73, 0x63, 0x6f, 0x72, 0x65, 0x18, 0x0e, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x44, 0x42, + 0x49, 0x6e, 0x74, 0x65, 0x67, 0x72, 0x61, 0x6c, 0x42, 0x6f, 0x73, 0x73, 0x2e, 0x53, 0x63, 0x6f, + 0x72, 0x65, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x05, 0x73, 0x63, 0x6f, 0x72, 0x65, 0x12, 0x23, + 0x0a, 0x05, 0x75, 0x69, 0x6e, 0x66, 0x6f, 0x18, 0x0f, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0d, 0x2e, + 0x42, 0x61, 0x73, 0x65, 0x55, 0x73, 0x65, 0x72, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x05, 0x75, 0x69, + 0x6e, 0x66, 0x6f, 0x1a, 0x37, 0x0a, 0x09, 0x42, 0x75, 0x66, 0x66, 0x45, 0x6e, 0x74, 0x72, 0x79, + 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x03, 0x6b, + 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x05, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x1a, 0x38, 0x0a, 0x0a, + 0x53, 0x63, 0x6f, 0x72, 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, 0x14, 0x0a, 0x05, + 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x76, 0x61, 0x6c, + 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x22, 0x71, 0x0a, 0x0e, 0x44, 0x42, 0x49, 0x6e, 0x74, 0x65, + 0x67, 0x72, 0x61, 0x6c, 0x52, 0x61, 0x6e, 0x6b, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x23, 0x0a, 0x05, 0x75, 0x69, 0x6e, 0x66, + 0x6f, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x42, 0x61, 0x73, 0x65, 0x55, 0x73, + 0x65, 0x72, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x05, 0x75, 0x69, 0x6e, 0x66, 0x6f, 0x12, 0x14, 0x0a, + 0x05, 0x6e, 0x61, 0x6e, 0x64, 0x75, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x6e, 0x61, + 0x6e, 0x64, 0x75, 0x12, 0x14, 0x0a, 0x05, 0x73, 0x63, 0x6f, 0x72, 0x65, 0x18, 0x04, 0x20, 0x01, + 0x28, 0x05, 0x52, 0x05, 0x73, 0x63, 0x6f, 0x72, 0x65, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, + 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -223,20 +313,24 @@ func file_integral_integral_db_proto_rawDescGZIP() []byte { return file_integral_integral_db_proto_rawDescData } -var file_integral_integral_db_proto_msgTypes = make([]protoimpl.MessageInfo, 3) +var file_integral_integral_db_proto_msgTypes = make([]protoimpl.MessageInfo, 4) var file_integral_integral_db_proto_goTypes = []interface{}{ (*DBIntegralBoss)(nil), // 0: DBIntegralBoss - nil, // 1: DBIntegralBoss.BuffEntry - nil, // 2: DBIntegralBoss.ScoreEntry + (*DBIntegralRank)(nil), // 1: DBIntegralRank + nil, // 2: DBIntegralBoss.BuffEntry + nil, // 3: DBIntegralBoss.ScoreEntry + (*BaseUserInfo)(nil), // 4: BaseUserInfo } var file_integral_integral_db_proto_depIdxs = []int32{ - 1, // 0: DBIntegralBoss.buff:type_name -> DBIntegralBoss.BuffEntry - 2, // 1: DBIntegralBoss.score:type_name -> DBIntegralBoss.ScoreEntry - 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 + 2, // 0: DBIntegralBoss.buff:type_name -> DBIntegralBoss.BuffEntry + 3, // 1: DBIntegralBoss.score:type_name -> DBIntegralBoss.ScoreEntry + 4, // 2: DBIntegralBoss.uinfo:type_name -> BaseUserInfo + 4, // 3: DBIntegralRank.uinfo:type_name -> BaseUserInfo + 4, // [4:4] is the sub-list for method output_type + 4, // [4:4] is the sub-list for method input_type + 4, // [4:4] is the sub-list for extension type_name + 4, // [4:4] is the sub-list for extension extendee + 0, // [0:4] is the sub-list for field type_name } func init() { file_integral_integral_db_proto_init() } @@ -244,6 +338,7 @@ func file_integral_integral_db_proto_init() { if File_integral_integral_db_proto != nil { return } + file_comm_proto_init() if !protoimpl.UnsafeEnabled { file_integral_integral_db_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*DBIntegralBoss); i { @@ -257,6 +352,18 @@ func file_integral_integral_db_proto_init() { return nil } } + file_integral_integral_db_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*DBIntegralRank); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } } type x struct{} out := protoimpl.TypeBuilder{ @@ -264,7 +371,7 @@ func file_integral_integral_db_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_integral_integral_db_proto_rawDesc, NumEnums: 0, - NumMessages: 3, + NumMessages: 4, NumExtensions: 0, NumServices: 0, }, diff --git a/pb/integral_msg.pb.go b/pb/integral_msg.pb.go index 7e5a5dfd0..6083e36b9 100644 --- a/pb/integral_msg.pb.go +++ b/pb/integral_msg.pb.go @@ -430,6 +430,101 @@ func (x *IntegralGetRewardResp) GetAward() []*UserAtno { return nil } +// 获取排行榜 +type IntegralRankListReq struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Nandu int32 `protobuf:"varint,1,opt,name=nandu,proto3" json:"nandu"` // 难度 +} + +func (x *IntegralRankListReq) Reset() { + *x = IntegralRankListReq{} + if protoimpl.UnsafeEnabled { + mi := &file_integral_integral_msg_proto_msgTypes[8] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *IntegralRankListReq) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*IntegralRankListReq) ProtoMessage() {} + +func (x *IntegralRankListReq) ProtoReflect() protoreflect.Message { + mi := &file_integral_integral_msg_proto_msgTypes[8] + 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 IntegralRankListReq.ProtoReflect.Descriptor instead. +func (*IntegralRankListReq) Descriptor() ([]byte, []int) { + return file_integral_integral_msg_proto_rawDescGZIP(), []int{8} +} + +func (x *IntegralRankListReq) GetNandu() int32 { + if x != nil { + return x.Nandu + } + return 0 +} + +type IntegralRankListResp struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Ranks []*DBIntegralRank `protobuf:"bytes,1,rep,name=ranks,proto3" json:"ranks"` +} + +func (x *IntegralRankListResp) Reset() { + *x = IntegralRankListResp{} + if protoimpl.UnsafeEnabled { + mi := &file_integral_integral_msg_proto_msgTypes[9] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *IntegralRankListResp) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*IntegralRankListResp) ProtoMessage() {} + +func (x *IntegralRankListResp) ProtoReflect() protoreflect.Message { + mi := &file_integral_integral_msg_proto_msgTypes[9] + 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 IntegralRankListResp.ProtoReflect.Descriptor instead. +func (*IntegralRankListResp) Descriptor() ([]byte, []int) { + return file_integral_integral_msg_proto_rawDescGZIP(), []int{9} +} + +func (x *IntegralRankListResp) GetRanks() []*DBIntegralRank { + if x != nil { + return x.Ranks + } + return nil +} + var File_integral_integral_msg_proto protoreflect.FileDescriptor var file_integral_integral_msg_proto_rawDesc = []byte{ @@ -474,8 +569,15 @@ var file_integral_integral_msg_proto_rawDesc = []byte{ 0x2e, 0x44, 0x42, 0x49, 0x6e, 0x74, 0x65, 0x67, 0x72, 0x61, 0x6c, 0x42, 0x6f, 0x73, 0x73, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x12, 0x1f, 0x0a, 0x05, 0x61, 0x77, 0x61, 0x72, 0x64, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x09, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x41, 0x74, 0x6e, 0x6f, 0x52, - 0x05, 0x61, 0x77, 0x61, 0x72, 0x64, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x05, 0x61, 0x77, 0x61, 0x72, 0x64, 0x22, 0x2b, 0x0a, 0x13, 0x49, 0x6e, 0x74, 0x65, 0x67, 0x72, + 0x61, 0x6c, 0x52, 0x61, 0x6e, 0x6b, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x71, 0x12, 0x14, 0x0a, + 0x05, 0x6e, 0x61, 0x6e, 0x64, 0x75, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x6e, 0x61, + 0x6e, 0x64, 0x75, 0x22, 0x3d, 0x0a, 0x14, 0x49, 0x6e, 0x74, 0x65, 0x67, 0x72, 0x61, 0x6c, 0x52, + 0x61, 0x6e, 0x6b, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x73, 0x70, 0x12, 0x25, 0x0a, 0x05, 0x72, + 0x61, 0x6e, 0x6b, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x44, 0x42, 0x49, + 0x6e, 0x74, 0x65, 0x67, 0x72, 0x61, 0x6c, 0x52, 0x61, 0x6e, 0x6b, 0x52, 0x05, 0x72, 0x61, 0x6e, + 0x6b, 0x73, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x33, } var ( @@ -490,7 +592,7 @@ func file_integral_integral_msg_proto_rawDescGZIP() []byte { return file_integral_integral_msg_proto_rawDescData } -var file_integral_integral_msg_proto_msgTypes = make([]protoimpl.MessageInfo, 8) +var file_integral_integral_msg_proto_msgTypes = make([]protoimpl.MessageInfo, 10) var file_integral_integral_msg_proto_goTypes = []interface{}{ (*IntegralGetListReq)(nil), // 0: IntegralGetListReq (*IntegralGetListResp)(nil), // 1: IntegralGetListResp @@ -500,25 +602,29 @@ var file_integral_integral_msg_proto_goTypes = []interface{}{ (*IntegralChallengeOverResp)(nil), // 5: IntegralChallengeOverResp (*IntegralGetRewardReq)(nil), // 6: IntegralGetRewardReq (*IntegralGetRewardResp)(nil), // 7: IntegralGetRewardResp - (*DBIntegralBoss)(nil), // 8: DBIntegralBoss - (*BattleFormation)(nil), // 9: BattleFormation - (*BattleInfo)(nil), // 10: BattleInfo - (*BattleReport)(nil), // 11: BattleReport - (*UserAtno)(nil), // 12: UserAtno + (*IntegralRankListReq)(nil), // 8: IntegralRankListReq + (*IntegralRankListResp)(nil), // 9: IntegralRankListResp + (*DBIntegralBoss)(nil), // 10: DBIntegralBoss + (*BattleFormation)(nil), // 11: BattleFormation + (*BattleInfo)(nil), // 12: BattleInfo + (*BattleReport)(nil), // 13: BattleReport + (*UserAtno)(nil), // 14: UserAtno + (*DBIntegralRank)(nil), // 15: DBIntegralRank } var file_integral_integral_msg_proto_depIdxs = []int32{ - 8, // 0: IntegralGetListResp.data:type_name -> DBIntegralBoss - 9, // 1: IntegralChallengeReq.battle:type_name -> BattleFormation - 10, // 2: IntegralChallengeResp.info:type_name -> BattleInfo - 11, // 3: IntegralChallengeOverReq.report:type_name -> BattleReport - 8, // 4: IntegralChallengeOverResp.data:type_name -> DBIntegralBoss - 8, // 5: IntegralGetRewardResp.data:type_name -> DBIntegralBoss - 12, // 6: IntegralGetRewardResp.award:type_name -> UserAtno - 7, // [7:7] is the sub-list for method output_type - 7, // [7:7] is the sub-list for method input_type - 7, // [7:7] is the sub-list for extension type_name - 7, // [7:7] is the sub-list for extension extendee - 0, // [0:7] is the sub-list for field type_name + 10, // 0: IntegralGetListResp.data:type_name -> DBIntegralBoss + 11, // 1: IntegralChallengeReq.battle:type_name -> BattleFormation + 12, // 2: IntegralChallengeResp.info:type_name -> BattleInfo + 13, // 3: IntegralChallengeOverReq.report:type_name -> BattleReport + 10, // 4: IntegralChallengeOverResp.data:type_name -> DBIntegralBoss + 10, // 5: IntegralGetRewardResp.data:type_name -> DBIntegralBoss + 14, // 6: IntegralGetRewardResp.award:type_name -> UserAtno + 15, // 7: IntegralRankListResp.ranks:type_name -> DBIntegralRank + 8, // [8:8] is the sub-list for method output_type + 8, // [8:8] is the sub-list for method input_type + 8, // [8:8] is the sub-list for extension type_name + 8, // [8:8] is the sub-list for extension extendee + 0, // [0:8] is the sub-list for field type_name } func init() { file_integral_integral_msg_proto_init() } @@ -626,6 +732,30 @@ func file_integral_integral_msg_proto_init() { return nil } } + file_integral_integral_msg_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*IntegralRankListReq); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_integral_integral_msg_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*IntegralRankListResp); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } } type x struct{} out := protoimpl.TypeBuilder{ @@ -633,7 +763,7 @@ func file_integral_integral_msg_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_integral_integral_msg_proto_rawDesc, NumEnums: 0, - NumMessages: 8, + NumMessages: 10, NumExtensions: 0, NumServices: 0, }, From 17313a234ff4c5eae5103a6c61043a34179bc690 Mon Sep 17 00:00:00 2001 From: meixiongfeng <766881921@qq.com> Date: Mon, 25 Dec 2023 18:47:32 +0800 Subject: [PATCH 8/8] update --- modules/integral/api_getlist.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/integral/api_getlist.go b/modules/integral/api_getlist.go index 89d1db755..0c07c1dd6 100644 --- a/modules/integral/api_getlist.go +++ b/modules/integral/api_getlist.go @@ -47,7 +47,7 @@ func (this *apiComp) GetList(session comm.IUserSession, req *pb.IntegralGetListR list.Etime = 0 for _, v := range szConf { //if curTime >= int64(v.Openday)+openTime && curTime <= int64(v.Endday)+openTime { // 暂时不校验天数 - list.Hid = v.Endday + list.Hid = v.Hdid list.Etime = int64(v.Endday) + curTime break //}