diff --git a/logic/controller/user_cdk.go b/logic/controller/user_cdk.go index 87deadec..28ea51da 100644 --- a/logic/controller/user_cdk.go +++ b/logic/controller/user_cdk.go @@ -28,6 +28,9 @@ func (h Controller) CDK(data *C2S_GET_GIFT_COMPLETE, player *logicplayer.Player) if r == nil { return nil, errorcode.ErrorCodes.ErrMolecularCodeNotExists } + if r.Type != configservice.CDKTypeReward { + return nil, errorcode.ErrorCodes.ErrMolecularCodeNotExists + } if r.BindUserId != 0 && r.BindUserId != data.Head.UserID { return nil, errorcode.ErrorCodes.ErrMolecularCodeFrozen } diff --git a/modules/config/service/cdk.go b/modules/config/service/cdk.go index 3c52697d..8bf7873b 100644 --- a/modules/config/service/cdk.go +++ b/modules/config/service/cdk.go @@ -258,7 +258,7 @@ func (s *CdkService) UseServerNamingCDK(ctx context.Context, code string, ownerI return err } - _, err = tx.Model(model.NewServerShow()).Where("server_id", serverID).Data(g.Map{ + _, err = tx.Model(model.NewServerShow()).Where("server_id", serverID).Where("owner", ownerID).Data(g.Map{ "name": updated.Name, "owner": updated.Owner, "expire_time": updated.ExpireTime, diff --git a/modules/config/service/server.go b/modules/config/service/server.go index 1a87afd4..751e9828 100644 --- a/modules/config/service/server.go +++ b/modules/config/service/server.go @@ -268,7 +268,27 @@ func (s *ServerService) GetOwnerActiveDonationServers(ownerID uint32) []Donation // CanUseDonationName 校验目标服务器在当前时间点是否允许被冠名。 func (s *ServerService) CanUseDonationName(server model.ServerList, ownerID uint32, now time.Time) bool { - return server.OnlineID != 0 + if server.OnlineID == 0 || ownerID == 0 { + return false + } + + var shows []model.ServerShow + dbm_nocache_noenable(model.NewServerShow()).Where("server_id", server.OnlineID).Scan(&shows) + if len(shows) == 0 { + return true + } + + for i := range shows { + show := &shows[i] + if show.Owner != ownerID { + continue + } + if s.isActiveServerShow(show, now) { + return true + } + } + + return true } func (s *ServerService) getRawServers() []model.ServerList { diff --git a/modules/player/service/cdk_reward.go b/modules/player/service/cdk_reward.go index ed380bbc..7364723e 100644 --- a/modules/player/service/cdk_reward.go +++ b/modules/player/service/cdk_reward.go @@ -35,6 +35,9 @@ func (s *CdkService) GrantConfigReward(cdkID uint32, specialAdders ...CdkSpecial if cfg == nil { return nil, fmt.Errorf("绑定的CDK不存在") } + if cfg.Type != configservice.CDKTypeReward { + return nil, fmt.Errorf("当前CDK不是游戏内奖励类型") + } if cfg.BindUserId != 0 && cfg.BindUserId != s.userid { return nil, fmt.Errorf("CDK已绑定其他用户") }