|
@@ -168,21 +168,25 @@ public class AigcServiceImpl implements AigcService {
|
|
|
if (StringUtils.isEmpty(coverUrl) || StringUtils.isEmpty(publishContentId)) {
|
|
|
return null;
|
|
|
}
|
|
|
- String apiUrl = "http://aigc-api.cybertogether.net/aigc//publish/LongArticleSystem/uploadMiniprogramCover";
|
|
|
- try {
|
|
|
- JSONObject param = new JSONObject();
|
|
|
- param.put("coverUrl", coverUrl);
|
|
|
- param.put("publishContentId", publishContentId);
|
|
|
- String res = HTTP_POOL_CLIENT_UTIL_DEFAULT.post(apiUrl, JSONObject.toJSONString(param));
|
|
|
- JSONObject jsonObject = JSON.parseObject(res);
|
|
|
- Integer code = jsonObject.getInteger("code");
|
|
|
- if (code == 0) {
|
|
|
- JSONObject data = jsonObject.getJSONObject("data");
|
|
|
- return data.getString("wxUrl");
|
|
|
+ int retey = 0;
|
|
|
+ while (retey < 3) {
|
|
|
+ String apiUrl = "http://aigc-api.cybertogether.net/aigc//publish/LongArticleSystem/uploadMiniprogramCover";
|
|
|
+ try {
|
|
|
+ JSONObject param = new JSONObject();
|
|
|
+ param.put("coverUrl", coverUrl);
|
|
|
+ param.put("publishContentId", publishContentId);
|
|
|
+ log.info("pushCover param={}", param);
|
|
|
+ String res = HTTP_POOL_CLIENT_UTIL_DEFAULT.post(apiUrl, JSONObject.toJSONString(param));
|
|
|
+ JSONObject jsonObject = JSON.parseObject(res);
|
|
|
+ Integer code = jsonObject.getInteger("code");
|
|
|
+ if (code == 0) {
|
|
|
+ JSONObject data = jsonObject.getJSONObject("data");
|
|
|
+ return data.getString("wxUrl");
|
|
|
+ }
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.error("pushCover error", e);
|
|
|
}
|
|
|
- return null;
|
|
|
- } catch (Exception e) {
|
|
|
- log.error("pushCover error", e);
|
|
|
+ retey++;
|
|
|
}
|
|
|
return null;
|
|
|
}
|