12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273 |
- 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 UserLotteryCheckLogic struct {
- logx.Logger
- ctx context.Context
- svcCtx *svc.ServiceContext
- }
- func NewUserLotteryCheckLogic(ctx context.Context, svcCtx *svc.ServiceContext) UserLotteryCheckLogic {
- return UserLotteryCheckLogic{
- Logger: logx.WithContext(ctx),
- ctx: ctx,
- svcCtx: svcCtx,
- }
- }
- func (l *UserLotteryCheckLogic) UserLotteryCheck(req types.Request) (*types.ActivityLotteryResp, error) {
- // todo: add your logic here and delete this line
- result := &types.ActivityLotteryResp{}
- lsi := l.svcCtx.Activity
- resp, err := lsi.UserLottery(l.ctx, &activity.Request{
- UserId: req.UserId,
- AppId: req.AppId,
- Model: req.Model,
- UserLottertId: req.UserLottertId,
- })
- if err != nil {
- return nil, err
- }
- var userLotteryList []*types.LotteryJson
- for _, value := range resp.Data {
- userLottery := types.LotteryJson{}
- userLottery.Reduce = value.Reduce
- userLottery.Full = value.Full
- userLottery.LotteryId = value.LotteryId
- userLottery.LotteryName = value.LotteryName
- for _, value := range value.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.UseProductList = value.UseProductList
- userLottery.LotteryType=value.LotteryType
- userLottery.PrizeType=value.PrizeType
- userLottery.UserLotteryId = value.UserLotteryId
- userLottery.UseDate = value.UseDate
- userLottery.Instructions=value.Instructions
- userLottery.Remark=value.Remark
- userLottery.LotteryId=value.LotteryId
- userLotteryList = append(userLotteryList, &userLottery)
- }
- result.Code = resp.Code
- result.Message = resp.Message
- result.Data = userLotteryList
- result.Count=resp.Count
- return result, nil
- }
|