战报数据记录
This commit is contained in:
parent
a9bfbd4419
commit
5e81c701d9
@ -6,6 +6,7 @@ import (
|
|||||||
"go_dreamfactory/pb"
|
"go_dreamfactory/pb"
|
||||||
"go_dreamfactory/sys/configure"
|
"go_dreamfactory/sys/configure"
|
||||||
cfg "go_dreamfactory/sys/configure/structs"
|
cfg "go_dreamfactory/sys/configure/structs"
|
||||||
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
// 参数校验
|
// 参数校验
|
||||||
@ -101,14 +102,18 @@ func (this *apiComp) PvpChallengeOver(session comm.IUserSession, req *pb.Plunder
|
|||||||
})
|
})
|
||||||
|
|
||||||
info = append(info, &pb.PlunderRecordData{
|
info = append(info, &pb.PlunderRecordData{
|
||||||
Itype: 2, // 2 被战败
|
Itype: 2,
|
||||||
P1: session.GetUserId(),
|
P1: session.GetUserId(),
|
||||||
P2: land.Ship[req.Oid].Uid,
|
P2: land.Ship[req.Oid].Uid,
|
||||||
Cid: land.Ship[req.Oid].Line.Cid,
|
Cid: land.Ship[req.Oid].Line.Cid,
|
||||||
Ctime: configure.Now().Unix(),
|
Ctime: configure.Now().Unix(),
|
||||||
|
Bid: req.Report.Info.Id,
|
||||||
|
Iswin: iswin,
|
||||||
})
|
})
|
||||||
|
//战报ID req.Report.Info.Id
|
||||||
err = this.module.modelRecord.AddRecordData(land.Id, info)
|
err = this.module.modelRecord.AddRecordData(land.Id, info)
|
||||||
|
|
||||||
|
go this.module.battlerecord.WrietBattleRecord(session.GetUserId(), req.Report, time.Now().Add(time.Hour*24*8))
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
land.Ship[req.Oid].Status = 3
|
land.Ship[req.Oid].Status = 3
|
||||||
@ -143,12 +148,17 @@ func (this *apiComp) PvpChallengeOver(session comm.IUserSession, req *pb.Plunder
|
|||||||
Atno: atno,
|
Atno: atno,
|
||||||
})
|
})
|
||||||
info = append(info, &pb.PlunderRecordData{
|
info = append(info, &pb.PlunderRecordData{
|
||||||
Itype: 4, // 4 掠夺成功
|
Itype: 4,
|
||||||
P1: session.GetUserId(),
|
P1: session.GetUserId(),
|
||||||
P2: land.Ship[req.Oid].Uid,
|
P2: land.Ship[req.Oid].Uid,
|
||||||
Cid: land.Ship[req.Oid].Line.Cid,
|
Cid: land.Ship[req.Oid].Line.Cid,
|
||||||
Ctime: configure.Now().Unix(),
|
Ctime: configure.Now().Unix(),
|
||||||
|
Bid: req.Report.Info.Id,
|
||||||
|
Iswin: iswin,
|
||||||
})
|
})
|
||||||
err = this.module.modelRecord.AddRecordData(land.Id, info)
|
err = this.module.modelRecord.AddRecordData(land.Id, info)
|
||||||
|
|
||||||
|
//写入战斗记录
|
||||||
|
go this.module.battlerecord.WrietBattleRecord(session.GetUserId(), req.Report, time.Now().Add(time.Hour*24*8))
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -24,6 +24,7 @@ type Plunder struct {
|
|||||||
modelLand *modelLand
|
modelLand *modelLand
|
||||||
battle comm.IBattle
|
battle comm.IBattle
|
||||||
modelRecord *modelRecord
|
modelRecord *modelRecord
|
||||||
|
battlerecord comm.IBattleRecord // 战报模块
|
||||||
}
|
}
|
||||||
|
|
||||||
// 模块名
|
// 模块名
|
||||||
@ -58,6 +59,7 @@ func (this *Plunder) OnInstallComp() {
|
|||||||
this.modelPlunder = this.RegisterComp(new(modelPlunder)).(*modelPlunder)
|
this.modelPlunder = this.RegisterComp(new(modelPlunder)).(*modelPlunder)
|
||||||
this.modelLand = this.RegisterComp(new(modelLand)).(*modelLand)
|
this.modelLand = this.RegisterComp(new(modelLand)).(*modelLand)
|
||||||
this.modelRecord = this.RegisterComp(new(modelRecord)).(*modelRecord)
|
this.modelRecord = this.RegisterComp(new(modelRecord)).(*modelRecord)
|
||||||
|
this.modelRecord = this.RegisterComp(new(modelRecord)).(*modelRecord)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *Plunder) CreatePlunderLand(uid string) (land *pb.DBPlunderLand, err error) {
|
func (this *Plunder) CreatePlunderLand(uid string) (land *pb.DBPlunderLand, err error) {
|
||||||
|
@ -470,6 +470,8 @@ type PlunderRecordData struct {
|
|||||||
P2 string `protobuf:"bytes,3,opt,name=p2,proto3" json:"p2"`
|
P2 string `protobuf:"bytes,3,opt,name=p2,proto3" json:"p2"`
|
||||||
Cid int32 `protobuf:"varint,4,opt,name=cid,proto3" json:"cid"` // 配置表id
|
Cid int32 `protobuf:"varint,4,opt,name=cid,proto3" json:"cid"` // 配置表id
|
||||||
Ctime int64 `protobuf:"varint,5,opt,name=ctime,proto3" json:"ctime"` //记录时间
|
Ctime int64 `protobuf:"varint,5,opt,name=ctime,proto3" json:"ctime"` //记录时间
|
||||||
|
Bid string `protobuf:"bytes,6,opt,name=bid,proto3" json:"bid"` // 战斗id (不是pvp 为空)
|
||||||
|
Iswin bool `protobuf:"varint,7,opt,name=iswin,proto3" json:"iswin"` // 是否胜利
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *PlunderRecordData) Reset() {
|
func (x *PlunderRecordData) Reset() {
|
||||||
@ -539,6 +541,20 @@ func (x *PlunderRecordData) GetCtime() int64 {
|
|||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (x *PlunderRecordData) GetBid() string {
|
||||||
|
if x != nil {
|
||||||
|
return x.Bid
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *PlunderRecordData) GetIswin() bool {
|
||||||
|
if x != nil {
|
||||||
|
return x.Iswin
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
// 掠夺记录
|
// 掠夺记录
|
||||||
type DBPlunderRecord struct {
|
type DBPlunderRecord struct {
|
||||||
state protoimpl.MessageState
|
state protoimpl.MessageState
|
||||||
@ -673,20 +689,23 @@ var file_plunder_plunder_db_proto_rawDesc = []byte{
|
|||||||
0x02, 0x38, 0x01, 0x1a, 0x38, 0x0a, 0x0a, 0x53, 0x63, 0x6f, 0x72, 0x65, 0x45, 0x6e, 0x74, 0x72,
|
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, 0x09, 0x52, 0x03,
|
0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03,
|
||||||
0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01,
|
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,
|
0x28, 0x05, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x22, 0x99, 0x01,
|
||||||
0x11, 0x50, 0x6c, 0x75, 0x6e, 0x64, 0x65, 0x72, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x44, 0x61,
|
0x0a, 0x11, 0x50, 0x6c, 0x75, 0x6e, 0x64, 0x65, 0x72, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x44,
|
||||||
0x74, 0x61, 0x12, 0x14, 0x0a, 0x05, 0x69, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28,
|
0x61, 0x74, 0x61, 0x12, 0x14, 0x0a, 0x05, 0x69, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01,
|
||||||
0x05, 0x52, 0x05, 0x69, 0x74, 0x79, 0x70, 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x70, 0x31, 0x18, 0x02,
|
0x28, 0x05, 0x52, 0x05, 0x69, 0x74, 0x79, 0x70, 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x70, 0x31, 0x18,
|
||||||
0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x70, 0x31, 0x12, 0x0e, 0x0a, 0x02, 0x70, 0x32, 0x18, 0x03,
|
0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x70, 0x31, 0x12, 0x0e, 0x0a, 0x02, 0x70, 0x32, 0x18,
|
||||||
0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x70, 0x32, 0x12, 0x10, 0x0a, 0x03, 0x63, 0x69, 0x64, 0x18,
|
0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x70, 0x32, 0x12, 0x10, 0x0a, 0x03, 0x63, 0x69, 0x64,
|
||||||
0x04, 0x20, 0x01, 0x28, 0x05, 0x52, 0x03, 0x63, 0x69, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x63, 0x74,
|
0x18, 0x04, 0x20, 0x01, 0x28, 0x05, 0x52, 0x03, 0x63, 0x69, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x63,
|
||||||
0x69, 0x6d, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x63, 0x74, 0x69, 0x6d, 0x65,
|
0x74, 0x69, 0x6d, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x63, 0x74, 0x69, 0x6d,
|
||||||
0x22, 0x49, 0x0a, 0x0f, 0x44, 0x42, 0x50, 0x6c, 0x75, 0x6e, 0x64, 0x65, 0x72, 0x52, 0x65, 0x63,
|
0x65, 0x12, 0x10, 0x0a, 0x03, 0x62, 0x69, 0x64, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03,
|
||||||
0x6f, 0x72, 0x64, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52,
|
0x62, 0x69, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x69, 0x73, 0x77, 0x69, 0x6e, 0x18, 0x07, 0x20, 0x01,
|
||||||
0x02, 0x69, 0x64, 0x12, 0x26, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x02, 0x20, 0x03, 0x28,
|
0x28, 0x08, 0x52, 0x05, 0x69, 0x73, 0x77, 0x69, 0x6e, 0x22, 0x49, 0x0a, 0x0f, 0x44, 0x42, 0x50,
|
||||||
0x0b, 0x32, 0x12, 0x2e, 0x50, 0x6c, 0x75, 0x6e, 0x64, 0x65, 0x72, 0x52, 0x65, 0x63, 0x6f, 0x72,
|
0x6c, 0x75, 0x6e, 0x64, 0x65, 0x72, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x12, 0x0e, 0x0a, 0x02,
|
||||||
0x64, 0x44, 0x61, 0x74, 0x61, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x42, 0x06, 0x5a, 0x04, 0x2e,
|
0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x26, 0x0a, 0x04,
|
||||||
0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
0x64, 0x61, 0x74, 0x61, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x50, 0x6c, 0x75,
|
||||||
|
0x6e, 0x64, 0x65, 0x72, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x44, 0x61, 0x74, 0x61, 0x52, 0x04,
|
||||||
|
0x64, 0x61, 0x74, 0x61, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72,
|
||||||
|
0x6f, 0x74, 0x6f, 0x33,
|
||||||
}
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
Loading…
Reference in New Issue
Block a user