master
parent
8e3c3f451c
commit
50272e4e06
@ -0,0 +1,115 @@ |
||||
package com.hfkj.controller; |
||||
|
||||
import com.alibaba.fastjson.JSONObject; |
||||
import com.hfkj.common.exception.ErrorCode; |
||||
import com.hfkj.common.exception.ErrorHelp; |
||||
import com.hfkj.common.exception.SysCode; |
||||
import com.hfkj.common.utils.ResponseMsgUtil; |
||||
import com.hfkj.model.*; |
||||
import com.hfkj.service.goods.GoodsDataService; |
||||
import com.hfkj.service.pdd.PddService; |
||||
import com.hfkj.service.taobao.TaoBaoService; |
||||
import io.swagger.annotations.Api; |
||||
import io.swagger.annotations.ApiOperation; |
||||
import org.slf4j.Logger; |
||||
import org.slf4j.LoggerFactory; |
||||
import org.springframework.stereotype.Controller; |
||||
import org.springframework.web.bind.annotation.RequestMapping; |
||||
import org.springframework.web.bind.annotation.RequestMethod; |
||||
import org.springframework.web.bind.annotation.RequestParam; |
||||
import org.springframework.web.bind.annotation.ResponseBody; |
||||
|
||||
import javax.annotation.Resource; |
||||
import java.util.ArrayList; |
||||
import java.util.List; |
||||
|
||||
@Controller |
||||
@RequestMapping(value="/goods") |
||||
@Api(value="商品") |
||||
public class GoodsController { |
||||
|
||||
private static Logger log = LoggerFactory.getLogger(GoodsController.class); |
||||
|
||||
@Resource |
||||
private GoodsDataService goodsDataService; |
||||
|
||||
@RequestMapping(value="/goodsList",method = RequestMethod.GET) |
||||
@ResponseBody |
||||
@ApiOperation(value = "查询商品列表") |
||||
public ResponseData goodsList(@RequestParam(value = "title" , required = false) String title, |
||||
@RequestParam(value = "type" , required = true) Integer type, |
||||
@RequestParam(value = "pageNo" , required = true) Long pageNo, |
||||
@RequestParam(value = "pageSize" , required = true) Long pageSize |
||||
) { |
||||
try { |
||||
|
||||
List<GoodsModel> goodsList = new ArrayList<>(); |
||||
|
||||
// 1:淘宝 2:拼多多
|
||||
if (type == 1) { |
||||
JSONObject jsonObject = TaoBaoService.material(title , pageNo , pageSize); |
||||
|
||||
if (!jsonObject.getBoolean("success")) { |
||||
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "请求失败!"); |
||||
} |
||||
|
||||
goodsList = goodsDataService.goodsModelTaoBaoList(jsonObject); |
||||
} else if (type == 2) { |
||||
if (pageSize < 10) { |
||||
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR , "pageSize的取值范围是10-100!"); |
||||
} |
||||
JSONObject jsonObject = PddService.syncInvoke(title , pageNo , pageSize); |
||||
return ResponseMsgUtil.success(jsonObject); |
||||
} else { |
||||
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR , "未知类型!"); |
||||
} |
||||
return ResponseMsgUtil.success(goodsList); |
||||
|
||||
|
||||
} catch (Exception e) { |
||||
log.error("error!",e); |
||||
return ResponseMsgUtil.exception(e); |
||||
} |
||||
} |
||||
|
||||
@RequestMapping(value="/createCommand",method = RequestMethod.GET) |
||||
@ResponseBody |
||||
@ApiOperation(value = "淘口令生成") |
||||
public ResponseData createCommand(@RequestParam(value = "url" , required = false) String url |
||||
) { |
||||
try { |
||||
|
||||
JSONObject jsonObject = TaoBaoService.createCommand("https:" + url); |
||||
|
||||
if (jsonObject.getBoolean("success")) { |
||||
return ResponseMsgUtil.success(jsonObject.getJSONObject("data")); |
||||
} else { |
||||
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "请求失败!"); |
||||
} |
||||
|
||||
} catch (Exception e) { |
||||
log.error("error!",e); |
||||
return ResponseMsgUtil.exception(e); |
||||
} |
||||
} |
||||
|
||||
@RequestMapping(value="/promotion",method = RequestMethod.GET) |
||||
@ResponseBody |
||||
@ApiOperation(value = "多多进宝推广链接生成") |
||||
public ResponseData promotion(@RequestParam(value = "searchId" , required = false) String searchId, |
||||
@RequestParam(value = "goodsSign" , required = false) String goodsSign |
||||
) { |
||||
try { |
||||
|
||||
JSONObject object = PddService.authority(); |
||||
boolean generateAuthorityUrl = object.getJSONObject("authorityQueryResponse").getInteger("bind") == 0; |
||||
|
||||
JSONObject jsonObject = PddService.promotion(searchId , goodsSign , generateAuthorityUrl); |
||||
return ResponseMsgUtil.success(jsonObject); |
||||
|
||||
} catch (Exception e) { |
||||
log.error("error!",e); |
||||
return ResponseMsgUtil.exception(e); |
||||
} |
||||
} |
||||
} |
@ -1,145 +0,0 @@ |
||||
package com.hfkj.controller; |
||||
|
||||
import com.alibaba.fastjson.JSONArray; |
||||
import com.alibaba.fastjson.JSONObject; |
||||
import com.hfkj.common.exception.ErrorCode; |
||||
import com.hfkj.common.exception.ErrorHelp; |
||||
import com.hfkj.common.exception.SysCode; |
||||
import com.hfkj.common.utils.ResponseMsgUtil; |
||||
import com.hfkj.model.*; |
||||
import com.hfkj.service.taobao.TaoBaoService; |
||||
import io.swagger.annotations.Api; |
||||
import io.swagger.annotations.ApiOperation; |
||||
import io.swagger.annotations.License; |
||||
import org.slf4j.Logger; |
||||
import org.slf4j.LoggerFactory; |
||||
import org.springframework.stereotype.Controller; |
||||
import org.springframework.web.bind.annotation.RequestMapping; |
||||
import org.springframework.web.bind.annotation.RequestMethod; |
||||
import org.springframework.web.bind.annotation.RequestParam; |
||||
import org.springframework.web.bind.annotation.ResponseBody; |
||||
|
||||
import java.math.BigDecimal; |
||||
import java.util.ArrayList; |
||||
import java.util.List; |
||||
|
||||
@Controller |
||||
@RequestMapping(value="/goods") |
||||
@Api(value="商品") |
||||
public class goodsController { |
||||
|
||||
private static Logger log = LoggerFactory.getLogger(goodsController.class); |
||||
|
||||
@RequestMapping(value="/goodsList",method = RequestMethod.GET) |
||||
@ResponseBody |
||||
@ApiOperation(value = "查询商品列表") |
||||
public ResponseData goodsList(@RequestParam(value = "title" , required = false) String title, |
||||
@RequestParam(value = "type" , required = true) Integer type, |
||||
@RequestParam(value = "pageNo" , required = false) Long pageNo, |
||||
@RequestParam(value = "pageSize" , required = false) Long pageSize |
||||
) { |
||||
try { |
||||
|
||||
// 定义数据列表
|
||||
List<GoodsModel> goodsModelList = new ArrayList<>(); |
||||
GoodsModel goodsModel; |
||||
// 淘客推广信息
|
||||
PublishInfoModel publishInfoModel; |
||||
// 价格促销信息
|
||||
PricePromotionInfoModel pricePromotionInfoModel; |
||||
// 基础信息
|
||||
GoodsInfoModel goodsInfoModel; |
||||
// 商品佣金信息
|
||||
IncomeInfoModel incomeInfoModel; |
||||
// 更多活动优惠
|
||||
MorePromotionListModel morePromotionListModel; |
||||
|
||||
// 1:淘宝 2:拼多多
|
||||
// if (type == 1) {
|
||||
// JSONObject jsonObject = TaoBaoService.material(title , pageNo , pageSize);
|
||||
//
|
||||
// if (jsonObject.getBoolean("success")) {
|
||||
// return ResponseMsgUtil.success(jsonObject.getJSONArray("result_list"));
|
||||
// } else {
|
||||
// throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "请求失败!");
|
||||
// }
|
||||
//
|
||||
// JSONArray data = jsonObject.getJSONArray("result_list");
|
||||
//
|
||||
// for (Object o : data) {
|
||||
// goodsModel = new GoodsModel();
|
||||
// JSONObject object = (JSONObject) o;
|
||||
// JSONObject publish_info = object.getJSONObject("publish_info");
|
||||
// JSONObject price_promotion_info = object.getJSONObject("price_promotion_info");
|
||||
// JSONObject item_basic_info = object.getJSONObject("item_basic_info");
|
||||
// JSONObject income_info = publish_info.getJSONObject("income_info");
|
||||
// JSONObject more_promotion_list = price_promotion_info.getJSONObject("more_promotion_list");
|
||||
// JSONObject final_promotion_path_list = price_promotion_info.getJSONObject("final_promotion_path_list");
|
||||
//
|
||||
// // 淘客推广信息
|
||||
// // 商品佣金信息
|
||||
// incomeInfoModel = new IncomeInfoModel();
|
||||
// publishInfoModel = new PublishInfoModel();
|
||||
// publishInfoModel.setClickUrl(publish_info.getString("click_url"));
|
||||
// publishInfoModel.setCouponShareUrl(publish_info.getString("coupon_share_url"));
|
||||
// incomeInfoModel.setCommissionAmount(income_info.getBigDecimal("commission_amount"));
|
||||
// incomeInfoModel.setCommissionRate(income_info.getString("commission_rate"));
|
||||
// // 插入商品佣金信息
|
||||
// publishInfoModel.setIncomeInfo(incomeInfoModel);
|
||||
// // 插入淘客推广信息
|
||||
// goodsModel.setPublishInfo(publishInfoModel);
|
||||
// // 商品基础信息
|
||||
// goodsInfoModel = new GoodsInfoModel();
|
||||
// goodsInfoModel.setIngot(incomeInfoModel.getCommissionAmount().multiply(new BigDecimal(100)));
|
||||
// goodsInfoModel.setProvCity(item_basic_info.getString("prov_city"));
|
||||
// goodsInfoModel.setTitle(item_basic_info.getString("title"));
|
||||
// goodsInfoModel.setPictUrl(item_basic_info.getString("pict_url"));
|
||||
// goodsInfoModel.setShortTitle(item_basic_info.getString("short_title"));
|
||||
// String small_images = item_basic_info.getJSONArray("small_images").toString();
|
||||
// goodsInfoModel.setSmallImages(JSONObject.parseArray(small_images,String.class));
|
||||
// goodsInfoModel.setShopTitle(item_basic_info.getString("shop_title"));
|
||||
// // 插入商品基础信息
|
||||
// goodsModel.setGoodsInfo(goodsInfoModel);
|
||||
// // 价格促销信息
|
||||
// pricePromotionInfoModel = new PricePromotionInfoModel();
|
||||
// pricePromotionInfoModel.setReservePrice(price_promotion_info.getBigDecimal("reserve_price"));
|
||||
// pricePromotionInfoModel.setZkFinalPrice(price_promotion_info.getBigDecimal("zk_final_price"));
|
||||
// pricePromotionInfoModel.setFinalPromotionPrice(price_promotion_info.getBigDecimal("final_promotion_price"));
|
||||
// // 更多活动优惠
|
||||
// morePromotionListModel = new MorePromotionListModel();
|
||||
// morePromotionListModel.setPromotionDesc(more_promotion_list.getString("promotion_desc"));
|
||||
// morePromotionListModel.setPromotionFee(final_promotion_path_list.getBigDecimal("promotion_fee"));
|
||||
// }
|
||||
//
|
||||
//
|
||||
// }
|
||||
return ResponseMsgUtil.success("121"); |
||||
|
||||
|
||||
} catch (Exception e) { |
||||
log.error("error!",e); |
||||
return ResponseMsgUtil.exception(e); |
||||
} |
||||
} |
||||
|
||||
@RequestMapping(value="/createCommand",method = RequestMethod.GET) |
||||
@ResponseBody |
||||
@ApiOperation(value = "淘口令生成 ") |
||||
public ResponseData createCommand(@RequestParam(value = "url" , required = false) String url |
||||
) { |
||||
try { |
||||
|
||||
JSONObject jsonObject = TaoBaoService.createCommand("https:" + url); |
||||
|
||||
if (jsonObject.getBoolean("success")) { |
||||
return ResponseMsgUtil.success(jsonObject.getJSONObject("data")); |
||||
} else { |
||||
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "请求失败!"); |
||||
} |
||||
|
||||
} catch (Exception e) { |
||||
log.error("error!",e); |
||||
return ResponseMsgUtil.exception(e); |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,25 @@ |
||||
package com.hfkj.service.goods; |
||||
|
||||
import com.alibaba.fastjson.JSONObject; |
||||
import com.hfkj.model.GoodsModel; |
||||
|
||||
import java.util.List; |
||||
|
||||
/** |
||||
* @ClassName GoodsDataService |
||||
* @Author Sum1Dream |
||||
* @Description 商户数据组装 |
||||
* @Date 2024/9/13 下午2:40 |
||||
**/ |
||||
public interface GoodsDataService { |
||||
|
||||
/** |
||||
* @MethodName goodsModelTaoBaoList |
||||
* @Description: 淘宝数据整理 |
||||
* @param jsonObject |
||||
* @return: java.util.List<com.hfkj.model.GoodsModel> |
||||
* @Author: Sum1Dream |
||||
* @Date: 2024/9/13 下午2:41 |
||||
*/ |
||||
List<GoodsModel> goodsModelTaoBaoList(JSONObject jsonObject); |
||||
} |
@ -0,0 +1,121 @@ |
||||
package com.hfkj.service.goods.impl; |
||||
|
||||
import com.alibaba.fastjson.JSONArray; |
||||
import com.alibaba.fastjson.JSONObject; |
||||
import com.hfkj.entity.SecDictionary; |
||||
import com.hfkj.model.*; |
||||
import com.hfkj.service.goods.GoodsDataService; |
||||
import com.hfkj.service.sec.SecDictionaryService; |
||||
import org.springframework.stereotype.Service; |
||||
|
||||
import javax.annotation.Resource; |
||||
import java.math.BigDecimal; |
||||
import java.util.ArrayList; |
||||
import java.util.List; |
||||
|
||||
@Service("goodsDataService") |
||||
public class GoodsDataServiceImpl implements GoodsDataService { |
||||
|
||||
@Resource |
||||
private SecDictionaryService secDictionaryService; |
||||
|
||||
@Override |
||||
public List<GoodsModel> goodsModelTaoBaoList(JSONObject jsonObject) { |
||||
|
||||
// 定义数据列表
|
||||
List<GoodsModel> goodsModelList = new ArrayList<>(); |
||||
GoodsModel goodsModel; |
||||
// 淘客推广信息
|
||||
PublishInfoModel publishInfoModel; |
||||
// 价格促销信息
|
||||
PricePromotionInfoModel pricePromotionInfoModel; |
||||
// 基础信息
|
||||
GoodsInfoModel goodsInfoModel; |
||||
// 商品佣金信息
|
||||
IncomeInfoModel incomeInfoModel; |
||||
// 更多活动优惠
|
||||
MorePromotionModel morePromotionModel; |
||||
List<MorePromotionModel> morePromotionModels; |
||||
// 获取元宝的汇率
|
||||
SecDictionary dictionary = secDictionaryService.findDictionary("GRADE_EXCHANGE_RATE"); |
||||
|
||||
JSONArray data = jsonObject.getJSONArray("result_list"); |
||||
|
||||
for (Object o : data) { |
||||
goodsModel = new GoodsModel(); |
||||
JSONObject object = (JSONObject) o; |
||||
JSONObject publish_info = object.getJSONObject("publish_info"); |
||||
JSONObject price_promotion_info = object.getJSONObject("price_promotion_info"); |
||||
JSONObject item_basic_info = object.getJSONObject("item_basic_info"); |
||||
JSONObject income_info = publish_info.getJSONObject("income_info"); |
||||
JSONArray more_promotion_list = price_promotion_info.getJSONArray("more_promotion_list"); |
||||
JSONArray final_promotion_path_list = price_promotion_info.getJSONArray("final_promotion_path_list"); |
||||
|
||||
// 淘客推广信息
|
||||
// 商品佣金信息
|
||||
incomeInfoModel = new IncomeInfoModel(); |
||||
publishInfoModel = new PublishInfoModel(); |
||||
publishInfoModel.setClickUrl(publish_info.getString("click_url")); |
||||
if (publish_info.getString("coupon_share_url") != null) { |
||||
publishInfoModel.setCouponShareUrl("https:" + publish_info.getString("coupon_share_url")); |
||||
} |
||||
incomeInfoModel.setCommissionAmount(income_info.getBigDecimal("commission_amount")); |
||||
incomeInfoModel.setCommissionRate(income_info.getString("commission_rate")); |
||||
// 插入商品佣金信息
|
||||
publishInfoModel.setIncomeInfo(incomeInfoModel); |
||||
// 插入淘客推广信息
|
||||
goodsModel.setPublishInfo(publishInfoModel); |
||||
// 商品基础信息
|
||||
goodsInfoModel = new GoodsInfoModel(); |
||||
goodsInfoModel.setIngot(incomeInfoModel.getCommissionAmount().multiply(new BigDecimal(dictionary.getCodeValue()))); |
||||
goodsInfoModel.setProvCity(item_basic_info.getString("prov_city")); |
||||
goodsInfoModel.setTitle(item_basic_info.getString("title")); |
||||
goodsInfoModel.setPictUrl(item_basic_info.getString("pict_url")); |
||||
goodsInfoModel.setShortTitle(item_basic_info.getString("short_title")); |
||||
String small_images = item_basic_info.getJSONArray("small_images").toString(); |
||||
goodsInfoModel.setSmallImages(JSONObject.parseArray(small_images,String.class)); |
||||
goodsInfoModel.setShopTitle(item_basic_info.getString("shop_title")); |
||||
// 插入商品基础信息
|
||||
goodsModel.setGoodsInfo(goodsInfoModel); |
||||
// 价格促销信息
|
||||
pricePromotionInfoModel = new PricePromotionInfoModel(); |
||||
pricePromotionInfoModel.setReservePrice(price_promotion_info.getBigDecimal("reserve_price")); |
||||
pricePromotionInfoModel.setZkFinalPrice(price_promotion_info.getBigDecimal("zk_final_price")); |
||||
pricePromotionInfoModel.setFinalPromotionPrice(price_promotion_info.getBigDecimal("final_promotion_price")); |
||||
// 更多活动优惠
|
||||
morePromotionModels = new ArrayList<>(); |
||||
if (more_promotion_list != null && !more_promotion_list.isEmpty()) { |
||||
for (Object more_promotion : more_promotion_list) { |
||||
JSONObject morePromotion = (JSONObject) more_promotion; |
||||
morePromotionModel = new MorePromotionModel(); |
||||
morePromotionModel.setPromotionDesc(morePromotion.getString("promotion_desc")); |
||||
morePromotionModel.setPromotionTitle(morePromotion.getString("promotion_title")); |
||||
morePromotionModel.setPromotionStartTime(morePromotion.getString("promotion_start_time")); |
||||
morePromotionModel.setPromotionEndTime(morePromotion.getString("promotion_end_time")); |
||||
morePromotionModel.setPromotionId(morePromotion.getString("promotion_id")); |
||||
morePromotionModels.add(morePromotionModel); |
||||
} |
||||
} |
||||
if (final_promotion_path_list != null && !final_promotion_path_list.isEmpty()) { |
||||
for (Object final_promotion : final_promotion_path_list) { |
||||
JSONObject morePromotion = (JSONObject) final_promotion; |
||||
morePromotionModel = new MorePromotionModel(); |
||||
morePromotionModel.setPromotionDesc(morePromotion.getString("promotion_desc")); |
||||
morePromotionModel.setPromotionTitle(morePromotion.getString("promotion_title")); |
||||
morePromotionModel.setPromotionFee(morePromotion.getBigDecimal("promotion_fee")); |
||||
morePromotionModel.setPromotionStartTime(morePromotion.getString("promotion_start_time")); |
||||
morePromotionModel.setPromotionEndTime(morePromotion.getString("promotion_end_time")); |
||||
morePromotionModel.setPromotionId(morePromotion.getString("promotion_id")); |
||||
morePromotionModels.add(morePromotionModel); |
||||
|
||||
} |
||||
} |
||||
// 插入更多活动优惠
|
||||
pricePromotionInfoModel.setMorePromotionList(morePromotionModels); |
||||
goodsModel.setPricePromotionInfo(pricePromotionInfoModel); |
||||
goodsModelList.add(goodsModel); |
||||
} |
||||
|
||||
return goodsModelList; |
||||
} |
||||
} |
@ -1,79 +1,111 @@ |
||||
package com.hfkj.service.pdd; |
||||
|
||||
import com.alibaba.fastjson.JSON; |
||||
import com.alibaba.fastjson.JSONObject; |
||||
import com.pdd.pop.sdk.common.util.JsonUtil; |
||||
import com.pdd.pop.sdk.http.PopClient; |
||||
import com.pdd.pop.sdk.http.PopHttpClient; |
||||
import com.pdd.pop.sdk.http.api.pop.request.PddDdkGoodsPromotionUrlGenerateRequest; |
||||
import com.pdd.pop.sdk.http.api.pop.request.PddDdkGoodsSearchRequest; |
||||
import com.pdd.pop.sdk.http.api.pop.request.PddDdkMemberAuthorityQueryRequest; |
||||
import com.pdd.pop.sdk.http.api.pop.response.PddDdkGoodsPromotionUrlGenerateResponse; |
||||
import com.pdd.pop.sdk.http.api.pop.response.PddDdkGoodsSearchResponse; |
||||
|
||||
import com.pdd.pop.sdk.http.api.pop.response.PddDdkMemberAuthorityQueryResponse; |
||||
import org.slf4j.Logger; |
||||
import org.slf4j.LoggerFactory; |
||||
|
||||
import java.util.ArrayList; |
||||
import java.util.HashMap; |
||||
import java.util.List; |
||||
import java.util.Map; |
||||
|
||||
|
||||
public class PddService { |
||||
|
||||
private static Logger log = LoggerFactory.getLogger(PddService.class); |
||||
|
||||
public static String syncInvoke() throws Exception { |
||||
public static JSONObject syncInvoke(String title , Long pageNo , Long pageSize) throws Exception { |
||||
|
||||
log.info("============ 淘宝请求-START ============="); |
||||
log.info("============ 拼多多请求-START ============="); |
||||
String clientId = "71a050c5d93d4169a237539af44c7c33"; |
||||
String clientSecret = "b96def667dd28660d09f19ba2e9e9f23d810d563"; |
||||
PopClient client = new PopHttpClient(clientId, clientSecret); |
||||
PddDdkGoodsSearchRequest request = new PddDdkGoodsSearchRequest(); |
||||
List<Integer> activityTags = new ArrayList<Integer>(); |
||||
activityTags.add(0); |
||||
request.setActivityTags(activityTags); |
||||
List<Integer> blockCatPackages = new ArrayList<Integer>(); |
||||
blockCatPackages.add(0); |
||||
request.setBlockCatPackages(blockCatPackages); |
||||
List<Integer> blockCats = new ArrayList<Integer>(); |
||||
blockCats.add(0); |
||||
request.setBlockCats(blockCats); |
||||
request.setCatId(49L); |
||||
request.setCustomParameters("str"); |
||||
request.setGoodsImgType(1); |
||||
List<String> goodsSignList = new ArrayList<String>(); |
||||
goodsSignList.add("str"); |
||||
request.setGoodsSignList(goodsSignList); |
||||
request.setIsBrandGoods(true); |
||||
request.setKeyword("str"); |
||||
request.setListId("str"); |
||||
request.setMerchantType(1); |
||||
List<Integer> merchantTypeList = new ArrayList<Integer>(); |
||||
merchantTypeList.add(0); |
||||
request.setMerchantTypeList(merchantTypeList); |
||||
request.setOptId(49L); |
||||
request.setPage(1); |
||||
request.setPageSize(100); |
||||
request.setPid("str"); |
||||
List<PddDdkGoodsSearchRequest.RangeListItem> rangeList = new ArrayList<>(); |
||||
|
||||
PddDdkGoodsSearchRequest.RangeListItem item = new PddDdkGoodsSearchRequest.RangeListItem(); |
||||
item.setRangeFrom(0L); |
||||
item.setRangeId(0); |
||||
item.setRangeTo(0L); |
||||
rangeList.add(item); |
||||
request.setRangeList(rangeList); |
||||
|
||||
request.setKeyword(title); |
||||
|
||||
request.setPage(pageNo.intValue()); |
||||
request.setPageSize(pageSize.intValue()); |
||||
request.setSortType(0); |
||||
request.setUseCustomized(true); |
||||
request.setWithCoupon(true); |
||||
Map<String, String> riskParams = new HashMap<>(); |
||||
riskParams.put("", "str"); |
||||
request.setRiskParams(riskParams); |
||||
PddDdkGoodsSearchResponse response = client.syncInvoke(request); |
||||
|
||||
log.info("请求接口:" + "syncInvoke"); |
||||
log.info("请求参数:" + JSONObject.toJSONString(request)); |
||||
log.info("响应参数:" + JsonUtil.transferToJson(response)); |
||||
log.info("============ 拼多多请求-END =============="); |
||||
return JSONObject.parseObject(JSON.toJSONString(response)); |
||||
|
||||
} |
||||
|
||||
|
||||
/** |
||||
* @MethodName promotion |
||||
* @Description: 多多进宝推广链接生成 |
||||
* @param searchId |
||||
* @return: com.alibaba.fastjson.JSONObject |
||||
* @Author: Sum1Dream |
||||
* @Date: 2024/9/13 下午5:08 |
||||
*/ |
||||
public static JSONObject promotion(String searchId , String goodsSign , Boolean generateAuthorityUrl) throws Exception { |
||||
|
||||
log.info("============ 拼多多请求-START ============="); |
||||
String clientId = "71a050c5d93d4169a237539af44c7c33"; |
||||
String clientSecret = "b96def667dd28660d09f19ba2e9e9f23d810d563"; |
||||
PopClient client = new PopHttpClient(clientId, clientSecret); |
||||
|
||||
PddDdkGoodsPromotionUrlGenerateRequest request = new PddDdkGoodsPromotionUrlGenerateRequest(); |
||||
request.setPId("41483885_294044603"); |
||||
request.setSearchId(searchId); |
||||
List<String> goodsSignList = new ArrayList<>(); |
||||
goodsSignList.add(goodsSign); |
||||
request.setGoodsSignList(goodsSignList); |
||||
request.setGenerateAuthorityUrl(generateAuthorityUrl); |
||||
PddDdkGoodsPromotionUrlGenerateResponse response = client.syncInvoke(request); |
||||
|
||||
log.info("请求接口:" + "promotion"); |
||||
log.info("请求参数:" + JSONObject.toJSONString(request)); |
||||
log.info("响应参数:" + JsonUtil.transferToJson(response)); |
||||
log.info("============ 拼多多请求-END =============="); |
||||
return JSONObject.parseObject(JSON.toJSONString(response)); |
||||
|
||||
} |
||||
|
||||
/** |
||||
* @MethodName authority |
||||
* @Description: 查询是否绑定备案 |
||||
* @return: com.alibaba.fastjson.JSONObject |
||||
* @Author: Sum1Dream |
||||
* @Date: 2024/9/13 下午5:42 |
||||
*/ |
||||
public static JSONObject authority() throws Exception { |
||||
|
||||
log.info("============ 拼多多请求-START ============="); |
||||
String clientId = "71a050c5d93d4169a237539af44c7c33"; |
||||
String clientSecret = "b96def667dd28660d09f19ba2e9e9f23d810d563"; |
||||
PopClient client = new PopHttpClient(clientId, clientSecret); |
||||
|
||||
PddDdkMemberAuthorityQueryRequest request = new PddDdkMemberAuthorityQueryRequest(); |
||||
request.setPid("41483885_294044603"); |
||||
PddDdkMemberAuthorityQueryResponse response = client.syncInvoke(request); |
||||
|
||||
log.info("请求接口:" + "authority"); |
||||
log.info("请求参数:" + JSONObject.toJSONString(request)); |
||||
log.info("响应参数:" + JsonUtil.transferToJson(response)); |
||||
log.info("============ 淘宝请求-END =============="); |
||||
return JsonUtil.transferToJson(response); |
||||
log.info("============ 拼多多请求-END =============="); |
||||
return JSONObject.parseObject(JSON.toJSONString(response)); |
||||
|
||||
} |
||||
|
||||
|
||||
} |
||||
|
Loading…
Reference in new issue