Переглянути джерело

更新获取商品排序返回

Yangzw 1 місяць тому
батько
коміт
469eca596d

+ 11 - 1
feifan-module-mall/feifan-module-product-biz/src/main/java/cn/newfeifan/mall/module/product/controller/app/spu/AppProductSpuController.java

@@ -8,6 +8,7 @@ import cn.newfeifan.mall.module.member.api.level.MemberLevelApi;
 import cn.newfeifan.mall.module.member.api.level.dto.MemberLevelRespDTO;
 import cn.newfeifan.mall.module.member.api.user.MemberUserApi;
 import cn.newfeifan.mall.module.member.api.user.dto.MemberUserRespDTO;
+import cn.newfeifan.mall.module.product.controller.admin.spu.vo.ProductSpuRespVO;
 import cn.newfeifan.mall.module.product.controller.app.spu.vo.AppProductSpuDetailRespVO;
 import cn.newfeifan.mall.module.product.controller.app.spu.vo.AppProductSpuPageReqVO;
 import cn.newfeifan.mall.module.product.controller.app.spu.vo.AppProductSpuRespVO;
@@ -29,6 +30,7 @@ import org.springframework.web.bind.annotation.RestController;
 
 import javax.annotation.Resource;
 import javax.validation.Valid;
+import java.util.ArrayList;
 import java.util.Collections;
 import java.util.List;
 import java.util.Set;
@@ -74,7 +76,15 @@ public class AppProductSpuController {
         // 处理 vip 价格
         MemberLevelRespDTO memberLevel = getMemberLevel();
         voList.forEach(vo -> vo.setVipPrice(calculateVipPrice(vo.getPrice(), memberLevel)));
-        return success(voList);
+        List<AppProductSpuRespVO> list2 = new ArrayList<>();
+        for (Long spuId : ids) {
+            for (AppProductSpuRespVO vo : voList) {
+                if(spuId.equals(vo.getId())){
+                    list2.add(vo);
+                }
+            }
+        }
+        return success(list2);
     }
 
     @GetMapping("/page")