Merge branch 'dev' of http://git.legu.cc/liwei_3d/go_dreamfactory into dev
This commit is contained in:
commit
136d77cadf
@ -8,20 +8,20 @@ import (
|
||||
)
|
||||
|
||||
//参数校验
|
||||
func (this *apiComp) UpdatePosCheck(session comm.IUserSession, req *pb.CombatUpdateLevelReq) (code pb.ErrorCode) {
|
||||
func (this *apiComp) UpdateLevelCheck(session comm.IUserSession, req *pb.CombatUpdateLevelReq) (code pb.ErrorCode) {
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
///获取自己的排行榜信息
|
||||
func (this *apiComp) UpdatePos(session comm.IUserSession, req *pb.CombatUpdateLevelReq) (code pb.ErrorCode, data proto.Message) {
|
||||
func (this *apiComp) UpdateLevel(session comm.IUserSession, req *pb.CombatUpdateLevelReq) (code pb.ErrorCode, data proto.Message) {
|
||||
var (
|
||||
info *pb.DBCombatUser
|
||||
level *pb.DBCombatLevel
|
||||
ok bool
|
||||
err error
|
||||
)
|
||||
if code = this.UpdatePosCheck(session, req); code != pb.ErrorCode_Success {
|
||||
if code = this.UpdateLevelCheck(session, req); code != pb.ErrorCode_Success {
|
||||
return
|
||||
}
|
||||
if info, err = this.module.modelCombat.queryInfo(session.GetUserId()); err != nil {
|
||||
@ -38,6 +38,6 @@ func (this *apiComp) UpdatePos(session comm.IUserSession, req *pb.CombatUpdateLe
|
||||
code = pb.ErrorCode_DBError
|
||||
return
|
||||
}
|
||||
session.SendMsg(string(this.module.GetType()), "updatepos", &pb.CombatUpdateLevelResp{Succ: true, Level: req.Level})
|
||||
session.SendMsg(string(this.module.GetType()), "updatelevel", &pb.CombatUpdateLevelResp{Succ: true, Level: req.Level})
|
||||
return
|
||||
}
|
@ -7,6 +7,9 @@ import (
|
||||
"go_dreamfactory/modules"
|
||||
"go_dreamfactory/pb"
|
||||
"go_dreamfactory/sys/db"
|
||||
|
||||
"go.mongodb.org/mongo-driver/mongo"
|
||||
"go.mongodb.org/mongo-driver/x/bsonx"
|
||||
)
|
||||
|
||||
///论坛 数据组件
|
||||
@ -22,9 +25,9 @@ func (this *modelCombatComp) Init(service core.IService, module core.IModule, co
|
||||
this.module = module.(*Combat)
|
||||
|
||||
//创建uid索引
|
||||
// this.DB.CreateIndex(core.SqlTable(this.TableName), mongo.IndexModel{
|
||||
// Keys: bsonx.Doc{{Key: "heroid", Value: bsonx.Int32(1)}},
|
||||
// })
|
||||
this.DB.CreateIndex(core.SqlTable(this.TableName), mongo.IndexModel{
|
||||
Keys: bsonx.Doc{{Key: "uid", Value: bsonx.Int32(1)}},
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
@ -48,7 +51,7 @@ func (this *modelCombatComp) queryInfo(uId string) (result *pb.DBCombatUser, err
|
||||
func (this *modelCombatComp) updateInfo(info *pb.DBCombatUser) (err error) {
|
||||
if err = this.Change(info.Uid, map[string]interface{}{
|
||||
"level": info.Level,
|
||||
}, db.SetDBMgoLog(false)); err != nil {
|
||||
}); err != nil {
|
||||
this.module.Errorln(err)
|
||||
return
|
||||
}
|
||||
|
@ -254,6 +254,8 @@ func (this *User) QueryAttributeValue(uid string, attr string) (value int64) {
|
||||
return int64(userEx.Guildcoin)
|
||||
case comm.ArenaCoin:
|
||||
return int64(userEx.Arenacoin)
|
||||
case comm.ResFriend:
|
||||
return int64(userEx.FriendPoint)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
@ -25,7 +25,7 @@ type DBCombatUser struct {
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
Uid string `protobuf:"bytes,1,opt,name=uid,proto3" json:"uid"` //uid
|
||||
Uid string `protobuf:"bytes,1,opt,name=uid,proto3" json:"uid"`
|
||||
Level map[int32]*DBCombatLevel `protobuf:"bytes,2,rep,name=level,proto3" json:"level" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` //关卡信息
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user