54 lines
1.3 KiB
Go
54 lines
1.3 KiB
Go
package exclusive
|
|
|
|
import (
|
|
"go_dreamfactory/comm"
|
|
"go_dreamfactory/pb"
|
|
cfg "go_dreamfactory/sys/configure/structs"
|
|
)
|
|
|
|
//参数校验
|
|
func (this *apiComp) RankUpCheck(session comm.IUserSession, req *pb.ExclusiveRankUpReq) (errdata *pb.ErrorData) {
|
|
|
|
return
|
|
}
|
|
|
|
///获取用户装备列表
|
|
func (this *apiComp) RankUp(session comm.IUserSession, req *pb.ExclusiveRankUpReq) (errdata *pb.ErrorData) {
|
|
var (
|
|
info *pb.DB_Exclusive
|
|
conf *cfg.GameExclusiveRankData
|
|
err error
|
|
)
|
|
|
|
if info, err = this.module.model.getExclusivesById(session.GetUserId(), req.Oid); err != nil {
|
|
errdata = &pb.ErrorData{
|
|
Code: pb.ErrorCode_DBError,
|
|
Message: err.Error(),
|
|
}
|
|
return
|
|
}
|
|
|
|
if conf, err = this.module.configure.GetGameExclusiveRankData(info.CId, info.Step); err != nil {
|
|
errdata = &pb.ErrorData{
|
|
Code: pb.ErrorCode_ConfigNoFound,
|
|
Message: err.Error(),
|
|
}
|
|
return
|
|
}
|
|
|
|
if errdata = this.module.ConsumeRes(session, conf.Cost, true); errdata != nil {
|
|
return
|
|
}
|
|
info.Step += 1
|
|
if err = this.module.model.updateExclusive(session.GetUserId(), info); err != nil {
|
|
errdata = &pb.ErrorData{
|
|
Code: pb.ErrorCode_DBError,
|
|
Message: err.Error(),
|
|
}
|
|
return
|
|
}
|
|
this.module.equipmentsChangePush(session, []*pb.DB_Exclusive{info})
|
|
session.SendMsg(string(this.module.GetType()), "rankup", &pb.ExclusiveRankUpResp{Exclusives: info})
|
|
return
|
|
}
|