From afc3f2ccf014c94d2485f44411623b92fc40ac06 Mon Sep 17 00:00:00 2001 From: wh_zcy Date: Sun, 15 Jan 2023 18:55:17 +0800 Subject: [PATCH 1/3] updata guildtask --- modules/sociaty/api.go | 1 + modules/sociaty/api_cross_breceive.go | 20 +++- modules/sociaty/api_cross_recommend.go | 29 +++++ modules/sociaty/config.go | 14 +++ modules/sociaty/model_sociatyboss.go | 30 ++++- pb/sociaty_msg.pb.go | 151 ++++++++++++------------- 6 files changed, 166 insertions(+), 79 deletions(-) create mode 100644 modules/sociaty/api_cross_recommend.go diff --git a/modules/sociaty/api.go b/modules/sociaty/api.go index 63ec80db0..e32713789 100644 --- a/modules/sociaty/api.go +++ b/modules/sociaty/api.go @@ -42,6 +42,7 @@ const ( SociatySubTypeBuy = "buy" SociatySubTypeBuynum = "buynum" SociatySubTypeBreceive = "breceive" + SociatySubTypeRecommend = "recommend" ) type apiComp struct { diff --git a/modules/sociaty/api_cross_breceive.go b/modules/sociaty/api_cross_breceive.go index c1986a064..4a59f3d43 100644 --- a/modules/sociaty/api_cross_breceive.go +++ b/modules/sociaty/api_cross_breceive.go @@ -46,13 +46,29 @@ func (this *apiComp) Breceive(session comm.IUserSession, req *pb.SociatyBReceive } else if taskId == 0 { //未完成 code = pb.ErrorCode_SociatyTaskNoFinished return + } else if taskId == 1 { //可领取 + task.Status = 2 } break } } - //更新任务状态 - + //更新任务状态 + update := map[string]interface{}{ + "tasks": dbr.Tasks, + } + if err := this.module.modelSociatyBoss.Change(uid, update); err != nil { + code = pb.ErrorCode_DBError + return + } + + // 奖励 + if code := this.module.DispenseRes(session, taskConf.Reward, true); code != pb.ErrorCode_Success { + this.module.Error("积分任务奖励领取", + log.Field{Key: "uid", Value: uid}, + log.Field{Key: "taskId", Value: taskId}, + log.Field{Key: "reward", Value: taskConf.Reward}) + } rsp := &pb.SociatyBReceiveResp{ SociatyId: sociaty.Id, diff --git a/modules/sociaty/api_cross_recommend.go b/modules/sociaty/api_cross_recommend.go new file mode 100644 index 000000000..2dc382594 --- /dev/null +++ b/modules/sociaty/api_cross_recommend.go @@ -0,0 +1,29 @@ +package sociaty + +import ( + "go_dreamfactory/comm" + "go_dreamfactory/pb" + + "google.golang.org/protobuf/proto" +) + +// 公会BOSS 推荐 +func (this *apiComp) RecommendCheck(session comm.IUserSession, req *pb.SociatyRecommendReq) (code pb.ErrorCode) { + if req.Cate != 1 || req.Cate != 2 { + code = pb.ErrorCode_ReqParameterError + } + return +} + +func (this *apiComp) Recommend(session comm.IUserSession, req *pb.SociatyRecommendReq) (code pb.ErrorCode, data proto.Message) { + if code = this.RecommendCheck(session, req); code != pb.ErrorCode_Success { + return + } + + rsp := &pb.SociatyRecommendResp{} + + if err := session.SendMsg(string(this.module.GetType()), SociatySubTypeRecommend, rsp); err != nil { + code = pb.ErrorCode_SystemError + } + return +} diff --git a/modules/sociaty/config.go b/modules/sociaty/config.go index f8556e665..85add7e4f 100644 --- a/modules/sociaty/config.go +++ b/modules/sociaty/config.go @@ -134,3 +134,17 @@ func (this *configureComp) getBossTask(taskId int32) *cfg.GameGuildBossTaskData } return nil } + +// 积分任务列表 +func (this *configureComp) getBossTaskList() []*cfg.GameGuildBossTaskData { + if v, err := this.GetConfigure(gameSociatyBossTask); err != nil { + return nil + } else { + data, ok := v.(*cfg.GameGuildBossTask) + if !ok { + err = fmt.Errorf("%T no is *cfg.GameGuildActivity", v) + return nil + } + return data.GetDataList() + } +} diff --git a/modules/sociaty/model_sociatyboss.go b/modules/sociaty/model_sociatyboss.go index 953d92de1..473863c47 100644 --- a/modules/sociaty/model_sociatyboss.go +++ b/modules/sociaty/model_sociatyboss.go @@ -457,6 +457,7 @@ func (s *ModelSociatyBoss) reset() error { for _, v := range record { update := map[string]interface{}{ "status": 1, //归档 + "tasks": []*pb.ChallengeTask{}, } if err := s.Change(BOSS_SPORTS, update); err != nil { s.moduleSociaty.Error("归档玩家赛事记录", log.Field{Key: "uid", Value: v.Uid}, log.Field{Key: "err", Value: err.Error()}) @@ -508,13 +509,40 @@ func (s *ModelSociatyBoss) settlement() error { } } - // 更新玩家赛季信息 + // 更新玩家赛季历史记录 + isExist := func(tasks []*pb.ChallengeTask, taskId int32) bool { + for _, task := range tasks { + if task.TaskId == taskId { + return true + } + } + return false + } + // 判断积分任务是否达标 + var tasks []*pb.ChallengeTask + var taskFlag bool //任务更新状态 + taskList := s.moduleSociaty.configure.getBossTaskList() + for _, task := range taskList { + if total >= int64(task.Score) && !isExist(cr.Tasks, task.Id) { + tasks = append(tasks, &pb.ChallengeTask{ + TaskId: task.Id, + Status: 1, //可领取 + }) + taskFlag = true + } + } + cr.Total = total cr.Integrals = highScore update := map[string]interface{}{ "total": total, "integrals": highScore, } + + // 任务状态有变化时更新 + if taskFlag { + update["tasks"] = tasks + } if err := s.Change(uid, update); err != nil { s.moduleSociaty.Error("更新玩家赛事信息", log.Field{Key: "uid", Value: uid}, log.Field{Key: "err", Value: err.Error()}) continue diff --git a/pb/sociaty_msg.pb.go b/pb/sociaty_msg.pb.go index 418c8804e..9b9627083 100644 --- a/pb/sociaty_msg.pb.go +++ b/pb/sociaty_msg.pb.go @@ -3193,7 +3193,7 @@ func (x *SociatyBChallengeFinishResp) GetIntegral() int64 { } // 公会BOSS 阵容推荐 -type SociatyBFormationRecoReq struct { +type SociatyRecommendReq struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields @@ -3201,8 +3201,8 @@ type SociatyBFormationRecoReq struct { Cate int32 `protobuf:"varint,1,opt,name=cate,proto3" json:"cate"` // 1全服排行 2好友排行 } -func (x *SociatyBFormationRecoReq) Reset() { - *x = SociatyBFormationRecoReq{} +func (x *SociatyRecommendReq) Reset() { + *x = SociatyRecommendReq{} if protoimpl.UnsafeEnabled { mi := &file_sociaty_sociaty_msg_proto_msgTypes[61] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -3210,13 +3210,13 @@ func (x *SociatyBFormationRecoReq) Reset() { } } -func (x *SociatyBFormationRecoReq) String() string { +func (x *SociatyRecommendReq) String() string { return protoimpl.X.MessageStringOf(x) } -func (*SociatyBFormationRecoReq) ProtoMessage() {} +func (*SociatyRecommendReq) ProtoMessage() {} -func (x *SociatyBFormationRecoReq) ProtoReflect() protoreflect.Message { +func (x *SociatyRecommendReq) ProtoReflect() protoreflect.Message { mi := &file_sociaty_sociaty_msg_proto_msgTypes[61] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -3228,19 +3228,19 @@ func (x *SociatyBFormationRecoReq) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use SociatyBFormationRecoReq.ProtoReflect.Descriptor instead. -func (*SociatyBFormationRecoReq) Descriptor() ([]byte, []int) { +// Deprecated: Use SociatyRecommendReq.ProtoReflect.Descriptor instead. +func (*SociatyRecommendReq) Descriptor() ([]byte, []int) { return file_sociaty_sociaty_msg_proto_rawDescGZIP(), []int{61} } -func (x *SociatyBFormationRecoReq) GetCate() int32 { +func (x *SociatyRecommendReq) GetCate() int32 { if x != nil { return x.Cate } return 0 } -type SociatyBFormationRecoResp struct { +type SociatyRecommendResp struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields @@ -3248,8 +3248,8 @@ type SociatyBFormationRecoResp struct { Teams map[int32]*ChallengeTeam `protobuf:"bytes,1,rep,name=teams,proto3" json:"teams" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` } -func (x *SociatyBFormationRecoResp) Reset() { - *x = SociatyBFormationRecoResp{} +func (x *SociatyRecommendResp) Reset() { + *x = SociatyRecommendResp{} if protoimpl.UnsafeEnabled { mi := &file_sociaty_sociaty_msg_proto_msgTypes[62] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -3257,13 +3257,13 @@ func (x *SociatyBFormationRecoResp) Reset() { } } -func (x *SociatyBFormationRecoResp) String() string { +func (x *SociatyRecommendResp) String() string { return protoimpl.X.MessageStringOf(x) } -func (*SociatyBFormationRecoResp) ProtoMessage() {} +func (*SociatyRecommendResp) ProtoMessage() {} -func (x *SociatyBFormationRecoResp) ProtoReflect() protoreflect.Message { +func (x *SociatyRecommendResp) ProtoReflect() protoreflect.Message { mi := &file_sociaty_sociaty_msg_proto_msgTypes[62] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -3275,12 +3275,12 @@ func (x *SociatyBFormationRecoResp) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use SociatyBFormationRecoResp.ProtoReflect.Descriptor instead. -func (*SociatyBFormationRecoResp) Descriptor() ([]byte, []int) { +// Deprecated: Use SociatyRecommendResp.ProtoReflect.Descriptor instead. +func (*SociatyRecommendResp) Descriptor() ([]byte, []int) { return file_sociaty_sociaty_msg_proto_rawDescGZIP(), []int{62} } -func (x *SociatyBFormationRecoResp) GetTeams() map[int32]*ChallengeTeam { +func (x *SociatyRecommendResp) GetTeams() map[int32]*ChallengeTeam { if x != nil { return x.Teams } @@ -3937,57 +3937,56 @@ var file_sociaty_sociaty_msg_proto_rawDesc = []byte{ 0x74, 0x22, 0x39, 0x0a, 0x1b, 0x53, 0x6f, 0x63, 0x69, 0x61, 0x74, 0x79, 0x42, 0x43, 0x68, 0x61, 0x6c, 0x6c, 0x65, 0x6e, 0x67, 0x65, 0x46, 0x69, 0x6e, 0x69, 0x73, 0x68, 0x52, 0x65, 0x73, 0x70, 0x12, 0x1a, 0x0a, 0x08, 0x69, 0x6e, 0x74, 0x65, 0x67, 0x72, 0x61, 0x6c, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x03, 0x52, 0x08, 0x69, 0x6e, 0x74, 0x65, 0x67, 0x72, 0x61, 0x6c, 0x22, 0x2e, 0x0a, 0x18, - 0x53, 0x6f, 0x63, 0x69, 0x61, 0x74, 0x79, 0x42, 0x46, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x69, 0x6f, - 0x6e, 0x52, 0x65, 0x63, 0x6f, 0x52, 0x65, 0x71, 0x12, 0x12, 0x0a, 0x04, 0x63, 0x61, 0x74, 0x65, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x04, 0x63, 0x61, 0x74, 0x65, 0x22, 0xa2, 0x01, 0x0a, - 0x19, 0x53, 0x6f, 0x63, 0x69, 0x61, 0x74, 0x79, 0x42, 0x46, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x69, - 0x6f, 0x6e, 0x52, 0x65, 0x63, 0x6f, 0x52, 0x65, 0x73, 0x70, 0x12, 0x3b, 0x0a, 0x05, 0x74, 0x65, - 0x61, 0x6d, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x25, 0x2e, 0x53, 0x6f, 0x63, 0x69, - 0x61, 0x74, 0x79, 0x42, 0x46, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x63, - 0x6f, 0x52, 0x65, 0x73, 0x70, 0x2e, 0x54, 0x65, 0x61, 0x6d, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, - 0x52, 0x05, 0x74, 0x65, 0x61, 0x6d, 0x73, 0x1a, 0x48, 0x0a, 0x0a, 0x54, 0x65, 0x61, 0x6d, 0x73, - 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x05, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x24, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, - 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x43, 0x68, 0x61, 0x6c, 0x6c, 0x65, 0x6e, - 0x67, 0x65, 0x54, 0x65, 0x61, 0x6d, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, - 0x01, 0x22, 0x2c, 0x0a, 0x12, 0x53, 0x6f, 0x63, 0x69, 0x61, 0x74, 0x79, 0x42, 0x52, 0x65, 0x63, - 0x65, 0x69, 0x76, 0x65, 0x52, 0x65, 0x71, 0x12, 0x16, 0x0a, 0x06, 0x74, 0x61, 0x73, 0x6b, 0x49, - 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x74, 0x61, 0x73, 0x6b, 0x49, 0x64, 0x22, - 0x4b, 0x0a, 0x13, 0x53, 0x6f, 0x63, 0x69, 0x61, 0x74, 0x79, 0x42, 0x52, 0x65, 0x63, 0x65, 0x69, - 0x76, 0x65, 0x52, 0x65, 0x73, 0x70, 0x12, 0x1c, 0x0a, 0x09, 0x73, 0x6f, 0x63, 0x69, 0x61, 0x74, - 0x79, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x73, 0x6f, 0x63, 0x69, 0x61, - 0x74, 0x79, 0x49, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x74, 0x61, 0x73, 0x6b, 0x49, 0x64, 0x18, 0x02, - 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x74, 0x61, 0x73, 0x6b, 0x49, 0x64, 0x22, 0x2d, 0x0a, 0x0f, - 0x53, 0x6f, 0x63, 0x69, 0x61, 0x74, 0x79, 0x42, 0x52, 0x61, 0x6e, 0x6b, 0x52, 0x65, 0x71, 0x12, - 0x1a, 0x0a, 0x08, 0x72, 0x61, 0x6e, 0x6b, 0x54, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x05, 0x52, 0x08, 0x72, 0x61, 0x6e, 0x6b, 0x54, 0x79, 0x70, 0x65, 0x22, 0xa1, 0x01, 0x0a, 0x0f, - 0x53, 0x6f, 0x63, 0x69, 0x61, 0x74, 0x79, 0x52, 0x61, 0x6e, 0x6b, 0x49, 0x6e, 0x66, 0x6f, 0x12, - 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, - 0x61, 0x6d, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x68, 0x65, 0x61, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x04, 0x68, 0x65, 0x61, 0x64, 0x12, 0x0e, 0x0a, 0x02, 0x6c, 0x76, 0x18, 0x03, 0x20, - 0x01, 0x28, 0x05, 0x52, 0x02, 0x6c, 0x76, 0x12, 0x20, 0x0a, 0x0b, 0x73, 0x6f, 0x63, 0x69, 0x61, - 0x74, 0x79, 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x73, 0x6f, - 0x63, 0x69, 0x61, 0x74, 0x79, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x72, 0x61, 0x6e, - 0x6b, 0x69, 0x6e, 0x67, 0x18, 0x05, 0x20, 0x01, 0x28, 0x03, 0x52, 0x07, 0x72, 0x61, 0x6e, 0x6b, - 0x69, 0x6e, 0x67, 0x12, 0x1a, 0x0a, 0x08, 0x69, 0x6e, 0x74, 0x65, 0x67, 0x72, 0x61, 0x6c, 0x18, - 0x06, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x69, 0x6e, 0x74, 0x65, 0x67, 0x72, 0x61, 0x6c, 0x22, - 0x38, 0x0a, 0x10, 0x53, 0x6f, 0x63, 0x69, 0x61, 0x74, 0x79, 0x42, 0x52, 0x61, 0x6e, 0x6b, 0x52, - 0x65, 0x73, 0x70, 0x12, 0x24, 0x0a, 0x04, 0x72, 0x61, 0x6e, 0x6b, 0x18, 0x01, 0x20, 0x03, 0x28, - 0x0b, 0x32, 0x10, 0x2e, 0x53, 0x6f, 0x63, 0x69, 0x61, 0x74, 0x79, 0x52, 0x61, 0x6e, 0x6b, 0x49, - 0x6e, 0x66, 0x6f, 0x52, 0x04, 0x72, 0x61, 0x6e, 0x6b, 0x22, 0x46, 0x0a, 0x0d, 0x53, 0x6f, 0x63, - 0x69, 0x61, 0x74, 0x79, 0x42, 0x75, 0x79, 0x52, 0x65, 0x71, 0x12, 0x1d, 0x0a, 0x03, 0x61, 0x74, - 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0b, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x41, 0x73, - 0x73, 0x65, 0x74, 0x73, 0x52, 0x03, 0x61, 0x74, 0x6e, 0x12, 0x16, 0x0a, 0x06, 0x62, 0x75, 0x79, - 0x4e, 0x75, 0x6d, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x62, 0x75, 0x79, 0x4e, 0x75, - 0x6d, 0x22, 0x22, 0x0a, 0x0e, 0x53, 0x6f, 0x63, 0x69, 0x61, 0x74, 0x79, 0x42, 0x75, 0x79, 0x52, - 0x65, 0x73, 0x70, 0x12, 0x10, 0x0a, 0x03, 0x75, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x03, 0x75, 0x69, 0x64, 0x2a, 0x42, 0x0a, 0x11, 0x53, 0x6f, 0x63, 0x69, 0x61, 0x74, 0x79, - 0x4c, 0x69, 0x73, 0x74, 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x12, 0x07, 0x0a, 0x03, 0x41, 0x4c, - 0x4c, 0x10, 0x00, 0x12, 0x09, 0x0a, 0x05, 0x43, 0x4f, 0x4e, 0x44, 0x49, 0x10, 0x01, 0x12, 0x0b, - 0x0a, 0x07, 0x4e, 0x4f, 0x41, 0x50, 0x50, 0x4c, 0x59, 0x10, 0x02, 0x12, 0x0c, 0x0a, 0x08, 0x41, - 0x50, 0x50, 0x4c, 0x59, 0x49, 0x4e, 0x47, 0x10, 0x03, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, - 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x28, 0x03, 0x52, 0x08, 0x69, 0x6e, 0x74, 0x65, 0x67, 0x72, 0x61, 0x6c, 0x22, 0x29, 0x0a, 0x13, + 0x53, 0x6f, 0x63, 0x69, 0x61, 0x74, 0x79, 0x52, 0x65, 0x63, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x64, + 0x52, 0x65, 0x71, 0x12, 0x12, 0x0a, 0x04, 0x63, 0x61, 0x74, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x05, 0x52, 0x04, 0x63, 0x61, 0x74, 0x65, 0x22, 0x98, 0x01, 0x0a, 0x14, 0x53, 0x6f, 0x63, 0x69, + 0x61, 0x74, 0x79, 0x52, 0x65, 0x63, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x64, 0x52, 0x65, 0x73, 0x70, + 0x12, 0x36, 0x0a, 0x05, 0x74, 0x65, 0x61, 0x6d, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, + 0x20, 0x2e, 0x53, 0x6f, 0x63, 0x69, 0x61, 0x74, 0x79, 0x52, 0x65, 0x63, 0x6f, 0x6d, 0x6d, 0x65, + 0x6e, 0x64, 0x52, 0x65, 0x73, 0x70, 0x2e, 0x54, 0x65, 0x61, 0x6d, 0x73, 0x45, 0x6e, 0x74, 0x72, + 0x79, 0x52, 0x05, 0x74, 0x65, 0x61, 0x6d, 0x73, 0x1a, 0x48, 0x0a, 0x0a, 0x54, 0x65, 0x61, 0x6d, + 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x05, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x24, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, + 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x43, 0x68, 0x61, 0x6c, 0x6c, 0x65, + 0x6e, 0x67, 0x65, 0x54, 0x65, 0x61, 0x6d, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, + 0x38, 0x01, 0x22, 0x2c, 0x0a, 0x12, 0x53, 0x6f, 0x63, 0x69, 0x61, 0x74, 0x79, 0x42, 0x52, 0x65, + 0x63, 0x65, 0x69, 0x76, 0x65, 0x52, 0x65, 0x71, 0x12, 0x16, 0x0a, 0x06, 0x74, 0x61, 0x73, 0x6b, + 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x74, 0x61, 0x73, 0x6b, 0x49, 0x64, + 0x22, 0x4b, 0x0a, 0x13, 0x53, 0x6f, 0x63, 0x69, 0x61, 0x74, 0x79, 0x42, 0x52, 0x65, 0x63, 0x65, + 0x69, 0x76, 0x65, 0x52, 0x65, 0x73, 0x70, 0x12, 0x1c, 0x0a, 0x09, 0x73, 0x6f, 0x63, 0x69, 0x61, + 0x74, 0x79, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x73, 0x6f, 0x63, 0x69, + 0x61, 0x74, 0x79, 0x49, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x74, 0x61, 0x73, 0x6b, 0x49, 0x64, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x74, 0x61, 0x73, 0x6b, 0x49, 0x64, 0x22, 0x2d, 0x0a, + 0x0f, 0x53, 0x6f, 0x63, 0x69, 0x61, 0x74, 0x79, 0x42, 0x52, 0x61, 0x6e, 0x6b, 0x52, 0x65, 0x71, + 0x12, 0x1a, 0x0a, 0x08, 0x72, 0x61, 0x6e, 0x6b, 0x54, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x05, 0x52, 0x08, 0x72, 0x61, 0x6e, 0x6b, 0x54, 0x79, 0x70, 0x65, 0x22, 0xa1, 0x01, 0x0a, + 0x0f, 0x53, 0x6f, 0x63, 0x69, 0x61, 0x74, 0x79, 0x52, 0x61, 0x6e, 0x6b, 0x49, 0x6e, 0x66, 0x6f, + 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, + 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x68, 0x65, 0x61, 0x64, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x04, 0x68, 0x65, 0x61, 0x64, 0x12, 0x0e, 0x0a, 0x02, 0x6c, 0x76, 0x18, 0x03, + 0x20, 0x01, 0x28, 0x05, 0x52, 0x02, 0x6c, 0x76, 0x12, 0x20, 0x0a, 0x0b, 0x73, 0x6f, 0x63, 0x69, + 0x61, 0x74, 0x79, 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x73, + 0x6f, 0x63, 0x69, 0x61, 0x74, 0x79, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x72, 0x61, + 0x6e, 0x6b, 0x69, 0x6e, 0x67, 0x18, 0x05, 0x20, 0x01, 0x28, 0x03, 0x52, 0x07, 0x72, 0x61, 0x6e, + 0x6b, 0x69, 0x6e, 0x67, 0x12, 0x1a, 0x0a, 0x08, 0x69, 0x6e, 0x74, 0x65, 0x67, 0x72, 0x61, 0x6c, + 0x18, 0x06, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x69, 0x6e, 0x74, 0x65, 0x67, 0x72, 0x61, 0x6c, + 0x22, 0x38, 0x0a, 0x10, 0x53, 0x6f, 0x63, 0x69, 0x61, 0x74, 0x79, 0x42, 0x52, 0x61, 0x6e, 0x6b, + 0x52, 0x65, 0x73, 0x70, 0x12, 0x24, 0x0a, 0x04, 0x72, 0x61, 0x6e, 0x6b, 0x18, 0x01, 0x20, 0x03, + 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x53, 0x6f, 0x63, 0x69, 0x61, 0x74, 0x79, 0x52, 0x61, 0x6e, 0x6b, + 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x04, 0x72, 0x61, 0x6e, 0x6b, 0x22, 0x46, 0x0a, 0x0d, 0x53, 0x6f, + 0x63, 0x69, 0x61, 0x74, 0x79, 0x42, 0x75, 0x79, 0x52, 0x65, 0x71, 0x12, 0x1d, 0x0a, 0x03, 0x61, + 0x74, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0b, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x41, + 0x73, 0x73, 0x65, 0x74, 0x73, 0x52, 0x03, 0x61, 0x74, 0x6e, 0x12, 0x16, 0x0a, 0x06, 0x62, 0x75, + 0x79, 0x4e, 0x75, 0x6d, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x62, 0x75, 0x79, 0x4e, + 0x75, 0x6d, 0x22, 0x22, 0x0a, 0x0e, 0x53, 0x6f, 0x63, 0x69, 0x61, 0x74, 0x79, 0x42, 0x75, 0x79, + 0x52, 0x65, 0x73, 0x70, 0x12, 0x10, 0x0a, 0x03, 0x75, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x03, 0x75, 0x69, 0x64, 0x2a, 0x42, 0x0a, 0x11, 0x53, 0x6f, 0x63, 0x69, 0x61, 0x74, + 0x79, 0x4c, 0x69, 0x73, 0x74, 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x12, 0x07, 0x0a, 0x03, 0x41, + 0x4c, 0x4c, 0x10, 0x00, 0x12, 0x09, 0x0a, 0x05, 0x43, 0x4f, 0x4e, 0x44, 0x49, 0x10, 0x01, 0x12, + 0x0b, 0x0a, 0x07, 0x4e, 0x4f, 0x41, 0x50, 0x50, 0x4c, 0x59, 0x10, 0x02, 0x12, 0x0c, 0x0a, 0x08, + 0x41, 0x50, 0x50, 0x4c, 0x59, 0x49, 0x4e, 0x47, 0x10, 0x03, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, + 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -4067,8 +4066,8 @@ var file_sociaty_sociaty_msg_proto_goTypes = []interface{}{ (*SociatyBChallengeStartResp)(nil), // 59: SociatyBChallengeStartResp (*SociatyBChallengeFinishReq)(nil), // 60: SociatyBChallengeFinishReq (*SociatyBChallengeFinishResp)(nil), // 61: SociatyBChallengeFinishResp - (*SociatyBFormationRecoReq)(nil), // 62: SociatyBFormationRecoReq - (*SociatyBFormationRecoResp)(nil), // 63: SociatyBFormationRecoResp + (*SociatyRecommendReq)(nil), // 62: SociatyRecommendReq + (*SociatyRecommendResp)(nil), // 63: SociatyRecommendResp (*SociatyBReceiveReq)(nil), // 64: SociatyBReceiveReq (*SociatyBReceiveResp)(nil), // 65: SociatyBReceiveResp (*SociatyBRankReq)(nil), // 66: SociatyBRankReq @@ -4078,7 +4077,7 @@ var file_sociaty_sociaty_msg_proto_goTypes = []interface{}{ (*SociatyBuyResp)(nil), // 70: SociatyBuyResp nil, // 71: SociatyBMainResp.TeamsEntry nil, // 72: SociatyBFormationReq.TeamsEntry - nil, // 73: SociatyBFormationRecoResp.TeamsEntry + nil, // 73: SociatyRecommendResp.TeamsEntry (*DBSociaty)(nil), // 74: DBSociaty (SociatyJob)(0), // 75: SociatyJob (*DBSociatyLog)(nil), // 76: DBSociatyLog @@ -4109,12 +4108,12 @@ var file_sociaty_sociaty_msg_proto_depIdxs = []int32{ 72, // 15: SociatyBFormationReq.teams:type_name -> SociatyBFormationReq.TeamsEntry 80, // 16: SociatyBChallengeFinishReq.ptype:type_name -> PlayType 81, // 17: SociatyBChallengeFinishReq.report:type_name -> BattleReport - 73, // 18: SociatyBFormationRecoResp.teams:type_name -> SociatyBFormationRecoResp.TeamsEntry + 73, // 18: SociatyRecommendResp.teams:type_name -> SociatyRecommendResp.TeamsEntry 67, // 19: SociatyBRankResp.rank:type_name -> SociatyRankInfo 82, // 20: SociatyBuyReq.atn:type_name -> UserAssets 83, // 21: SociatyBMainResp.TeamsEntry.value:type_name -> ChallengeTeam 83, // 22: SociatyBFormationReq.TeamsEntry.value:type_name -> ChallengeTeam - 83, // 23: SociatyBFormationRecoResp.TeamsEntry.value:type_name -> ChallengeTeam + 83, // 23: SociatyRecommendResp.TeamsEntry.value:type_name -> ChallengeTeam 24, // [24:24] is the sub-list for method output_type 24, // [24:24] is the sub-list for method input_type 24, // [24:24] is the sub-list for extension type_name @@ -4865,7 +4864,7 @@ func file_sociaty_sociaty_msg_proto_init() { } } file_sociaty_sociaty_msg_proto_msgTypes[61].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*SociatyBFormationRecoReq); i { + switch v := v.(*SociatyRecommendReq); i { case 0: return &v.state case 1: @@ -4877,7 +4876,7 @@ func file_sociaty_sociaty_msg_proto_init() { } } file_sociaty_sociaty_msg_proto_msgTypes[62].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*SociatyBFormationRecoResp); i { + switch v := v.(*SociatyRecommendResp); i { case 0: return &v.state case 1: From b441c4b272fa55920bdf4d20e1adf5f215d88f4f Mon Sep 17 00:00:00 2001 From: wh_zcy Date: Mon, 16 Jan 2023 19:03:59 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bin/json/game_opencond.json | 18 +++++----- modules/sociaty/api_cross_bossmain.go | 9 ++--- modules/sociaty/model_sociatyboss.go | 51 +++++++++++++++------------ modules/user/module.go | 5 +++ sys/db/init_test.go | 21 +++++------ 5 files changed, 58 insertions(+), 46 deletions(-) diff --git a/bin/json/game_opencond.json b/bin/json/game_opencond.json index 0cc3152e8..cce4953ff 100644 --- a/bin/json/game_opencond.json +++ b/bin/json/game_opencond.json @@ -1578,7 +1578,7 @@ "main": [ { "key": "worldtaskid", - "param": 20010 + "param": 20050 } ], "optional": "", @@ -1586,8 +1586,8 @@ "kqbx": 0, "img": "", "prompt": { - "key": "", - "text": "" + "key": "opencond_prompt_slidescreen_up", + "text": "请先完成主线剧情" }, "uiid": 0 }, @@ -1600,7 +1600,7 @@ "main": [ { "key": "worldtaskid", - "param": 20010 + "param": 20050 } ], "optional": "", @@ -1608,8 +1608,8 @@ "kqbx": 0, "img": "", "prompt": { - "key": "", - "text": "" + "key": "opencond_prompt_slidescreen_left", + "text": "请先完成主线剧情" }, "uiid": 0 }, @@ -1622,7 +1622,7 @@ "main": [ { "key": "worldtaskid", - "param": 20010 + "param": 20050 } ], "optional": "", @@ -1630,8 +1630,8 @@ "kqbx": 0, "img": "", "prompt": { - "key": "", - "text": "" + "key": "opencond_prompt_slidescreen_right", + "text": "请先完成主线剧情" }, "uiid": 0 } diff --git a/modules/sociaty/api_cross_bossmain.go b/modules/sociaty/api_cross_bossmain.go index 0c37a76c6..f3c1905de 100644 --- a/modules/sociaty/api_cross_bossmain.go +++ b/modules/sociaty/api_cross_bossmain.go @@ -38,7 +38,7 @@ func (this *apiComp) Bossmain(session comm.IUserSession, req *pb.SociatyBMainReq } // 未参赛(恢复挑战券) - if !this.module.modelSociatyBoss.IsSports(uid) { + if !this.module.modelSociatyBoss.IsInSports(uid) { userEx.SociatyTicket = ggd.GuildBossInitialNum update := map[string]interface{}{ "sociatyTicket": userEx.SociatyTicket, @@ -47,6 +47,7 @@ func (this *apiComp) Bossmain(session comm.IUserSession, req *pb.SociatyBMainReq code = pb.ErrorCode_DBError return } + rsp.Ticket = userEx.SociatyTicket } sociaty := this.module.modelSociaty.getUserSociaty(uid) @@ -73,12 +74,12 @@ func (this *apiComp) Bossmain(session comm.IUserSession, req *pb.SociatyBMainReq } //个人排名 - rsp.PersonalRanking = this.module.modelSociatyBoss.getRankingByUid( + rsp.PersonalRanking = this.module.modelSociatyBoss.getRankingByMember( fmt.Sprintf("%s:%s", this.module.modelSociatyBoss.TableName, BOSS_PERSONAL_RANK), uid) // 公会排名 - rsp.SociatyRanking = this.module.modelSociatyBoss.getRankingByUid( - fmt.Sprintf("%s:%s", this.module.modelSociatyBoss.TableName, BOSS_SOCIATY_RANK), uid) + rsp.SociatyRanking = this.module.modelSociatyBoss.getRankingByMember( + fmt.Sprintf("%s:%s", this.module.modelSociatyBoss.TableName, BOSS_SOCIATY_RANK), sociaty.Id) if sm := this.module.modelSociaty.getMemberInfo(sociaty, uid); sm != nil { rsp.Teams = sm.Teams diff --git a/modules/sociaty/model_sociatyboss.go b/modules/sociaty/model_sociatyboss.go index 473863c47..c86bbce6c 100644 --- a/modules/sociaty/model_sociatyboss.go +++ b/modules/sociaty/model_sociatyboss.go @@ -73,7 +73,7 @@ func (s *ModelSociatyBoss) initSports() error { if now.Unix() >= sports.EndTime { sports.EndTime, sports.SettlementTime = s.sportsTime() //归档前赛季数据 - s.reset() + s.resetSportsData() // 更新下一赛季周期结束时间 update := map[string]interface{}{ "endTime": sports.EndTime, @@ -110,7 +110,7 @@ func (s *ModelSociatyBoss) updateSociatyBossSports(data map[string]interface{}) } } -// 赛季时间 +// 赛季结算和结束时间 func (s *ModelSociatyBoss) sportsTime() (t1, t2 int64) { now := configure.Now() end1 := now.Add(time.Duration(SPORTS_HOUR) * time.Hour) //测试时单位分钟 else Hour @@ -119,7 +119,7 @@ func (s *ModelSociatyBoss) sportsTime() (t1, t2 int64) { return end1.Unix(), end2.Unix() } -// 公会BOSS是否开始 +// 公会BOSS赛季是否开始 func (s *ModelSociatyBoss) sportsIsStarted() bool { sports := s.getSociatyBossSports() if sports == nil { @@ -137,7 +137,7 @@ func (s *ModelSociatyBoss) sportsIsStarted() bool { return false } -// 公会BOSS是否结束 +// 公会BOSS赛季是否结束 func (s *ModelSociatyBoss) sportsIsFinished() bool { sports := s.getSociatyBossSports() if sports == nil { @@ -366,7 +366,7 @@ func (s *ModelSociatyBoss) getScoreByUid(key, member string) int64 { } // 取排名 -func (s *ModelSociatyBoss) getRankingByUid(key, member string) int64 { +func (s *ModelSociatyBoss) getRankingByMember(key, member string) int64 { result, err := s.DBModel.Redis.ZRevRank(key, member) if err != nil { return 0 @@ -381,8 +381,8 @@ func (s *ModelSociatyBoss) bossRank(sociaty *pb.DBSociaty, rankType int32) (res key string ) + // 所有排行记录(个人、公会) rank := func() []*pb.SociatyRankInfo { - // 所有排行记录 rankUids, err := s.queryRankUid(rankCount) if err != nil { return nil @@ -399,7 +399,7 @@ func (s *ModelSociatyBoss) bossRank(sociaty *pb.DBSociaty, rankType int32) (res Name: user.Name, Head: user.Avatar, Lv: user.Lv, - Ranking: s.getRankingByUid(key, user.Uid), + Ranking: s.getRankingByMember(key, user.Uid), Integral: s.getScoreByUid(key, user.Uid), }) } @@ -409,14 +409,14 @@ func (s *ModelSociatyBoss) bossRank(sociaty *pb.DBSociaty, rankType int32) (res } switch rankType { case 1: //个人 - rankCount = 1000 + rankCount = 1000 //数据数量 key = fmt.Sprintf("%s:%s", s.TableName, BOSS_PERSONAL_RANK) rank() case 2: //公会 - rankCount = 50 + rankCount = 50 //数据数量 key = fmt.Sprintf("%s:%s", s.TableName, BOSS_SOCIATY_RANK) rank() - case 3: //公会成员 + case 3: //公会成员排行 for _, m := range sociaty.Members { imodule, err := s.service.GetModule(comm.ModuleUser) if err != nil { @@ -429,7 +429,7 @@ func (s *ModelSociatyBoss) bossRank(sociaty *pb.DBSociaty, rankType int32) (res Name: user.Name, Head: user.Avatar, Lv: user.Lv, - Ranking: s.getRankingByUid(key, user.Uid), + Ranking: s.getRankingByMember(key, user.Uid), Integral: s.getScoreByUid(key, user.Uid), }) } @@ -443,8 +443,8 @@ func (s *ModelSociatyBoss) bossRank(sociaty *pb.DBSociaty, rankType int32) (res return nil } -// 公会BOSS重置数据 -func (s *ModelSociatyBoss) reset() error { +// 公会BOSS重置数据(每个周期) +func (s *ModelSociatyBoss) resetSportsData() error { sports := s.getSociatyBossSports() if sports == nil { return errors.New("sociatyboss sports is nil") @@ -455,24 +455,24 @@ func (s *ModelSociatyBoss) reset() error { var record []*pb.DBSociatyBossRecord _ = s.GetList(uid, &record) for _, v := range record { - update := map[string]interface{}{ - "status": 1, //归档 - "tasks": []*pb.ChallengeTask{}, - } - if err := s.Change(BOSS_SPORTS, update); err != nil { - s.moduleSociaty.Error("归档玩家赛事记录", log.Field{Key: "uid", Value: v.Uid}, log.Field{Key: "err", Value: err.Error()}) + // update := map[string]interface{}{ + // "status": 1, //归档 + // "tasks": []*pb.ChallengeTask{}, + // } + if err := s.DelByUId(uid); err != nil { + s.moduleSociaty.Error("清理玩家赛季记录", log.Field{Key: "uid", Value: v.Uid}, log.Field{Key: "err", Value: err.Error()}) } } } // 清理排行榜 - if err := s.Del(BOSS_PERSONAL_RANK); err != nil { - s.moduleSociaty.Error("清理排行榜", log.Field{Key: "err", Value: err.Error()}) - } + // if err := s.Del(BOSS_PERSONAL_RANK); err != nil { + // s.moduleSociaty.Error("清理排行榜", log.Field{Key: "err", Value: err.Error()}) + // } return nil } // 是否参赛 -func (s *ModelSociatyBoss) IsSports(uid string) bool { +func (s *ModelSociatyBoss) IsInSports(uid string) bool { sports := s.getSociatyBossSports() if sports == nil { return false @@ -542,6 +542,7 @@ func (s *ModelSociatyBoss) settlement() error { // 任务状态有变化时更新 if taskFlag { update["tasks"] = tasks + cr.Tasks = tasks } if err := s.Change(uid, update); err != nil { s.moduleSociaty.Error("更新玩家赛事信息", log.Field{Key: "uid", Value: uid}, log.Field{Key: "err", Value: err.Error()}) @@ -554,6 +555,10 @@ func (s *ModelSociatyBoss) settlement() error { s.addSociatyRank(uid, total) s.moduleSociaty.Debug("结算:", log.Field{Key: "uid", Value: uid}) + //归档赛季记录 + if err := s.AddList(comm.RDS_EMPTY, uid, cr); err != nil { + s.moduleSociaty.Error("归档玩家赛季数据", log.Field{Key: "err", Value: err.Error()}) + } } return nil diff --git a/modules/user/module.go b/modules/user/module.go index 1522ebc1d..509bb2457 100644 --- a/modules/user/module.go +++ b/modules/user/module.go @@ -169,6 +169,11 @@ func (this *User) UserOnlineList() ([]*pb.CacheUser, error) { if err := this.modelSession.GetList(comm.RDS_EMPTY, &cache); err != nil { return nil, err } + } else { + var err error + if cache, err = this.CrossUserOnlineList(); err != nil { + return nil, err + } } return cache, nil } diff --git a/sys/db/init_test.go b/sys/db/init_test.go index 154a946e9..a5947e76f 100644 --- a/sys/db/init_test.go +++ b/sys/db/init_test.go @@ -12,8 +12,6 @@ import ( "sync" "testing" - "github.com/go-redis/redis/v8" - "go.mongodb.org/mongo-driver/bson" "go.mongodb.org/mongo-driver/bson/primitive" "go.mongodb.org/mongo-driver/mongo" @@ -138,21 +136,24 @@ func TestRa(t *testing.T) { fmt.Printf("err:%v", err) return } else { - s, err2 := sys.ZRevRange("sociatyrank", 0, 10).Result() + s, err2 := sys.ZRevRange("sociatyboss:personalrank", 0, 10).Result() if err2 != nil { t.Fatal(err2) } - m := &redis.Z{Score: float64(1), Member: "dd"} - sys.ZAdd("sociatyrank", m) + // m := &redis.Z{Score: float64(1), Member: "dd"} + // sys.ZAdd("sociatyrank", m) - sys.ZIncrBy("sociatyrank", 10, "a100aa") - sys.ZIncrBy("sociatyrank", 10, "a100ab") + // sys.ZIncrBy("sociatyrank", 10, "a100aa") + // sys.ZIncrBy("sociatyrank", 10, "a100ab") for _, v := range s { - fmt.Println(v) - score, _ := sys.ZScore("sociatyrank", v) - ranking, _ := sys.ZRevRank("sociatyrank", v) + // fmt.Println(v) + score, _ := sys.ZScore("sociatyboss:personalrank", v) + ranking, _ := sys.ZRevRank("sociatyboss:personalrank", v) fmt.Printf("%d %v - %d \n", (ranking + 1), v, int64(score)) + + result, _ := sys.ZRevRank("sociatyboss:personalrank", v) + fmt.Println(result) } } From a6cd1233f638c9a5b2570b04352f655f4b371547 Mon Sep 17 00:00:00 2001 From: wh_zcy Date: Tue, 17 Jan 2023 11:28:43 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E5=A5=BD=E5=8F=8B?= =?UTF-8?q?=E6=8E=A8=E8=8D=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- modules/sociaty/model_sociatyboss.go | 11 +++-------- modules/user/module.go | 19 +++++++++++++++---- 2 files changed, 18 insertions(+), 12 deletions(-) diff --git a/modules/sociaty/model_sociatyboss.go b/modules/sociaty/model_sociatyboss.go index c86bbce6c..32dc213d0 100644 --- a/modules/sociaty/model_sociatyboss.go +++ b/modules/sociaty/model_sociatyboss.go @@ -455,10 +455,6 @@ func (s *ModelSociatyBoss) resetSportsData() error { var record []*pb.DBSociatyBossRecord _ = s.GetList(uid, &record) for _, v := range record { - // update := map[string]interface{}{ - // "status": 1, //归档 - // "tasks": []*pb.ChallengeTask{}, - // } if err := s.DelByUId(uid); err != nil { s.moduleSociaty.Error("清理玩家赛季记录", log.Field{Key: "uid", Value: v.Uid}, log.Field{Key: "err", Value: err.Error()}) } @@ -555,11 +551,10 @@ func (s *ModelSociatyBoss) settlement() error { s.addSociatyRank(uid, total) s.moduleSociaty.Debug("结算:", log.Field{Key: "uid", Value: uid}) - //归档赛季记录 - if err := s.AddList(comm.RDS_EMPTY, uid, cr); err != nil { - s.moduleSociaty.Error("归档玩家赛季数据", log.Field{Key: "err", Value: err.Error()}) - } + } + //归档前10的玩家记录 + return nil } diff --git a/modules/user/module.go b/modules/user/module.go index 509bb2457..b51b4d983 100644 --- a/modules/user/module.go +++ b/modules/user/module.go @@ -180,13 +180,24 @@ func (this *User) UserOnlineList() ([]*pb.CacheUser, error) { // 跨服玩家列表 func (this *User) CrossUserOnlineList() ([]*pb.CacheUser, error) { - reply := &pb.UserOnlineResp{} - err := this.service.AcrossClusterRpcCall(context.Background(), this.GetCrossTag(), - comm.Service_Worker, Rpc_GetAllOnlineUser, nil, reply) + conn, err := db.Local() if err != nil { return nil, err } - return reply.Users, err + model := db.NewDBModel(comm.TableSession, 0, conn) + var cache []*pb.CacheUser + if err := model.GetList(comm.RDS_EMPTY, &cache); err != nil { + return nil, err + } + return cache, nil + + // reply := &pb.UserOnlineResp{} + // err := this.service.AcrossClusterRpcCall(context.Background(), this.GetCrossTag(), + // comm.Service_Worker, Rpc_GetAllOnlineUser, nil, reply) + // if err != nil { + // return nil, err + // } + // return reply.Users, err } // 跨服玩家会话