This commit is contained in:
meixiongfeng 2022-08-18 11:36:22 +08:00
commit aa8914c14e
4 changed files with 8 additions and 7 deletions

View File

@ -95,7 +95,7 @@ func (this *apiComp) Equip(session comm.IUserSession, req *pb.EquipmentEquipReq)
subsit := true subsit := true
for i, v := range equipments { //校验装备位置 for i, v := range equipments { //校验装备位置
if v != nil { if v != nil {
if i+1 != int(confs[i].Pos) { if i != int(confs[i].Pos) {
log.Errorf("Equip conf:%+v Target:%d Incorrect range!", confs[i], i) log.Errorf("Equip conf:%+v Target:%d Incorrect range!", confs[i], i)
code = pb.ErrorCode_SystemError code = pb.ErrorCode_SystemError
return return

View File

@ -122,6 +122,11 @@ func (this *apiComp) Upgrade(session comm.IUserSession, req *pb.EquipmentUpgrade
this.module.Errorf("Upgrade code:%d", code) this.module.Errorf("Upgrade code:%d", code)
return return
} }
if conf.Pos >= 6 {
code = pb.ErrorCode_ConfigurationException
this.module.Errorf("Upgrade equipment Pos:%d", conf.Pos)
return
}
hero.EquipID[conf.Pos] = equipment.Id //拆分后的装备是一个新的 hero.EquipID[conf.Pos] = equipment.Id //拆分后的装备是一个新的
for i, v := range hero.EquipID { for i, v := range hero.EquipID {
if v != "" { if v != "" {

View File

@ -60,11 +60,7 @@ func (this *User) GetUser(uid string) *pb.DBUser {
//获取用户会话 //获取用户会话
func (this *User) GetUserSession(uid string) *pb.CacheUser { func (this *User) GetUserSession(uid string) *pb.CacheUser {
cuser := this.modelSession.getUserSession(uid) return this.modelSession.getUserSession(uid)
if cuser.Uid == "" {
return nil
}
return cuser
} }
// 清除session // 清除session

View File

@ -186,7 +186,7 @@ func (this *SCompGateRoute) ReceiveMsg(ctx context.Context, args *pb.AgentMessag
//RPC_NoticeUserClose 接收用户登录通知 //RPC_NoticeUserClose 接收用户登录通知
func (this *SCompGateRoute) NoticeUserLogin(ctx context.Context, args *pb.NoticeUserLoginReq, reply *pb.RPCMessageReply) error { func (this *SCompGateRoute) NoticeUserLogin(ctx context.Context, args *pb.NoticeUserLoginReq, reply *pb.RPCMessageReply) error {
model := db.NewDBModel(comm.TableSession, db.Local()) model := db.NewDBModel(comm.TableSession, db.Local())
model.Change(args.UserId, map[string]interface{}{ model.AddList("online", args.UserId, map[string]interface{}{
"uid": args.UserId, "uid": args.UserId,
"sessionId": args.UserSessionId, "sessionId": args.UserSessionId,
"serviceTag": args.ServiceTag, "serviceTag": args.ServiceTag,