WH01243 2 жил өмнө
parent
commit
d74ff0807b

+ 34 - 4
rpc/internal/logic/getalllotterylogic.go

@@ -1,10 +1,9 @@
 package logic
 
 import (
-	"context"
-
 	"app.yhyue.com/moapp/jyMarketing/rpc/activity"
 	"app.yhyue.com/moapp/jyMarketing/rpc/internal/svc"
+	"context"
 
 	"github.com/zeromicro/go-zero/core/logx"
 )
@@ -25,7 +24,38 @@ func NewGetAllLotteryLogic(ctx context.Context, svcCtx *svc.ServiceContext) *Get
 
 // 商品下所有奖券获取
 func (l *GetAllLotteryLogic) GetAllLottery(in *activity.Request) (*activity.ActivityResp, error) {
-	// todo: add your logic here and delete this line
+	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
+		}
 
-	return &activity.ActivityResp{}, nil
+		activityArr = append(activityArr, &activityEntity)
+	}
+	result.Code = code
+	result.Message = msg
+	result.ActivityJson = activityArr
+	return result, nil
 }