71 lines
2.1 KiB
Go
71 lines
2.1 KiB
Go
package practice
|
|
|
|
import (
|
|
"go_dreamfactory/comm"
|
|
"go_dreamfactory/pb"
|
|
"go_dreamfactory/sys/configure"
|
|
cfg "go_dreamfactory/sys/configure/structs"
|
|
"go_dreamfactory/utils"
|
|
)
|
|
|
|
// 参数校验
|
|
func (this *apiComp) GetGymBuffCheck(session comm.IUserSession, req *pb.PracticeGetGymBuffReq) (errdata *pb.ErrorData) {
|
|
|
|
return
|
|
}
|
|
|
|
//练功请求
|
|
func (this *apiComp) GetGymBuff(session comm.IUserSession, req *pb.PracticeGetGymBuffReq) (errdata *pb.ErrorData) {
|
|
var (
|
|
mryl *cfg.GamePandamasMrylData
|
|
buff *cfg.GamePandamasBuffData
|
|
room *pb.DBPracticeRoom
|
|
award []*pb.UserAtno
|
|
tasks []*pb.BuriedParam = make([]*pb.BuriedParam, 0)
|
|
err error
|
|
)
|
|
|
|
if mryl, err = this.module.configure.getPandamasMryl(req.Posture); err != nil {
|
|
errdata = &pb.ErrorData{
|
|
Code: pb.ErrorCode_ConfigNoFound,
|
|
Title: pb.ErrorCode_ConfigNoFound.ToString(),
|
|
Message: err.Error(),
|
|
}
|
|
return
|
|
}
|
|
if buff, err = this.module.configure.getGamePandamasBuff(mryl.BuffGroup); err != nil {
|
|
errdata = &pb.ErrorData{
|
|
Code: pb.ErrorCode_ConfigNoFound,
|
|
Title: pb.ErrorCode_ConfigNoFound.ToString(),
|
|
Message: err.Error(),
|
|
}
|
|
return
|
|
}
|
|
|
|
if room, err = this.module.modelPandata.queryUserMartialhall(session.GetUserId()); err != nil {
|
|
errdata = &pb.ErrorData{
|
|
Code: pb.ErrorCode_DBError,
|
|
Title: pb.ErrorCode_DBError.ToString(),
|
|
Message: err.Error(),
|
|
}
|
|
return
|
|
}
|
|
|
|
if !utils.IsToday(room.Lastgymtime) {
|
|
if errdata, award = this.module.DispenseAtno(session, this.module.ModuleTools.GetGlobalConf().MrylReward, true); errdata != nil {
|
|
return
|
|
}
|
|
room.Lastgymtime = configure.Now().Unix()
|
|
this.module.ModuleUser.ChangeUserExpand(session.GetUserId(), map[string]interface{}{
|
|
"lastgymtime": room.Lastgymtime,
|
|
})
|
|
}
|
|
tasks = append(tasks, comm.GetBuriedParam(comm.Rtype185, 1))
|
|
session.SendMsg(string(this.module.GetType()), "getgymbuff", &pb.PracticeGetGymBuffResp{Buffid: buff.Id, Award: award})
|
|
go this.module.AsynHandleSession(session.Clone(), func(session comm.IUserSession) {
|
|
this.module.ModuleBuried.TriggerBuried(session, tasks...)
|
|
this.module.WriteUserLog(session.GetUserId(), req, comm.GMResAddType, "PracticeGetGymBuffReq", award)
|
|
})
|
|
return
|
|
}
|