战局记录
This commit is contained in:
parent
2acd980cba
commit
b558768c0e
32
modules/entertainment/api_record.go
Normal file
32
modules/entertainment/api_record.go
Normal 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
|
||||
}
|
@ -64,6 +64,19 @@ func (this *modelComp) getEntertainmList(uid string) (result *pb.DBXXLData, err
|
||||
for _, v := range this.module.configure.GetInitGameConsumeSkill() {
|
||||
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)
|
||||
}
|
||||
return result, err
|
||||
|
@ -50,8 +50,9 @@ func (this *modelRecode) getXxlRecord(uid string) (results []*pb.DBXxlRecord, er
|
||||
cursor *mongo.Cursor
|
||||
)
|
||||
results = make([]*pb.DBXxlRecord, 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 {
|
||||
if cursor, err = this.DBModel.DB.Find(comm.TableEntertainRecode, bson.M{"$or": []bson.M{{"p1": uid},
|
||||
{"p2": uid}}}, options.Find().SetSort(bson.M{"ctime": -1}),
|
||||
options.Find().SetLimit(int64(comm.MaxRankList))); err != nil {
|
||||
this.module.Errorln(err)
|
||||
return
|
||||
} else {
|
||||
|
@ -623,7 +623,7 @@ func (this *Room) GameOver(winner *pb.PlayerData) (errdata *pb.ErrorData) {
|
||||
P1: this.player1.Userinfo.Uid,
|
||||
P2: this.player2.Userinfo.Uid,
|
||||
Uinfo1: this.player1.Userinfo,
|
||||
Uinfo2: this.player1.Userinfo,
|
||||
Uinfo2: this.player2.Userinfo,
|
||||
P1Score: this.player1.Score,
|
||||
P2Score: this.player2.Score,
|
||||
Win: winner.Userinfo.Uid,
|
||||
|
@ -2544,6 +2544,92 @@ func (x *EntertainTaskRewardResp) GetAward() []*UserAtno {
|
||||
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_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,
|
||||
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,
|
||||
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,
|
||||
0x74, 0x6e, 0x6f, 0x52, 0x05, 0x61, 0x77, 0x61, 0x72, 0x64, 0x22, 0x14, 0x0a, 0x12, 0x45, 0x6e,
|
||||
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 (
|
||||
@ -2802,7 +2893,7 @@ func file_entertain_entertain_msg_proto_rawDescGZIP() []byte {
|
||||
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{}{
|
||||
(*EntertainMatchReq)(nil), // 0: EntertainMatchReq
|
||||
(*EntertainMatchResp)(nil), // 1: EntertainMatchResp
|
||||
@ -2850,52 +2941,56 @@ var file_entertain_entertain_msg_proto_goTypes = []interface{}{
|
||||
(*EntertainRankResp)(nil), // 43: EntertainRankResp
|
||||
(*EntertainTaskRewardReq)(nil), // 44: EntertainTaskRewardReq
|
||||
(*EntertainTaskRewardResp)(nil), // 45: EntertainTaskRewardResp
|
||||
nil, // 46: EntertainChangePush.CardEntry
|
||||
nil, // 47: EntertainChangePush.SkillEntry
|
||||
(*PlayerData)(nil), // 48: PlayerData
|
||||
(*MapData)(nil), // 49: MapData
|
||||
(*UserAtno)(nil), // 50: UserAtno
|
||||
(*BoxData)(nil), // 51: BoxData
|
||||
(*DBXXLData)(nil), // 52: DBXXLData
|
||||
(*XxlPlayer)(nil), // 53: XxlPlayer
|
||||
(*EntertainRecordReq)(nil), // 46: EntertainRecordReq
|
||||
(*EntertainRecordResp)(nil), // 47: EntertainRecordResp
|
||||
nil, // 48: EntertainChangePush.CardEntry
|
||||
nil, // 49: EntertainChangePush.SkillEntry
|
||||
(*PlayerData)(nil), // 50: PlayerData
|
||||
(*MapData)(nil), // 51: MapData
|
||||
(*UserAtno)(nil), // 52: UserAtno
|
||||
(*BoxData)(nil), // 53: BoxData
|
||||
(*DBXXLData)(nil), // 54: DBXXLData
|
||||
(*XxlPlayer)(nil), // 55: XxlPlayer
|
||||
(*DBXxlRecord)(nil), // 56: DBXxlRecord
|
||||
}
|
||||
var file_entertain_entertain_msg_proto_depIdxs = []int32{
|
||||
48, // 0: EntertainStartGamePush.user1:type_name -> PlayerData
|
||||
48, // 1: EntertainStartGamePush.user2:type_name -> PlayerData
|
||||
49, // 2: EntertainStartGamePush.mpadata:type_name -> MapData
|
||||
49, // 3: EntertainOperatorRstPush.mpadata:type_name -> MapData
|
||||
48, // 4: EntertainOperatorRstPush.user1:type_name -> PlayerData
|
||||
48, // 5: EntertainOperatorRstPush.user2:type_name -> PlayerData
|
||||
48, // 6: EntertainGameOverPush.user1:type_name -> PlayerData
|
||||
48, // 7: EntertainGameOverPush.user2:type_name -> PlayerData
|
||||
49, // 8: EntertainGameOverPush.mpadata:type_name -> MapData
|
||||
50, // 9: EntertainGameOverPush.reward:type_name -> UserAtno
|
||||
51, // 10: EntertainGameOverPush.box:type_name -> BoxData
|
||||
48, // 11: EntertainEnterRoomPush.user1:type_name -> PlayerData
|
||||
48, // 12: EntertainEnterRoomPush.user2:type_name -> PlayerData
|
||||
49, // 13: EntertainReconnectResp.mpadata:type_name -> MapData
|
||||
48, // 14: EntertainReconnectResp.user1:type_name -> PlayerData
|
||||
48, // 15: EntertainReconnectResp.user2:type_name -> PlayerData
|
||||
49, // 16: EntertainRefreshPlatResp.mpadata:type_name -> MapData
|
||||
49, // 17: EntertainRefreshPush.mpadata:type_name -> MapData
|
||||
52, // 18: EntertainGetListResp.data:type_name -> DBXXLData
|
||||
52, // 19: EntertainRewardResp.data:type_name -> DBXXLData
|
||||
50, // 20: EntertainRewardResp.reward:type_name -> UserAtno
|
||||
46, // 21: EntertainChangePush.card:type_name -> EntertainChangePush.CardEntry
|
||||
47, // 22: EntertainChangePush.skill:type_name -> EntertainChangePush.SkillEntry
|
||||
48, // 23: EntertainJoinCreateRoomPush.user1:type_name -> PlayerData
|
||||
48, // 24: EntertainJoinCreateRoomPush.user2:type_name -> PlayerData
|
||||
51, // 25: EntertainBoxRewardResp.box:type_name -> BoxData
|
||||
50, // 26: EntertainBoxRewardResp.reward:type_name -> UserAtno
|
||||
52, // 27: EntertainReceiveResp.info:type_name -> DBXXLData
|
||||
50, // 28: EntertainReceiveResp.award:type_name -> UserAtno
|
||||
53, // 29: EntertainRankResp.players:type_name -> XxlPlayer
|
||||
50, // 30: EntertainTaskRewardResp.award:type_name -> UserAtno
|
||||
31, // [31:31] is the sub-list for method output_type
|
||||
31, // [31:31] is the sub-list for method input_type
|
||||
31, // [31:31] is the sub-list for extension type_name
|
||||
31, // [31:31] is the sub-list for extension extendee
|
||||
0, // [0:31] is the sub-list for field type_name
|
||||
50, // 0: EntertainStartGamePush.user1:type_name -> PlayerData
|
||||
50, // 1: EntertainStartGamePush.user2:type_name -> PlayerData
|
||||
51, // 2: EntertainStartGamePush.mpadata:type_name -> MapData
|
||||
51, // 3: EntertainOperatorRstPush.mpadata:type_name -> MapData
|
||||
50, // 4: EntertainOperatorRstPush.user1:type_name -> PlayerData
|
||||
50, // 5: EntertainOperatorRstPush.user2:type_name -> PlayerData
|
||||
50, // 6: EntertainGameOverPush.user1:type_name -> PlayerData
|
||||
50, // 7: EntertainGameOverPush.user2:type_name -> PlayerData
|
||||
51, // 8: EntertainGameOverPush.mpadata:type_name -> MapData
|
||||
52, // 9: EntertainGameOverPush.reward:type_name -> UserAtno
|
||||
53, // 10: EntertainGameOverPush.box:type_name -> BoxData
|
||||
50, // 11: EntertainEnterRoomPush.user1:type_name -> PlayerData
|
||||
50, // 12: EntertainEnterRoomPush.user2:type_name -> PlayerData
|
||||
51, // 13: EntertainReconnectResp.mpadata:type_name -> MapData
|
||||
50, // 14: EntertainReconnectResp.user1:type_name -> PlayerData
|
||||
50, // 15: EntertainReconnectResp.user2:type_name -> PlayerData
|
||||
51, // 16: EntertainRefreshPlatResp.mpadata:type_name -> MapData
|
||||
51, // 17: EntertainRefreshPush.mpadata:type_name -> MapData
|
||||
54, // 18: EntertainGetListResp.data:type_name -> DBXXLData
|
||||
54, // 19: EntertainRewardResp.data:type_name -> DBXXLData
|
||||
52, // 20: EntertainRewardResp.reward:type_name -> UserAtno
|
||||
48, // 21: EntertainChangePush.card:type_name -> EntertainChangePush.CardEntry
|
||||
49, // 22: EntertainChangePush.skill:type_name -> EntertainChangePush.SkillEntry
|
||||
50, // 23: EntertainJoinCreateRoomPush.user1:type_name -> PlayerData
|
||||
50, // 24: EntertainJoinCreateRoomPush.user2:type_name -> PlayerData
|
||||
53, // 25: EntertainBoxRewardResp.box:type_name -> BoxData
|
||||
52, // 26: EntertainBoxRewardResp.reward:type_name -> UserAtno
|
||||
54, // 27: EntertainReceiveResp.info:type_name -> DBXXLData
|
||||
52, // 28: EntertainReceiveResp.award:type_name -> UserAtno
|
||||
55, // 29: EntertainRankResp.players:type_name -> XxlPlayer
|
||||
52, // 30: EntertainTaskRewardResp.award:type_name -> UserAtno
|
||||
56, // 31: EntertainRecordResp.record:type_name -> DBXxlRecord
|
||||
32, // [32:32] is the sub-list for method output_type
|
||||
32, // [32:32] is the sub-list for method input_type
|
||||
32, // [32:32] is the sub-list for extension 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() }
|
||||
@ -3458,6 +3553,30 @@ func file_entertain_entertain_msg_proto_init() {
|
||||
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{}
|
||||
out := protoimpl.TypeBuilder{
|
||||
@ -3465,7 +3584,7 @@ func file_entertain_entertain_msg_proto_init() {
|
||||
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||
RawDescriptor: file_entertain_entertain_msg_proto_rawDesc,
|
||||
NumEnums: 0,
|
||||
NumMessages: 48,
|
||||
NumMessages: 50,
|
||||
NumExtensions: 0,
|
||||
NumServices: 0,
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user