Ver código fonte

1.速卖通sdk api对接 权限问题测试

dev
ldj 8 meses atrás
pai
commit
3d1ffb2c1a
4 arquivos alterados com 113 adições e 1 exclusões
  1. +1
    -1
      ruoyi-admin/src/main/java/com/ruoyi/web/controller/aliexpress/AliexpressCategoryController.java
  2. +69
    -0
      ruoyi-admin/src/main/java/com/ruoyi/web/controller/aliexpress/AliexpressGlobalCategoryController.java
  3. +20
    -0
      ruoyi-admin/src/main/java/com/ruoyi/web/controller/aliexpress/dto/globalcategory/GlobalCategoryTreeListDTO.java
  4. +23
    -0
      ruoyi-admin/src/main/java/com/ruoyi/web/enumerate/AliexpressGlobalCategoryEnu.java

+ 1
- 1
ruoyi-admin/src/main/java/com/ruoyi/web/controller/aliexpress/AliexpressCategoryController.java Ver arquivo

@@ -408,7 +408,7 @@ Thread.sleep(10);
request.addApiParameter("only_with_permission", reqDto.getOnly_with_permission());
request.addApiParameter("channel", reqDto.getChannel());
request.addApiParameter("category_id", reqDto.getCategory_id());
IopResponse response = client.execute(request, Protocol.TOP);
IopResponse response = client.execute(request,reqDto.getAccessToken(), Protocol.TOP);
return response.getGopResponseBody();
}
}

+ 69
- 0
ruoyi-admin/src/main/java/com/ruoyi/web/controller/aliexpress/AliexpressGlobalCategoryController.java Ver arquivo

@@ -0,0 +1,69 @@
package com.ruoyi.web.controller.aliexpress;

import com.global.iop.api.IopClient;
import com.global.iop.api.IopClientImpl;
import com.global.iop.api.IopRequest;
import com.global.iop.api.IopResponse;
import com.global.iop.domain.Protocol;
import com.global.iop.util.ApiException;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.web.controller.aliexpress.dto.category.CategoryGetPropValueFeatureDTO;
import com.ruoyi.web.controller.aliexpress.dto.globalcategory.GlobalCategoryTreeListDTO;
import com.ruoyi.web.core.config.AliexpressAuthClientConfig;
import com.ruoyi.web.enumerate.AliexpressCategoryEnu;
import com.ruoyi.web.enumerate.AliexpressGlobalCategoryEnu;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
* @author ldj
* @date 2024/3/1 14:36
* @Description: ...
* @Version 1.0
*/
@RestController
@Api("对接速卖通 类目")
@RequestMapping("/aliexpress/global/category")
public class AliexpressGlobalCategoryController {

@Resource
private AliexpressAuthClientConfig AliexpressAuthClientConfig;

//统一类目树查询
//描述:获取商家有发布权限的统一类目树
/*
IopClient client = new IopClient(url, appkey, appSecret);
IopRequest request = new IopRequest();
request.setApiName("global.category.tree.list");
request.setHttpMethod("GET");
request.addApiParameter("locale", "en_US");
request.addApiParameter("category_id", "10001");
IopResponse response = client.execute(request, accessToken, Protocol.TOP);
System.out.println(response.getBody());
Thread.sleep(10);
*/

/**
* 统一类目树查询
*/
@Log(title = "统一类目树查询", businessType = BusinessType.SELECT)
@ApiOperation("统一类目树查询")
@PostMapping("/globalCategoryTreeList")
public String globalCategoryTreeList(@RequestBody GlobalCategoryTreeListDTO reqDto) throws ApiException {
IopClient client = new IopClientImpl(AliexpressAuthClientConfig.getUrl(), AliexpressAuthClientConfig.getAppKey(), AliexpressAuthClientConfig.getAppSecret());
IopRequest request = new IopRequest();
request.setApiName(AliexpressGlobalCategoryEnu.GLOBAL_CATEGORY_TREE_LIST.getApiName());
request.setHttpMethod("GET");
request.addApiParameter("locale", reqDto.getLocale());
request.addApiParameter("category_id", reqDto.getCategory_id());
IopResponse response = client.execute(request, reqDto.getAccessToken(), Protocol.TOP);
return response.getGopResponseBody();
}
}

+ 20
- 0
ruoyi-admin/src/main/java/com/ruoyi/web/controller/aliexpress/dto/globalcategory/GlobalCategoryTreeListDTO.java Ver arquivo

@@ -0,0 +1,20 @@
package com.ruoyi.web.controller.aliexpress.dto.globalcategory;

import com.ruoyi.web.core.config.AliexpressAuth;
import lombok.Getter;
import lombok.Setter;

/**
* @author ldj
* @date 2024/3/1 14:39
* @Description: ...
* @Version 1.0
*/
@Getter
@Setter
public class GlobalCategoryTreeListDTO extends AliexpressAuth {
//request.addApiParameter("locale", "en_US");
//request.addApiParameter("category_id", "10001");
private String locale;
private String category_id;
}

+ 23
- 0
ruoyi-admin/src/main/java/com/ruoyi/web/enumerate/AliexpressGlobalCategoryEnu.java Ver arquivo

@@ -0,0 +1,23 @@
package com.ruoyi.web.enumerate;

/**
* @author ldj
* @date 2024/3/1 14:35
* @Description: ...
* @Version 1.0
*/
public enum AliexpressGlobalCategoryEnu {
//request.setApiName("global.category.tree.list");
//
GLOBAL_CATEGORY_TREE_LIST("global.category.tree.list");

private final String apiName;

AliexpressGlobalCategoryEnu(String apiName) {
this.apiName = apiName;
}

public String getApiName() {
return this.apiName;
}
}

Carregando…
Cancelar
Salvar