go_dreamfactory/modules/whackamole/api_award.go
2023-10-26 14:13:11 +08:00

40 lines
958 B
Go

package whackamole
import (
"go_dreamfactory/comm"
"go_dreamfactory/pb"
cfg "go_dreamfactory/sys/configure/structs"
)
// 参数校验
func (this *apiComp) AwardCheck(session comm.IUserSession, req *pb.WhackamoleAwardReq) (errdata *pb.ErrorData) {
return
}
// /获取系统公告
func (this *apiComp) Award(session comm.IUserSession, req *pb.WhackamoleAwardReq) (errdata *pb.ErrorData) {
var (
conf *cfg.GameTDRewardData
award []*pb.UserAtno
err error
)
if errdata = this.AwardCheck(session, req); errdata != nil {
return
}
if conf, err = this.module.configure.getGameTDRewardData(req.Id); err != nil {
errdata = &pb.ErrorData{
Code: pb.ErrorCode_ConfigNoFound,
Message: err.Error(),
}
return
}
if errdata, award = this.module.DispenseAtno(session, conf.Reward, true); errdata != nil {
return
}
session.SendMsg(string(this.module.GetType()), "award", &pb.WhackamoleAwardResp{Id: req.Id, Award: award})
return
}