专武升星逻辑补充
This commit is contained in:
parent
34c96d5684
commit
87473994f1
@ -4,6 +4,7 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"go_dreamfactory/comm"
|
"go_dreamfactory/comm"
|
||||||
"go_dreamfactory/pb"
|
"go_dreamfactory/pb"
|
||||||
|
cfg "go_dreamfactory/sys/configure/structs"
|
||||||
)
|
)
|
||||||
|
|
||||||
//参数校验
|
//参数校验
|
||||||
@ -17,6 +18,7 @@ func (this *apiComp) StarUp(session comm.IUserSession, req *pb.ExclusiveStarUpRe
|
|||||||
var (
|
var (
|
||||||
info *pb.DB_Exclusive
|
info *pb.DB_Exclusive
|
||||||
list []*pb.DB_Exclusive
|
list []*pb.DB_Exclusive
|
||||||
|
conf *cfg.GameExclusiveStarData
|
||||||
change []*pb.DB_Exclusive
|
change []*pb.DB_Exclusive
|
||||||
stars int32
|
stars int32
|
||||||
err error
|
err error
|
||||||
@ -44,6 +46,7 @@ func (this *apiComp) StarUp(session comm.IUserSession, req *pb.ExclusiveStarUpRe
|
|||||||
stars += v.Star
|
stars += v.Star
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if info == nil {
|
if info == nil {
|
||||||
errdata = &pb.ErrorData{
|
errdata = &pb.ErrorData{
|
||||||
Code: pb.ErrorCode_DBError,
|
Code: pb.ErrorCode_DBError,
|
||||||
@ -51,7 +54,18 @@ func (this *apiComp) StarUp(session comm.IUserSession, req *pb.ExclusiveStarUpRe
|
|||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
if conf, err = this.module.configure.GetMaxGameExclusiveStarData(info.CId); err != nil {
|
||||||
|
errdata = &pb.ErrorData{
|
||||||
|
Code: pb.ErrorCode_ConfigNoFound,
|
||||||
|
Message: err.Error(),
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
info.Star += stars
|
info.Star += stars
|
||||||
|
if info.Star > conf.Star {
|
||||||
|
info.Star = conf.Star
|
||||||
|
}
|
||||||
|
|
||||||
if err = this.module.model.updateExclusive(session.GetUserId(), info); err != nil {
|
if err = this.module.model.updateExclusive(session.GetUserId(), info); err != nil {
|
||||||
errdata = &pb.ErrorData{
|
errdata = &pb.ErrorData{
|
||||||
Code: pb.ErrorCode_DBError,
|
Code: pb.ErrorCode_DBError,
|
||||||
|
@ -180,6 +180,23 @@ func (this *configureComp) GetGameExclusiveStarData(cid string, star int32) (con
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//获取全部资源
|
||||||
|
func (this *configureComp) GetMaxGameExclusiveStarData(cid string) (conf *cfg.GameExclusiveStarData, err error) {
|
||||||
|
this.lock.RLock()
|
||||||
|
defer this.lock.RUnlock()
|
||||||
|
if _, ok := this.stars[cid]; ok {
|
||||||
|
if len(this.stars[cid]) > 0 {
|
||||||
|
conf = this.stars[cid][len(this.stars[cid])-1]
|
||||||
|
return
|
||||||
|
}
|
||||||
|
err = comm.NewNotFoundConfErr(string(this.module.GetType()), game_exclusiveupgrade, cid)
|
||||||
|
return
|
||||||
|
} else {
|
||||||
|
err = comm.NewNotFoundConfErr(string(this.module.GetType()), game_exclusiveupgrade, cid)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//获取全部资源
|
//获取全部资源
|
||||||
func (this *configureComp) GetGameExclusiveRankData(cid string, rank int32) (conf *cfg.GameExclusiveRankData, err error) {
|
func (this *configureComp) GetGameExclusiveRankData(cid string, rank int32) (conf *cfg.GameExclusiveRankData, err error) {
|
||||||
this.lock.RLock()
|
this.lock.RLock()
|
||||||
|
Loading…
Reference in New Issue
Block a user