package smithy import ( "go_dreamfactory/comm" "go_dreamfactory/pb" cfg "go_dreamfactory/sys/configure/structs" "google.golang.org/protobuf/proto" ) //参数校验 func (this *apiComp) GetRewardCheck(session comm.IUserSession, req *pb.SmithyGetRewardReq) (code pb.ErrorCode) { return } ///美食城领取奖励 func (this *apiComp) GetReward(session comm.IUserSession, req *pb.SmithyGetRewardReq) (code pb.ErrorCode, data proto.Message) { code = this.GetRewardCheck(session, req) _gourmet, err := this.module.modelSmithy.getSmithyList(session.GetUserId()) if err != nil { code = pb.ErrorCode_DBError return } 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.ModifySmithyData(session.GetUserId(), mapData) } session.SendMsg(string(this.module.GetType()), SmithyGetRewardResp, &pb.SmithyGetRewardResp{Data: _gourmet}) return }