12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061 |
- package logic
- import (
- "app.yhyue.com/moapp/jyMarketing/rpc/activity"
- "app.yhyue.com/moapp/jyMarketing/rpc/internal/svc"
- "context"
- "github.com/zeromicro/go-zero/core/logx"
- )
- type GetAllLotteryLogic struct {
- ctx context.Context
- svcCtx *svc.ServiceContext
- logx.Logger
- }
- func NewGetAllLotteryLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetAllLotteryLogic {
- return &GetAllLotteryLogic{
- ctx: ctx,
- svcCtx: svcCtx,
- Logger: logx.WithContext(ctx),
- }
- }
- // 商品下所有奖券获取
- func (l *GetAllLotteryLogic) GetAllLottery(in *activity.Request) (*activity.ActivityResp, error) {
- result := &activity.ActivityResp{}
- code, msg, activityData := activityServiceNew.GetAllLottery(in)
- var activityArr []*activity.ActivityJson
- for _, activityValue := range activityData {
- activityEntity := activity.ActivityJson{}
- var lotteryList []*activity.LotteryJson
- for _, value := range activityValue.LotteryData {
- lottery := activity.LotteryJson{}
- lottery.PromotionalPrice = value.PromotionalPrice
- lottery.Full = value.Full
- lottery.Reduce = value.Reduce
- lottery.Discount = float32(value.Discount)
- lottery.LotteryType = value.LotteryType
- for _, value := range value.UseProductList {
- productJson := activity.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
- lottery.UseProductList = append(lottery.UseProductList, &productJson)
- }
- lotteryList = append(lotteryList, &lottery)
- activityEntity.LotteryJson = lotteryList
- }
- activityArr = append(activityArr, &activityEntity)
- }
- result.Code = code
- result.Message = msg
- result.ActivityJson = activityArr
- return result, nil
- }
|