美食馆领取奖励
This commit is contained in:
parent
faa70b6921
commit
f1f8b2cfd0
@ -3,6 +3,7 @@ package gourmet
|
||||
import (
|
||||
"go_dreamfactory/comm"
|
||||
"go_dreamfactory/pb"
|
||||
cfg "go_dreamfactory/sys/configure/structs"
|
||||
|
||||
"google.golang.org/protobuf/proto"
|
||||
)
|
||||
@ -15,11 +16,27 @@ func (this *apiComp) GetRewardCheck(session comm.IUserSession, req *pb.GourmetGe
|
||||
|
||||
///美食城领取奖励
|
||||
func (this *apiComp) GetReward(session comm.IUserSession, req *pb.GourmetGetRewardReq) (code pb.ErrorCode, data proto.Message) {
|
||||
|
||||
code = this.GetRewardCheck(session, req)
|
||||
if code != pb.ErrorCode_Success {
|
||||
return // 参数校验失败直接返回
|
||||
_gourmet, err := this.module.modelGourmet.getGourmetList(session.GetUserId())
|
||||
if err != nil {
|
||||
code = pb.ErrorCode_DBError
|
||||
return
|
||||
}
|
||||
code = pb.ErrorCode_AgentUidEmpty
|
||||
if len(_gourmet.Items) > 0 {
|
||||
res := make([]*cfg.Gameatn, 0)
|
||||
for _, v := range _gourmet.Items {
|
||||
res = append(res, &cfg.Gameatn{
|
||||
A: v.A,
|
||||
T: v.T,
|
||||
N: v.N,
|
||||
})
|
||||
}
|
||||
code = this.module.DispenseRes(session, res, true)
|
||||
_gourmet.Items = nil
|
||||
mapData := make(map[string]interface{}, 0)
|
||||
mapData["items"] = nil
|
||||
code = this.module.ModifyGourmetData(session.GetUserId(), mapData)
|
||||
}
|
||||
session.SendMsg(string(this.module.GetType()), PagodaGetRewardResp, &pb.GourmetGetRewardResp{Data: _gourmet})
|
||||
return
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user