上传竞技场记录和胜率相关需求补充
This commit is contained in:
parent
95b5078667
commit
e43de8647a
@ -262,5 +262,11 @@
|
|||||||
"open": true,
|
"open": true,
|
||||||
"routrules": "~/worker",
|
"routrules": "~/worker",
|
||||||
"describe": "获取在线玩家数据"
|
"describe": "获取在线玩家数据"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"msgid": "arena",
|
||||||
|
"open": true,
|
||||||
|
"routrules": "~/worker",
|
||||||
|
"describe": "竞技场"
|
||||||
}
|
}
|
||||||
]
|
]
|
@ -118,14 +118,16 @@ func (this *apiComp) ChallengeReward(session comm.IUserSession, req *pb.ArenaCha
|
|||||||
this.module.modelRank.updateArenaRank(red, bule)
|
this.module.modelRank.updateArenaRank(red, bule)
|
||||||
info.Integral = red.Integral
|
info.Integral = red.Integral
|
||||||
info.Rank = red.Rank
|
info.Rank = red.Rank
|
||||||
|
info.Attacktotaluum++
|
||||||
|
if req.Iswin {
|
||||||
|
info.Attackwinuum++
|
||||||
|
} else {
|
||||||
|
rival.Defendwinuum++
|
||||||
|
}
|
||||||
rival.Integral = bule.Integral
|
rival.Integral = bule.Integral
|
||||||
rival.Rank = bule.Rank
|
rival.Rank = bule.Rank
|
||||||
if err = this.module.modelArena.updateArenaUserInfo(info); err != nil {
|
rival.Defendtotaluum++
|
||||||
code = pb.ErrorCode_DBError
|
|
||||||
}
|
|
||||||
if err = this.module.modelArena.updateArenaUserInfo(rival); err != nil {
|
|
||||||
code = pb.ErrorCode_DBError
|
|
||||||
}
|
|
||||||
redrecord := &pb.DBArenaBattleRecord{
|
redrecord := &pb.DBArenaBattleRecord{
|
||||||
Bid: req.Report.Info.Id,
|
Bid: req.Report.Info.Id,
|
||||||
Time: time.Now().Unix(),
|
Time: time.Now().Unix(),
|
||||||
@ -151,10 +153,6 @@ func (this *apiComp) ChallengeReward(session comm.IUserSession, req *pb.ArenaCha
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
info.Record = append(info.Record, redrecord)
|
info.Record = append(info.Record, redrecord)
|
||||||
if err = this.module.modelArena.Change(red.Uid, map[string]interface{}{"record": info.Record}); err != nil {
|
|
||||||
code = pb.ErrorCode_DBError
|
|
||||||
return
|
|
||||||
}
|
|
||||||
buleRecord := &pb.DBArenaBattleRecord{
|
buleRecord := &pb.DBArenaBattleRecord{
|
||||||
Bid: req.Report.Info.Id,
|
Bid: req.Report.Info.Id,
|
||||||
Time: time.Now().Unix(),
|
Time: time.Now().Unix(),
|
||||||
@ -180,17 +178,21 @@ func (this *apiComp) ChallengeReward(session comm.IUserSession, req *pb.ArenaCha
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
rival.Record = append(rival.Record, buleRecord)
|
rival.Record = append(rival.Record, buleRecord)
|
||||||
if err = this.module.modelArena.Change(rival.Uid, map[string]interface{}{"record": rival.Record}); err != nil {
|
if err = this.module.modelArena.updateArenaUserInfo(info); err != nil {
|
||||||
|
code = pb.ErrorCode_DBError
|
||||||
|
}
|
||||||
|
if err = this.module.modelArena.updateArenaUserInfo(rival); err != nil {
|
||||||
code = pb.ErrorCode_DBError
|
code = pb.ErrorCode_DBError
|
||||||
return
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
this.module.modelRank.updateArenaRank(red)
|
this.module.modelRank.updateArenaRank(red)
|
||||||
info.Integral = red.Integral
|
info.Integral = red.Integral
|
||||||
info.Rank = red.Rank
|
info.Rank = red.Rank
|
||||||
if err = this.module.modelArena.updateArenaUserInfo(info); err != nil {
|
info.Attacktotaluum++
|
||||||
code = pb.ErrorCode_DBError
|
if req.Iswin {
|
||||||
|
info.Attackwinuum++
|
||||||
}
|
}
|
||||||
|
|
||||||
redrecord := &pb.DBArenaBattleRecord{
|
redrecord := &pb.DBArenaBattleRecord{
|
||||||
Bid: req.Report.Info.Id,
|
Bid: req.Report.Info.Id,
|
||||||
Time: time.Now().Unix(),
|
Time: time.Now().Unix(),
|
||||||
@ -216,9 +218,8 @@ func (this *apiComp) ChallengeReward(session comm.IUserSession, req *pb.ArenaCha
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
info.Record = append(info.Record, redrecord)
|
info.Record = append(info.Record, redrecord)
|
||||||
if err = this.module.modelArena.Change(red.Uid, map[string]interface{}{"record": info.Record}); err != nil {
|
if err = this.module.modelArena.updateArenaUserInfo(info); err != nil {
|
||||||
code = pb.ErrorCode_DBError
|
code = pb.ErrorCode_DBError
|
||||||
return
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -10,7 +10,9 @@ import (
|
|||||||
|
|
||||||
//参数校验
|
//参数校验
|
||||||
func (this *apiComp) OtherInfoCheck(session comm.IUserSession, req *pb.ArenaOtherInfoReq) (code pb.ErrorCode) {
|
func (this *apiComp) OtherInfoCheck(session comm.IUserSession, req *pb.ArenaOtherInfoReq) (code pb.ErrorCode) {
|
||||||
|
if req.OtherId == "" {
|
||||||
|
code = pb.ErrorCode_ReqParameterError
|
||||||
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -23,7 +25,7 @@ func (this *apiComp) OtherInfo(session comm.IUserSession, req *pb.ArenaOtherInfo
|
|||||||
if code = this.OtherInfoCheck(session, req); code != pb.ErrorCode_Success {
|
if code = this.OtherInfoCheck(session, req); code != pb.ErrorCode_Success {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if info, err = this.module.modelArena.queryPlayerInfo(session.GetUserId()); err != nil && err != mgo.MongodbNil {
|
if info, err = this.module.modelArena.queryPlayerInfo(req.OtherId); err != nil && err != mgo.MongodbNil {
|
||||||
code = pb.ErrorCode_DBError
|
code = pb.ErrorCode_DBError
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -115,6 +115,10 @@ func (this *modelArena) updateArenaUserInfo(info *pb.DBArenaUser) (err error) {
|
|||||||
"defend": info.Defend,
|
"defend": info.Defend,
|
||||||
"streak": info.Streak,
|
"streak": info.Streak,
|
||||||
"record": info.Record,
|
"record": info.Record,
|
||||||
|
"attackwinuum": info.Attackwinuum,
|
||||||
|
"attacktotaluum": info.Attacktotaluum,
|
||||||
|
"defendwinuum": info.Defendwinuum,
|
||||||
|
"defendtotaluum": info.Defendtotaluum,
|
||||||
})
|
})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -481,6 +481,10 @@ type DBArenaUser struct {
|
|||||||
Buynum int32 `protobuf:"varint,14,opt,name=buynum,proto3" json:"buynum"` //购买次数
|
Buynum int32 `protobuf:"varint,14,opt,name=buynum,proto3" json:"buynum"` //购买次数
|
||||||
Record []*DBArenaBattleRecord `protobuf:"bytes,15,rep,name=record,proto3" json:"record"` //战斗记录
|
Record []*DBArenaBattleRecord `protobuf:"bytes,15,rep,name=record,proto3" json:"record"` //战斗记录
|
||||||
Lastrtickettime int64 `protobuf:"varint,16,opt,name=lastrtickettime,proto3" json:"lastrtickettime"` //最后领劵时间
|
Lastrtickettime int64 `protobuf:"varint,16,opt,name=lastrtickettime,proto3" json:"lastrtickettime"` //最后领劵时间
|
||||||
|
Attackwinuum int32 `protobuf:"varint,17,opt,name=attackwinuum,proto3" json:"attackwinuum"` //进攻胜利次数
|
||||||
|
Attacktotaluum int32 `protobuf:"varint,18,opt,name=attacktotaluum,proto3" json:"attacktotaluum"` //进攻总次数
|
||||||
|
Defendwinuum int32 `protobuf:"varint,19,opt,name=defendwinuum,proto3" json:"defendwinuum"` //防守胜利
|
||||||
|
Defendtotaluum int32 `protobuf:"varint,20,opt,name=defendtotaluum,proto3" json:"defendtotaluum"` //防守总
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *DBArenaUser) Reset() {
|
func (x *DBArenaUser) Reset() {
|
||||||
@ -627,6 +631,34 @@ func (x *DBArenaUser) GetLastrtickettime() int64 {
|
|||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (x *DBArenaUser) GetAttackwinuum() int32 {
|
||||||
|
if x != nil {
|
||||||
|
return x.Attackwinuum
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *DBArenaUser) GetAttacktotaluum() int32 {
|
||||||
|
if x != nil {
|
||||||
|
return x.Attacktotaluum
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *DBArenaUser) GetDefendwinuum() int32 {
|
||||||
|
if x != nil {
|
||||||
|
return x.Defendwinuum
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *DBArenaUser) GetDefendtotaluum() int32 {
|
||||||
|
if x != nil {
|
||||||
|
return x.Defendtotaluum
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
var File_arena_arena_db_proto protoreflect.FileDescriptor
|
var File_arena_arena_db_proto protoreflect.FileDescriptor
|
||||||
|
|
||||||
var file_arena_arena_db_proto_rawDesc = []byte{
|
var file_arena_arena_db_proto_rawDesc = []byte{
|
||||||
@ -680,7 +712,7 @@ var file_arena_arena_db_proto_rawDesc = []byte{
|
|||||||
0x28, 0x05, 0x52, 0x0b, 0x61, 0x64, 0x64, 0x69, 0x6e, 0x74, 0x65, 0x67, 0x72, 0x61, 0x6c, 0x12,
|
0x28, 0x05, 0x52, 0x0b, 0x61, 0x64, 0x64, 0x69, 0x6e, 0x74, 0x65, 0x67, 0x72, 0x61, 0x6c, 0x12,
|
||||||
0x28, 0x0a, 0x05, 0x53, 0x74, 0x61, 0x74, 0x65, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x12,
|
0x28, 0x0a, 0x05, 0x53, 0x74, 0x61, 0x74, 0x65, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x12,
|
||||||
0x2e, 0x42, 0x61, 0x74, 0x74, 0x6c, 0x65, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x53, 0x74, 0x61,
|
0x2e, 0x42, 0x61, 0x74, 0x74, 0x6c, 0x65, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x53, 0x74, 0x61,
|
||||||
0x74, 0x65, 0x52, 0x05, 0x53, 0x74, 0x61, 0x74, 0x65, 0x22, 0xd9, 0x03, 0x0a, 0x0b, 0x44, 0x42,
|
0x74, 0x65, 0x52, 0x05, 0x53, 0x74, 0x61, 0x74, 0x65, 0x22, 0xf1, 0x04, 0x0a, 0x0b, 0x44, 0x42,
|
||||||
0x41, 0x72, 0x65, 0x6e, 0x61, 0x55, 0x73, 0x65, 0x72, 0x12, 0x10, 0x0a, 0x03, 0x75, 0x69, 0x64,
|
0x41, 0x72, 0x65, 0x6e, 0x61, 0x55, 0x73, 0x65, 0x72, 0x12, 0x10, 0x0a, 0x03, 0x75, 0x69, 0x64,
|
||||||
0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x75, 0x69, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x6e,
|
0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x75, 0x69, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x6e,
|
||||||
0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12,
|
0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12,
|
||||||
@ -710,18 +742,27 @@ var file_arena_arena_db_proto_rawDesc = []byte{
|
|||||||
0x6f, 0x72, 0x64, 0x52, 0x06, 0x72, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x12, 0x28, 0x0a, 0x0f, 0x6c,
|
0x6f, 0x72, 0x64, 0x52, 0x06, 0x72, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x12, 0x28, 0x0a, 0x0f, 0x6c,
|
||||||
0x61, 0x73, 0x74, 0x72, 0x74, 0x69, 0x63, 0x6b, 0x65, 0x74, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x10,
|
0x61, 0x73, 0x74, 0x72, 0x74, 0x69, 0x63, 0x6b, 0x65, 0x74, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x10,
|
||||||
0x20, 0x01, 0x28, 0x03, 0x52, 0x0f, 0x6c, 0x61, 0x73, 0x74, 0x72, 0x74, 0x69, 0x63, 0x6b, 0x65,
|
0x20, 0x01, 0x28, 0x03, 0x52, 0x0f, 0x6c, 0x61, 0x73, 0x74, 0x72, 0x74, 0x69, 0x63, 0x6b, 0x65,
|
||||||
0x74, 0x74, 0x69, 0x6d, 0x65, 0x2a, 0x9f, 0x01, 0x0a, 0x11, 0x42, 0x61, 0x74, 0x74, 0x6c, 0x65,
|
0x74, 0x74, 0x69, 0x6d, 0x65, 0x12, 0x22, 0x0a, 0x0c, 0x61, 0x74, 0x74, 0x61, 0x63, 0x6b, 0x77,
|
||||||
0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x0d, 0x0a, 0x09, 0x41,
|
0x69, 0x6e, 0x75, 0x75, 0x6d, 0x18, 0x11, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0c, 0x61, 0x74, 0x74,
|
||||||
0x74, 0x74, 0x61, 0x63, 0x6b, 0x57, 0x69, 0x6e, 0x10, 0x00, 0x12, 0x0e, 0x0a, 0x0a, 0x41, 0x74,
|
0x61, 0x63, 0x6b, 0x77, 0x69, 0x6e, 0x75, 0x75, 0x6d, 0x12, 0x26, 0x0a, 0x0e, 0x61, 0x74, 0x74,
|
||||||
0x74, 0x61, 0x63, 0x6b, 0x4c, 0x6f, 0x73, 0x74, 0x10, 0x01, 0x12, 0x0e, 0x0a, 0x0a, 0x44, 0x65,
|
0x61, 0x63, 0x6b, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x75, 0x75, 0x6d, 0x18, 0x12, 0x20, 0x01, 0x28,
|
||||||
0x66, 0x65, 0x6e, 0x64, 0x6b, 0x57, 0x69, 0x6e, 0x10, 0x02, 0x12, 0x0e, 0x0a, 0x0a, 0x44, 0x65,
|
0x05, 0x52, 0x0e, 0x61, 0x74, 0x74, 0x61, 0x63, 0x6b, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x75, 0x75,
|
||||||
0x66, 0x65, 0x6e, 0x64, 0x4c, 0x6f, 0x73, 0x74, 0x10, 0x03, 0x12, 0x12, 0x0a, 0x0e, 0x57, 0x61,
|
0x6d, 0x12, 0x22, 0x0a, 0x0c, 0x64, 0x65, 0x66, 0x65, 0x6e, 0x64, 0x77, 0x69, 0x6e, 0x75, 0x75,
|
||||||
0x69, 0x74, 0x69, 0x6e, 0x67, 0x52, 0x65, 0x76, 0x65, 0x6e, 0x67, 0x65, 0x10, 0x04, 0x12, 0x11,
|
0x6d, 0x18, 0x13, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0c, 0x64, 0x65, 0x66, 0x65, 0x6e, 0x64, 0x77,
|
||||||
0x0a, 0x0d, 0x52, 0x65, 0x76, 0x65, 0x6e, 0x67, 0x65, 0x46, 0x61, 0x69, 0x6c, 0x65, 0x64, 0x10,
|
0x69, 0x6e, 0x75, 0x75, 0x6d, 0x12, 0x26, 0x0a, 0x0e, 0x64, 0x65, 0x66, 0x65, 0x6e, 0x64, 0x74,
|
||||||
0x05, 0x12, 0x14, 0x0a, 0x10, 0x52, 0x65, 0x76, 0x65, 0x6e, 0x67, 0x65, 0x53, 0x75, 0x63, 0x63,
|
0x6f, 0x74, 0x61, 0x6c, 0x75, 0x75, 0x6d, 0x18, 0x14, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0e, 0x64,
|
||||||
0x65, 0x65, 0x64, 0x65, 0x64, 0x10, 0x06, 0x12, 0x0e, 0x0a, 0x0a, 0x52, 0x65, 0x76, 0x65, 0x6e,
|
0x65, 0x66, 0x65, 0x6e, 0x64, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x75, 0x75, 0x6d, 0x2a, 0x9f, 0x01,
|
||||||
0x67, 0x65, 0x45, 0x6e, 0x64, 0x10, 0x07, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62,
|
0x0a, 0x11, 0x42, 0x61, 0x74, 0x74, 0x6c, 0x65, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x53, 0x74,
|
||||||
0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
0x61, 0x74, 0x65, 0x12, 0x0d, 0x0a, 0x09, 0x41, 0x74, 0x74, 0x61, 0x63, 0x6b, 0x57, 0x69, 0x6e,
|
||||||
|
0x10, 0x00, 0x12, 0x0e, 0x0a, 0x0a, 0x41, 0x74, 0x74, 0x61, 0x63, 0x6b, 0x4c, 0x6f, 0x73, 0x74,
|
||||||
|
0x10, 0x01, 0x12, 0x0e, 0x0a, 0x0a, 0x44, 0x65, 0x66, 0x65, 0x6e, 0x64, 0x6b, 0x57, 0x69, 0x6e,
|
||||||
|
0x10, 0x02, 0x12, 0x0e, 0x0a, 0x0a, 0x44, 0x65, 0x66, 0x65, 0x6e, 0x64, 0x4c, 0x6f, 0x73, 0x74,
|
||||||
|
0x10, 0x03, 0x12, 0x12, 0x0a, 0x0e, 0x57, 0x61, 0x69, 0x74, 0x69, 0x6e, 0x67, 0x52, 0x65, 0x76,
|
||||||
|
0x65, 0x6e, 0x67, 0x65, 0x10, 0x04, 0x12, 0x11, 0x0a, 0x0d, 0x52, 0x65, 0x76, 0x65, 0x6e, 0x67,
|
||||||
|
0x65, 0x46, 0x61, 0x69, 0x6c, 0x65, 0x64, 0x10, 0x05, 0x12, 0x14, 0x0a, 0x10, 0x52, 0x65, 0x76,
|
||||||
|
0x65, 0x6e, 0x67, 0x65, 0x53, 0x75, 0x63, 0x63, 0x65, 0x65, 0x64, 0x65, 0x64, 0x10, 0x06, 0x12,
|
||||||
|
0x0e, 0x0a, 0x0a, 0x52, 0x65, 0x76, 0x65, 0x6e, 0x67, 0x65, 0x45, 0x6e, 0x64, 0x10, 0x07, 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