| | |
| | | package com.yeshi.fanli.controller.h5;
|
| | |
|
| | | import java.io.PrintWriter;
|
| | | import java.util.List;
|
| | |
|
| | | import javax.annotation.Resource;
|
| | |
|
| | | import org.springframework.stereotype.Controller;
|
| | | import org.springframework.web.bind.annotation.RequestMapping;
|
| | | import org.springframework.web.bind.annotation.RequestMethod;
|
| | | import org.yeshi.utils.JsonUtil;
|
| | |
|
| | | import com.yeshi.fanli.entity.accept.AcceptData;
|
| | | import com.yeshi.fanli.service.inter.pdd.PDDGoodsService;
|
| | |
|
| | | @Controller
|
| | | @RequestMapping("api/h5/v1/pddgoods")
|
| | | public class H5PDDGoodsController {
|
| | |
|
| | | @Resource
|
| | | private PDDGoodsService pddGoodsService;
|
| | |
|
| | | /**
|
| | | * 获取拼多多的图文详情
|
| | | * |
| | | * @param acceptData
|
| | | * @param callback
|
| | | * @param id
|
| | | * @param out
|
| | | */
|
| | | @RequestMapping(value = "getImageList", method = RequestMethod.GET)
|
| | | public void getCouponList(AcceptData acceptData, String callback, Long id, PrintWriter out) {
|
| | | if (id == null || id == 0) {
|
| | | out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadFalseResult("请上传商品ID")));
|
| | | return;
|
| | | }
|
| | | List<String> list = pddGoodsService.getDetailImageList(id);
|
| | | out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadTrueResult(list)));
|
| | | }
|
| | |
|
| | | }
|
| | | package com.yeshi.fanli.controller.h5; |
| | | |
| | | import java.io.PrintWriter; |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | | |
| | | import javax.annotation.Resource; |
| | | |
| | | import com.yeshi.fanli.dto.pdd.PDDGoodsDetail; |
| | | import com.yeshi.fanli.entity.SystemEnum; |
| | | import com.yeshi.fanli.entity.SystemPIDInfo; |
| | | import com.yeshi.fanli.exception.pdd.PDDApiException; |
| | | import com.yeshi.fanli.service.manger.PIDManager; |
| | | import com.yeshi.fanli.util.Constant; |
| | | import com.yeshi.fanli.util.pinduoduo.PinDuoDuoApiUtil; |
| | | import org.springframework.stereotype.Controller; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RequestMethod; |
| | | import org.yeshi.utils.JsonUtil; |
| | | |
| | | import com.yeshi.fanli.entity.accept.AcceptData; |
| | | import com.yeshi.fanli.service.inter.pdd.PDDGoodsService; |
| | | |
| | | @Controller |
| | | @RequestMapping("api/h5/v1/pddgoods") |
| | | public class H5PDDGoodsController { |
| | | |
| | | @Resource |
| | | private PDDGoodsService pddGoodsService; |
| | | |
| | | |
| | | @Resource |
| | | private PIDManager pidManager; |
| | | |
| | | /** |
| | | * 获取拼多多的图文详情 |
| | | * |
| | | * @param acceptData |
| | | * @param callback |
| | | * @param id |
| | | * @param out |
| | | */ |
| | | @RequestMapping(value = "getImageList", method = RequestMethod.GET) |
| | | public void getCouponList(AcceptData acceptData, String callback, String id, PrintWriter out) { |
| | | if (id == null ) { |
| | | out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadFalseResult("请上传商品ID"))); |
| | | return; |
| | | } |
| | | |
| | | PDDGoodsDetail pddGoods = null; |
| | | try { |
| | | pddGoods = PinDuoDuoApiUtil.getGoodsDetail(id, pidManager.getPidCache(SystemEnum.blks, Constant.SOURCE_TYPE_PDD, SystemPIDInfo.PidType.fanli), Constant.PDD_SEARCH_CUSTOMER_PARAMS); |
| | | } catch (PDDApiException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | if (pddGoods != null) { |
| | | out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadTrueResult(Arrays.asList(pddGoods.getGoodsGalleryUrls())))); |
| | | } |
| | | |
| | | } |
| | | |
| | | } |