mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-04-20 02:55:04 +08:00
update
This commit is contained in:
@@ -18,6 +18,7 @@ import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
@@ -282,7 +283,25 @@ public class AgentDevService {
|
||||
}
|
||||
|
||||
|
||||
|
||||
public List<CategoryInfo> getAllCategoryName(String authorizerAppid) {
|
||||
String redisKey = CacheConstants.AUTHORIZER_ACCESS_TOKEN + authorizerAppid;
|
||||
String authAccessToken = redisCache.getCacheObject(redisKey);
|
||||
if (StringUtils.isBlank(authAccessToken)) {
|
||||
throw new RuntimeException("微信第三方平台 获取类目名称信息 error: authAccessToken为空");
|
||||
}
|
||||
String url = "https://api.weixin.qq.com/wxa/get_category?access_token=" + authAccessToken;
|
||||
String result = HttpUtils.sendGet(url);
|
||||
logger.info("获取第三方平台 获取类目名称信息 请求结果:{}", result);
|
||||
// 将返回结果转为json对象
|
||||
JSONObject resultJson = JSONObject.parseObject(result);
|
||||
int errCode = (int) resultJson.get("errcode");
|
||||
if (errCode != 0) {
|
||||
// 不为 0 则说明有错误
|
||||
logger.error("获取第三方平台 获取类目名称信息 error:{}", resultJson.getString("errmsg"));
|
||||
return new ArrayList<>();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,49 @@
|
||||
package com.jsowell.pile.domain.agentDev;
|
||||
|
||||
import com.alibaba.fastjson2.annotation.JSONField;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 微信第三方平台 类目信息实体
|
||||
*
|
||||
* @author Lemon
|
||||
* @Date 2023/7/29 14:21
|
||||
*/
|
||||
@Data
|
||||
public class CategoryInfo {
|
||||
/**
|
||||
* 一级类目
|
||||
*/
|
||||
@JSONField(name = "first_class")
|
||||
private String firstClass;
|
||||
|
||||
/**
|
||||
* 二级类目
|
||||
*/
|
||||
@JSONField(name = "second_class")
|
||||
private String secondClass;
|
||||
|
||||
/**
|
||||
* 三级类目
|
||||
*/
|
||||
@JSONField(name = "third_class")
|
||||
private String thirdClass;
|
||||
|
||||
/**
|
||||
* 一级类目id
|
||||
*/
|
||||
@JSONField(name = "first_id")
|
||||
private String firstId;
|
||||
|
||||
/**
|
||||
* 二级类目id
|
||||
*/
|
||||
@JSONField(name = "second_id")
|
||||
private String secondId;
|
||||
|
||||
/**
|
||||
* 三级类目id
|
||||
*/
|
||||
@JSONField(name = "third_id")
|
||||
private String thirdId;
|
||||
}
|
||||
Reference in New Issue
Block a user