|
|
@@ -186,9 +186,9 @@ public class BytedanceProductUpdateServiceImpl implements IBytedanceProductUpdat
|
|
|
for (AigcProductAlbum album : toUpload){
|
|
|
JSONObject defaultTheme = JSONObject.parseObject("{\"first_type_id\":\"2038\",\"first_type_name\":\"单剧目-短剧\",\"second_type_id\":\"203807\",\"second_type_name\":\"其他剧情\",\"third_type_name\":\"其他\",\"third_type_id\":\"20380701\"}");
|
|
|
uploadProduct(platform, album, null, errors, defaultTheme, businessType);
|
|
|
- try {
|
|
|
- Thread.sleep(80);
|
|
|
- }catch (InterruptedException ignored){}
|
|
|
+// try {
|
|
|
+// Thread.sleep(80);
|
|
|
+// }catch (InterruptedException ignored){}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
@@ -470,14 +470,28 @@ public class BytedanceProductUpdateServiceImpl implements IBytedanceProductUpdat
|
|
|
// System.out.println("请求地址:" + url);
|
|
|
// System.out.println("请求头:" + headers);
|
|
|
// System.out.println("请求参数:" + request.toJSONString());
|
|
|
- String res = HttpUtils.httpPostRequest(url, request, headers);
|
|
|
- JSONObject btRes = JSONObject.parseObject(res);
|
|
|
-// System.out.println(btRes.toJSONString());
|
|
|
- int code = btRes.getIntValue("code");
|
|
|
- if (code != 0){
|
|
|
- String payName = businessType==BusinessType.IAP?"付费":"免费";
|
|
|
- errorBlanket.add("上传"+payName+"商品失败,code: " + code + ", msg: " + btRes.getString("message")+", 关联剧目: " + album.getName());
|
|
|
+ //重试3次
|
|
|
+ for (int retry = 0; retry < 3; retry++) {
|
|
|
+ String res = HttpUtils.httpPostRequest(url, request, headers);
|
|
|
+ JSONObject btRes = JSONObject.parseObject(res);
|
|
|
+ int code = btRes.getIntValue("code");
|
|
|
+ if (code != 0){
|
|
|
+ String errorMessage = btRes.getString("message");
|
|
|
+ if (errorMessage.contains("系统请求频率超限") && retry < 2){
|
|
|
+ try {
|
|
|
+ Thread.sleep(100);
|
|
|
+ }catch (InterruptedException ignored){}
|
|
|
+ continue;
|
|
|
+ }else {
|
|
|
+ String payName = businessType==BusinessType.IAP?"付费":"免费";
|
|
|
+ errorBlanket.add("上传"+payName+"商品失败,code: [" + code + "], msg: [" + errorMessage +"], 关联剧目: " + album.getName());
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }else {
|
|
|
+ break;
|
|
|
+ }
|
|
|
}
|
|
|
+
|
|
|
}
|
|
|
|
|
|
/**
|