41 lines
922 B
Go
41 lines
922 B
Go
package caninerabbit
|
|
|
|
import (
|
|
"go_dreamfactory/comm"
|
|
"go_dreamfactory/pb"
|
|
)
|
|
|
|
func (this *apiComp) AwardCheck(session comm.IUserSession, req *pb.CanineRabbitAwardReq) (errdata *pb.ErrorData) {
|
|
return
|
|
}
|
|
|
|
func (this *apiComp) Award(session comm.IUserSession, req *pb.CanineRabbitAwardReq) (errdata *pb.ErrorData) {
|
|
var (
|
|
info *pb.DBCanineRabbit
|
|
atno []*pb.UserAtno
|
|
ok bool
|
|
err error
|
|
)
|
|
if errdata = this.AwardCheck(session, req); errdata != nil {
|
|
return
|
|
}
|
|
|
|
if info, err = this.module.model.getModel(session.GetUserId()); err != nil {
|
|
errdata = &pb.ErrorData{
|
|
Code: pb.ErrorCode_DBError,
|
|
Message: err.Error(),
|
|
}
|
|
return
|
|
}
|
|
|
|
if _, ok = info.Award[req.Id]; ok {
|
|
errdata = &pb.ErrorData{
|
|
Code: pb.ErrorCode_ReqParameterError,
|
|
Message: "Allaward Claimed!",
|
|
}
|
|
}
|
|
|
|
session.SendMsg(string(this.module.GetType()), "info", &pb.CanineRabbitAwardResp{Id: req.Id, Award: atno})
|
|
return
|
|
}
|