战局记录

This commit is contained in:
meixiongfeng 2023-12-22 10:58:32 +08:00
parent 2acd980cba
commit b558768c0e
5 changed files with 216 additions and 51 deletions

View File

@ -0,0 +1,32 @@
package entertainment
import (
"go_dreamfactory/comm"
"go_dreamfactory/pb"
)
// 参数校验
func (this *apiComp) RecordCheck(session comm.IUserSession, req *pb.EntertainRecordReq) (errdata *pb.ErrorData) {
return
}
// 记录获取
func (this *apiComp) Record(session comm.IUserSession, req *pb.EntertainRecordReq) (errdata *pb.ErrorData) {
var (
records []*pb.DBXxlRecord
err error
)
if errdata = this.RecordCheck(session, req); errdata != nil {
return
}
if records, err = this.module.modelRecode.getXxlRecord(session.GetUserId()); err != nil {
return
}
session.SendMsg(string(this.module.GetType()), "record", &pb.EntertainRecordResp{
Record: records,
})
return
}

View File

@ -64,6 +64,19 @@ func (this *modelComp) getEntertainmList(uid string) (result *pb.DBXXLData, err
for _, v := range this.module.configure.GetInitGameConsumeSkill() { for _, v := range this.module.configure.GetInitGameConsumeSkill() {
result.Skill[v] = 1 result.Skill[v] = 1
} }
if user, e := this.module.ModuleUser.GetUser(uid); e == nil {
// 查询一次 写基本信息
result.Uinfo = &pb.BaseUserInfo{
Uid: uid,
Sid: user.Sid,
Name: user.Name,
Gender: user.Gender,
Skin: user.CurSkin,
Aframe: user.Curaframe,
Title: user.Curtitle,
Lv: user.Lv,
}
}
err = this.Add(uid, result) err = this.Add(uid, result)
} }
return result, err return result, err

View File

@ -50,8 +50,9 @@ func (this *modelRecode) getXxlRecord(uid string) (results []*pb.DBXxlRecord, er
cursor *mongo.Cursor cursor *mongo.Cursor
) )
results = make([]*pb.DBXxlRecord, 0) results = make([]*pb.DBXxlRecord, 0)
if cursor, err = this.DBModel.DB.Find(comm.TableEntertainRecode, bson.M{"$or": []bson.M{{"p1": uid},
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 { {"p2": uid}}}, options.Find().SetSort(bson.M{"ctime": -1}),
options.Find().SetLimit(int64(comm.MaxRankList))); err != nil {
this.module.Errorln(err) this.module.Errorln(err)
return return
} else { } else {

View File

@ -623,7 +623,7 @@ func (this *Room) GameOver(winner *pb.PlayerData) (errdata *pb.ErrorData) {
P1: this.player1.Userinfo.Uid, P1: this.player1.Userinfo.Uid,
P2: this.player2.Userinfo.Uid, P2: this.player2.Userinfo.Uid,
Uinfo1: this.player1.Userinfo, Uinfo1: this.player1.Userinfo,
Uinfo2: this.player1.Userinfo, Uinfo2: this.player2.Userinfo,
P1Score: this.player1.Score, P1Score: this.player1.Score,
P2Score: this.player2.Score, P2Score: this.player2.Score,
Win: winner.Userinfo.Uid, Win: winner.Userinfo.Uid,

View File

@ -2544,6 +2544,92 @@ func (x *EntertainTaskRewardResp) GetAward() []*UserAtno {
return nil return nil
} }
// 战斗对局
type EntertainRecordReq struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
}
func (x *EntertainRecordReq) Reset() {
*x = EntertainRecordReq{}
if protoimpl.UnsafeEnabled {
mi := &file_entertain_entertain_msg_proto_msgTypes[46]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *EntertainRecordReq) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*EntertainRecordReq) ProtoMessage() {}
func (x *EntertainRecordReq) ProtoReflect() protoreflect.Message {
mi := &file_entertain_entertain_msg_proto_msgTypes[46]
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 EntertainRecordReq.ProtoReflect.Descriptor instead.
func (*EntertainRecordReq) Descriptor() ([]byte, []int) {
return file_entertain_entertain_msg_proto_rawDescGZIP(), []int{46}
}
type EntertainRecordResp struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Record []*DBXxlRecord `protobuf:"bytes,1,rep,name=record,proto3" json:"record"`
}
func (x *EntertainRecordResp) Reset() {
*x = EntertainRecordResp{}
if protoimpl.UnsafeEnabled {
mi := &file_entertain_entertain_msg_proto_msgTypes[47]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *EntertainRecordResp) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*EntertainRecordResp) ProtoMessage() {}
func (x *EntertainRecordResp) ProtoReflect() protoreflect.Message {
mi := &file_entertain_entertain_msg_proto_msgTypes[47]
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 EntertainRecordResp.ProtoReflect.Descriptor instead.
func (*EntertainRecordResp) Descriptor() ([]byte, []int) {
return file_entertain_entertain_msg_proto_rawDescGZIP(), []int{47}
}
func (x *EntertainRecordResp) GetRecord() []*DBXxlRecord {
if x != nil {
return x.Record
}
return nil
}
var File_entertain_entertain_msg_proto protoreflect.FileDescriptor var File_entertain_entertain_msg_proto protoreflect.FileDescriptor
var file_entertain_entertain_msg_proto_rawDesc = []byte{ var file_entertain_entertain_msg_proto_rawDesc = []byte{
@ -2786,8 +2872,13 @@ var file_entertain_entertain_msg_proto_rawDesc = []byte{
0x72, 0x6f, 0x67, 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0b, 0x74, 0x61, 0x72, 0x6f, 0x67, 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0b, 0x74, 0x61,
0x73, 0x6b, 0x70, 0x72, 0x6f, 0x67, 0x65, 0x73, 0x73, 0x12, 0x1f, 0x0a, 0x05, 0x61, 0x77, 0x61, 0x73, 0x6b, 0x70, 0x72, 0x6f, 0x67, 0x65, 0x73, 0x73, 0x12, 0x1f, 0x0a, 0x05, 0x61, 0x77, 0x61,
0x72, 0x64, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x09, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x41, 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, 0x74, 0x6e, 0x6f, 0x52, 0x05, 0x61, 0x77, 0x61, 0x72, 0x64, 0x22, 0x14, 0x0a, 0x12, 0x45, 0x6e,
0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, 0x74, 0x65, 0x72, 0x74, 0x61, 0x69, 0x6e, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x52, 0x65, 0x71,
0x22, 0x3b, 0x0a, 0x13, 0x45, 0x6e, 0x74, 0x65, 0x72, 0x74, 0x61, 0x69, 0x6e, 0x52, 0x65, 0x63,
0x6f, 0x72, 0x64, 0x52, 0x65, 0x73, 0x70, 0x12, 0x24, 0x0a, 0x06, 0x72, 0x65, 0x63, 0x6f, 0x72,
0x64, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0c, 0x2e, 0x44, 0x42, 0x58, 0x78, 0x6c, 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 ( var (
@ -2802,7 +2893,7 @@ func file_entertain_entertain_msg_proto_rawDescGZIP() []byte {
return file_entertain_entertain_msg_proto_rawDescData return file_entertain_entertain_msg_proto_rawDescData
} }
var file_entertain_entertain_msg_proto_msgTypes = make([]protoimpl.MessageInfo, 48) var file_entertain_entertain_msg_proto_msgTypes = make([]protoimpl.MessageInfo, 50)
var file_entertain_entertain_msg_proto_goTypes = []interface{}{ var file_entertain_entertain_msg_proto_goTypes = []interface{}{
(*EntertainMatchReq)(nil), // 0: EntertainMatchReq (*EntertainMatchReq)(nil), // 0: EntertainMatchReq
(*EntertainMatchResp)(nil), // 1: EntertainMatchResp (*EntertainMatchResp)(nil), // 1: EntertainMatchResp
@ -2850,52 +2941,56 @@ var file_entertain_entertain_msg_proto_goTypes = []interface{}{
(*EntertainRankResp)(nil), // 43: EntertainRankResp (*EntertainRankResp)(nil), // 43: EntertainRankResp
(*EntertainTaskRewardReq)(nil), // 44: EntertainTaskRewardReq (*EntertainTaskRewardReq)(nil), // 44: EntertainTaskRewardReq
(*EntertainTaskRewardResp)(nil), // 45: EntertainTaskRewardResp (*EntertainTaskRewardResp)(nil), // 45: EntertainTaskRewardResp
nil, // 46: EntertainChangePush.CardEntry (*EntertainRecordReq)(nil), // 46: EntertainRecordReq
nil, // 47: EntertainChangePush.SkillEntry (*EntertainRecordResp)(nil), // 47: EntertainRecordResp
(*PlayerData)(nil), // 48: PlayerData nil, // 48: EntertainChangePush.CardEntry
(*MapData)(nil), // 49: MapData nil, // 49: EntertainChangePush.SkillEntry
(*UserAtno)(nil), // 50: UserAtno (*PlayerData)(nil), // 50: PlayerData
(*BoxData)(nil), // 51: BoxData (*MapData)(nil), // 51: MapData
(*DBXXLData)(nil), // 52: DBXXLData (*UserAtno)(nil), // 52: UserAtno
(*XxlPlayer)(nil), // 53: XxlPlayer (*BoxData)(nil), // 53: BoxData
(*DBXXLData)(nil), // 54: DBXXLData
(*XxlPlayer)(nil), // 55: XxlPlayer
(*DBXxlRecord)(nil), // 56: DBXxlRecord
} }
var file_entertain_entertain_msg_proto_depIdxs = []int32{ var file_entertain_entertain_msg_proto_depIdxs = []int32{
48, // 0: EntertainStartGamePush.user1:type_name -> PlayerData 50, // 0: EntertainStartGamePush.user1:type_name -> PlayerData
48, // 1: EntertainStartGamePush.user2:type_name -> PlayerData 50, // 1: EntertainStartGamePush.user2:type_name -> PlayerData
49, // 2: EntertainStartGamePush.mpadata:type_name -> MapData 51, // 2: EntertainStartGamePush.mpadata:type_name -> MapData
49, // 3: EntertainOperatorRstPush.mpadata:type_name -> MapData 51, // 3: EntertainOperatorRstPush.mpadata:type_name -> MapData
48, // 4: EntertainOperatorRstPush.user1:type_name -> PlayerData 50, // 4: EntertainOperatorRstPush.user1:type_name -> PlayerData
48, // 5: EntertainOperatorRstPush.user2:type_name -> PlayerData 50, // 5: EntertainOperatorRstPush.user2:type_name -> PlayerData
48, // 6: EntertainGameOverPush.user1:type_name -> PlayerData 50, // 6: EntertainGameOverPush.user1:type_name -> PlayerData
48, // 7: EntertainGameOverPush.user2:type_name -> PlayerData 50, // 7: EntertainGameOverPush.user2:type_name -> PlayerData
49, // 8: EntertainGameOverPush.mpadata:type_name -> MapData 51, // 8: EntertainGameOverPush.mpadata:type_name -> MapData
50, // 9: EntertainGameOverPush.reward:type_name -> UserAtno 52, // 9: EntertainGameOverPush.reward:type_name -> UserAtno
51, // 10: EntertainGameOverPush.box:type_name -> BoxData 53, // 10: EntertainGameOverPush.box:type_name -> BoxData
48, // 11: EntertainEnterRoomPush.user1:type_name -> PlayerData 50, // 11: EntertainEnterRoomPush.user1:type_name -> PlayerData
48, // 12: EntertainEnterRoomPush.user2:type_name -> PlayerData 50, // 12: EntertainEnterRoomPush.user2:type_name -> PlayerData
49, // 13: EntertainReconnectResp.mpadata:type_name -> MapData 51, // 13: EntertainReconnectResp.mpadata:type_name -> MapData
48, // 14: EntertainReconnectResp.user1:type_name -> PlayerData 50, // 14: EntertainReconnectResp.user1:type_name -> PlayerData
48, // 15: EntertainReconnectResp.user2:type_name -> PlayerData 50, // 15: EntertainReconnectResp.user2:type_name -> PlayerData
49, // 16: EntertainRefreshPlatResp.mpadata:type_name -> MapData 51, // 16: EntertainRefreshPlatResp.mpadata:type_name -> MapData
49, // 17: EntertainRefreshPush.mpadata:type_name -> MapData 51, // 17: EntertainRefreshPush.mpadata:type_name -> MapData
52, // 18: EntertainGetListResp.data:type_name -> DBXXLData 54, // 18: EntertainGetListResp.data:type_name -> DBXXLData
52, // 19: EntertainRewardResp.data:type_name -> DBXXLData 54, // 19: EntertainRewardResp.data:type_name -> DBXXLData
50, // 20: EntertainRewardResp.reward:type_name -> UserAtno 52, // 20: EntertainRewardResp.reward:type_name -> UserAtno
46, // 21: EntertainChangePush.card:type_name -> EntertainChangePush.CardEntry 48, // 21: EntertainChangePush.card:type_name -> EntertainChangePush.CardEntry
47, // 22: EntertainChangePush.skill:type_name -> EntertainChangePush.SkillEntry 49, // 22: EntertainChangePush.skill:type_name -> EntertainChangePush.SkillEntry
48, // 23: EntertainJoinCreateRoomPush.user1:type_name -> PlayerData 50, // 23: EntertainJoinCreateRoomPush.user1:type_name -> PlayerData
48, // 24: EntertainJoinCreateRoomPush.user2:type_name -> PlayerData 50, // 24: EntertainJoinCreateRoomPush.user2:type_name -> PlayerData
51, // 25: EntertainBoxRewardResp.box:type_name -> BoxData 53, // 25: EntertainBoxRewardResp.box:type_name -> BoxData
50, // 26: EntertainBoxRewardResp.reward:type_name -> UserAtno 52, // 26: EntertainBoxRewardResp.reward:type_name -> UserAtno
52, // 27: EntertainReceiveResp.info:type_name -> DBXXLData 54, // 27: EntertainReceiveResp.info:type_name -> DBXXLData
50, // 28: EntertainReceiveResp.award:type_name -> UserAtno 52, // 28: EntertainReceiveResp.award:type_name -> UserAtno
53, // 29: EntertainRankResp.players:type_name -> XxlPlayer 55, // 29: EntertainRankResp.players:type_name -> XxlPlayer
50, // 30: EntertainTaskRewardResp.award:type_name -> UserAtno 52, // 30: EntertainTaskRewardResp.award:type_name -> UserAtno
31, // [31:31] is the sub-list for method output_type 56, // 31: EntertainRecordResp.record:type_name -> DBXxlRecord
31, // [31:31] is the sub-list for method input_type 32, // [32:32] is the sub-list for method output_type
31, // [31:31] is the sub-list for extension type_name 32, // [32:32] is the sub-list for method input_type
31, // [31:31] is the sub-list for extension extendee 32, // [32:32] is the sub-list for extension type_name
0, // [0:31] is the sub-list for field type_name 32, // [32:32] is the sub-list for extension extendee
0, // [0:32] is the sub-list for field type_name
} }
func init() { file_entertain_entertain_msg_proto_init() } func init() { file_entertain_entertain_msg_proto_init() }
@ -3458,6 +3553,30 @@ func file_entertain_entertain_msg_proto_init() {
return nil return nil
} }
} }
file_entertain_entertain_msg_proto_msgTypes[46].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*EntertainRecordReq); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_entertain_entertain_msg_proto_msgTypes[47].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*EntertainRecordResp); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
} }
type x struct{} type x struct{}
out := protoimpl.TypeBuilder{ out := protoimpl.TypeBuilder{
@ -3465,7 +3584,7 @@ func file_entertain_entertain_msg_proto_init() {
GoPackagePath: reflect.TypeOf(x{}).PkgPath(), GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_entertain_entertain_msg_proto_rawDesc, RawDescriptor: file_entertain_entertain_msg_proto_rawDesc,
NumEnums: 0, NumEnums: 0,
NumMessages: 48, NumMessages: 50,
NumExtensions: 0, NumExtensions: 0,
NumServices: 0, NumServices: 0,
}, },