opnecond
This commit is contained in:
parent
905a40f1cb
commit
fa55fab6b0
@ -23,8 +23,7 @@ func (this *apiComp) Rise(session comm.IUserSession, req *pb.SmithyRiseReq) (err
|
|||||||
cost []*cfg.Gameatn // 消耗材料
|
cost []*cfg.Gameatn // 消耗材料
|
||||||
)
|
)
|
||||||
|
|
||||||
code = this.RiseCheck(session, req)
|
if errdata = this.RiseCheck(session, req); errdata != nil {
|
||||||
if errdata != nil {
|
|
||||||
return // 参数校验失败直接返回
|
return // 参数校验失败直接返回
|
||||||
}
|
}
|
||||||
stove, err := this.module.modelStove.getSmithyStoveList(session.GetUserId())
|
stove, err := this.module.modelStove.getSmithyStoveList(session.GetUserId())
|
||||||
@ -38,7 +37,10 @@ func (this *apiComp) Rise(session comm.IUserSession, req *pb.SmithyRiseReq) (err
|
|||||||
}
|
}
|
||||||
if conf, err := this.module.configure.GetSmithyStoveConf(stove.Lv); err == nil {
|
if conf, err := this.module.configure.GetSmithyStoveConf(stove.Lv); err == nil {
|
||||||
if stove.Temperature >= conf.MaxTemperature { // 已经达到最大的温度值了
|
if stove.Temperature >= conf.MaxTemperature { // 已经达到最大的温度值了
|
||||||
code = pb.ErrorCode_SmithyMaxTemperature
|
errdata = &pb.ErrorData{
|
||||||
|
Code: pb.ErrorCode_SmithyMaxTemperature,
|
||||||
|
Title: pb.ErrorCode_SmithyMaxTemperature.ToString(),
|
||||||
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
raise := this.module.ModuleTools.GetGlobalConf().RaiseTemperature
|
raise := this.module.ModuleTools.GetGlobalConf().RaiseTemperature
|
||||||
@ -50,7 +52,10 @@ func (this *apiComp) Rise(session comm.IUserSession, req *pb.SmithyRiseReq) (err
|
|||||||
})
|
})
|
||||||
|
|
||||||
if stove.Temperature+req.Count*raise_temperatureNum >= (conf.MaxTemperature + raise_temperatureNum) {
|
if stove.Temperature+req.Count*raise_temperatureNum >= (conf.MaxTemperature + raise_temperatureNum) {
|
||||||
code = pb.ErrorCode_SmithyMaxTemperature
|
errdata = &pb.ErrorData{
|
||||||
|
Code: pb.ErrorCode_SmithyMaxTemperature,
|
||||||
|
Title: pb.ErrorCode_SmithyMaxTemperature.ToString(),
|
||||||
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if errdata = this.module.ConsumeRes(session, cost, true); errdata != nil {
|
if errdata = this.module.ConsumeRes(session, cost, true); errdata != nil {
|
||||||
|
@ -17,7 +17,10 @@ func (this *apiComp) FuncActivate(session comm.IUserSession, req *pb.SysFuncActi
|
|||||||
opencfg := this.module.configure.getOpencondCfgByCid(req.Cid)
|
opencfg := this.module.configure.getOpencondCfgByCid(req.Cid)
|
||||||
if opencfg != nil {
|
if opencfg != nil {
|
||||||
if id := this.module.modelSys.validCond(session.GetUserId(), opencfg); id == "" { // 条件不满足
|
if id := this.module.modelSys.validCond(session.GetUserId(), opencfg); id == "" { // 条件不满足
|
||||||
code = pb.ErrorCode_OpenCondErr
|
errdata = &pb.ErrorData{
|
||||||
|
Code: pb.ErrorCode_OpenCondErr,
|
||||||
|
Title: pb.ErrorCode_OpenCondErr.ToString(),
|
||||||
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -25,7 +28,10 @@ func (this *apiComp) FuncActivate(session comm.IUserSession, req *pb.SysFuncActi
|
|||||||
list, _ := this.module.modelSys.GetOpenCondList(session.GetUserId())
|
list, _ := this.module.modelSys.GetOpenCondList(session.GetUserId())
|
||||||
for k, v := range list.Cond {
|
for k, v := range list.Cond {
|
||||||
if k == req.Cid && v != 0 {
|
if k == req.Cid && v != 0 {
|
||||||
code = pb.ErrorCode_OpenCondActivate
|
errdata = &pb.ErrorData{
|
||||||
|
Code: pb.ErrorCode_OpenCondActivate,
|
||||||
|
Title: pb.ErrorCode_OpenCondActivate.ToString(),
|
||||||
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -35,7 +41,10 @@ func (this *apiComp) FuncActivate(session comm.IUserSession, req *pb.SysFuncActi
|
|||||||
})
|
})
|
||||||
rsp.Cid = req.Cid
|
rsp.Cid = req.Cid
|
||||||
if err := session.SendMsg(string(this.module.GetType()), "funcactivate", rsp); err != nil {
|
if err := session.SendMsg(string(this.module.GetType()), "funcactivate", rsp); err != nil {
|
||||||
code = pb.ErrorCode_SystemError
|
errdata = &pb.ErrorData{
|
||||||
|
Code: pb.ErrorCode_SystemError,
|
||||||
|
Title: pb.ErrorCode_SystemError.ToString(),
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//手动激活通知模块
|
//手动激活通知模块
|
||||||
|
@ -54,8 +54,6 @@ func (this *apiComp) FuncGetList(session comm.IUserSession, req *pb.SysFuncGetLi
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := session.SendMsg(string(this.module.GetType()), "funcgetlist", rsp); err != nil {
|
session.SendMsg(string(this.module.GetType()), "funcgetlist", rsp)
|
||||||
code = pb.ErrorCode_SystemError
|
|
||||||
}
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user