mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-04-21 11:35:12 +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;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user