package logic import ( "app.yhyue.com/moapp/jyMarketing/rpc/activity" "context" "app.yhyue.com/moapp/jyMarketing/api/internal/svc" "app.yhyue.com/moapp/jyMarketing/api/internal/types" "github.com/tal-tech/go-zero/core/logx" ) type LotteryInfoCheckLogic struct { logx.Logger ctx context.Context svcCtx *svc.ServiceContext } func NewLotteryInfoCheckLogic(ctx context.Context, svcCtx *svc.ServiceContext) LotteryInfoCheckLogic { return LotteryInfoCheckLogic{ Logger: logx.WithContext(ctx), ctx: ctx, svcCtx: svcCtx, } } func (l *LotteryInfoCheckLogic) LotteryInfoCheck(req types.Request) (*types.LotteryResp, error) { result := &types.LotteryResp{} lsi := l.svcCtx.Activity resp, err := lsi.LotteryInfo(l.ctx, &activity.Request{ UserId: req.UserId, AppId: req.AppId, LotteryId: req.LotteryId, }) if err != nil { return nil, err } data:=resp.Data var userLottery types.LotteryJson userLottery.Full = data.Full userLottery.Reduce = data.Reduce userLottery.LotteryBeginDate = data.LotteryBeginDate userLottery.LotteryendDate = data.LotteryendDate userLottery.LotteryName = data.LotteryName for _, value := range data.UseProductList { productJson:=types.ProductJson{} productJson.AppPage = value.AppPage productJson.ProductName = value.ProductName productJson.WxPage = value.WxPage productJson.PcPage = value.PcPage productJson.ProductCode=value.ProductCode productJson.ParentCode=value.ParentCode productJson.Describe=value.Describe userLottery.UseProductList=append(userLottery.UseProductList,productJson) } userLottery.UserLotteryId=data.UserLotteryId userLottery.Instructions = data.Instructions userLottery.Remark = data.Remark userLottery.LotteryType=data.LotteryType userLottery.LotteryId = data.LotteryId userLottery.UseDate = data.UseDate result.Code=resp.Code result.Message = resp.Message result.Data = userLottery return result, nil }