Commit 2f52bd75 by 吕明尚

去掉抖音权限过期错误自动获取权限

parent fe1d8cb0
......@@ -155,10 +155,10 @@ public class TiktokServiceImpl implements TiktokService {
}
JSONObject entries = new JSONObject(result);
JSONObject data = entries.getJSONObject("data");
if (data.getStr("error_code").equals(ErrorCodeEnum.ACCESS_TOKEN_INVALID.getCode()) | data.getStr("error_code").equals(ErrorCodeEnum.ACCESS_TOKEN_EXPIRE.getCode())) {
clientToken();
prepare(tiktokCouponDto);
}
// if (data.getStr("error_code").equals(ErrorCodeEnum.ACCESS_TOKEN_INVALID.getCode()) | data.getStr("error_code").equals(ErrorCodeEnum.ACCESS_TOKEN_EXPIRE.getCode())) {
// clientToken();
// prepare(tiktokCouponDto);
// }
if (!data.getStr("error_code").equals(ErrorCodeEnum.SUCCESS.getCode())) {
logger.error("抖音验券准备失败:{}", data.getStr("description"));
throw new RuntimeException(data.getStr("description"));
......@@ -181,10 +181,10 @@ public class TiktokServiceImpl implements TiktokService {
.body(jsonObject.toString()).execute().body();
JSONObject entries = new JSONObject(result);
JSONObject data = entries.getJSONObject("data");
if (data.getStr("error_code").equals(ErrorCodeEnum.ACCESS_TOKEN_INVALID.getCode()) | data.getStr("error_code").equals(ErrorCodeEnum.ACCESS_TOKEN_EXPIRE.getCode())) {
clientToken();
verify(tiktokCouponDto);
}
// if (data.getStr("error_code").equals(ErrorCodeEnum.ACCESS_TOKEN_INVALID.getCode()) | data.getStr("error_code").equals(ErrorCodeEnum.ACCESS_TOKEN_EXPIRE.getCode())) {
// clientToken();
// verify(tiktokCouponDto);
// }
JSONObject extra = entries.getJSONObject("extra");
if (data.getStr("error_code").equals(ErrorCodeEnum.SUCCESS.getCode()) && ((JSONObject) data.getJSONArray("verify_results").get(0)).getStr("result").equals(ErrorCodeEnum.SUCCESS.getCode())) {
return data;
......@@ -210,10 +210,10 @@ public class TiktokServiceImpl implements TiktokService {
.body(jsonObject.toString()).execute().body();
JSONObject entries = new JSONObject(result);
JSONObject data = entries.getJSONObject("data");
if (data.getStr("error_code").equals(ErrorCodeEnum.ACCESS_TOKEN_INVALID.getCode()) | data.getStr("error_code").equals(ErrorCodeEnum.ACCESS_TOKEN_EXPIRE.getCode())) {
clientToken();
cancel(tiktokCouponDto);
}
// if (data.getStr("error_code").equals(ErrorCodeEnum.ACCESS_TOKEN_INVALID.getCode()) | data.getStr("error_code").equals(ErrorCodeEnum.ACCESS_TOKEN_EXPIRE.getCode())) {
// clientToken();
// cancel(tiktokCouponDto);
// }
if (!data.getStr("error_code").equals(ErrorCodeEnum.SUCCESS.getCode())) {
logger.error("抖音撤销核销失败:{}", data.getStr("description"));
throw new RuntimeException(data.getStr("description"));
......@@ -237,10 +237,10 @@ public class TiktokServiceImpl implements TiktokService {
.form("encrypted_code", encode).execute().body();
JSONObject entries = new JSONObject(result);
JSONObject data = entries.getJSONObject("data");
if (data.getStr("error_code").equals(ErrorCodeEnum.ACCESS_TOKEN_INVALID.getCode()) | data.getStr("error_code").equals(ErrorCodeEnum.ACCESS_TOKEN_EXPIRE.getCode())) {
clientToken();
certificateGet(encryptedCode);
}
// if (data.getStr("error_code").equals(ErrorCodeEnum.ACCESS_TOKEN_INVALID.getCode()) | data.getStr("error_code").equals(ErrorCodeEnum.ACCESS_TOKEN_EXPIRE.getCode())) {
// clientToken();
// certificateGet(encryptedCode);
// }
if (!data.getStr("error_code").equals(ErrorCodeEnum.SUCCESS.getCode())) {
logger.error("抖音获取核销信息失败:{}", data.getStr("description"));
throw new BaseException(data.getStr("description"));
......@@ -261,10 +261,10 @@ public class TiktokServiceImpl implements TiktokService {
.execute().body();
JSONObject entries = new JSONObject(result);
JSONObject data = entries.getJSONObject("data");
if (data.getStr("error_code").equals(ErrorCodeEnum.ACCESS_TOKEN_INVALID.getCode()) | data.getStr("error_code").equals(ErrorCodeEnum.ACCESS_TOKEN_EXPIRE.getCode())) {
clientToken();
poiQuery(tiktokCouponDto);
}
// if (data.getStr("error_code").equals(ErrorCodeEnum.ACCESS_TOKEN_INVALID.getCode()) | data.getStr("error_code").equals(ErrorCodeEnum.ACCESS_TOKEN_EXPIRE.getCode())) {
// clientToken();
// poiQuery(tiktokCouponDto);
// }
if (!data.getStr("error_code").equals(ErrorCodeEnum.SUCCESS.getCode())) {
throw new RuntimeException(data.getStr("description"));
}
......@@ -298,10 +298,10 @@ public class TiktokServiceImpl implements TiktokService {
.execute().body();
JSONObject entries = new JSONObject(result);
JSONObject data = entries.getJSONObject("data");
if (data.getStr("error_code").equals(ErrorCodeEnum.ACCESS_TOKEN_INVALID.getCode()) | data.getStr("error_code").equals(ErrorCodeEnum.ACCESS_TOKEN_EXPIRE.getCode())) {
clientToken();
onlineQuery(onlineQueryDto);
}
// if (data.getStr("error_code").equals(ErrorCodeEnum.ACCESS_TOKEN_INVALID.getCode()) | data.getStr("error_code").equals(ErrorCodeEnum.ACCESS_TOKEN_EXPIRE.getCode())) {
// clientToken();
// onlineQuery(onlineQueryDto);
// }
if (!data.getStr("error_code").equals(ErrorCodeEnum.SUCCESS.getCode())) {
throw new RuntimeException(data.getStr("description"));
}
......@@ -319,10 +319,10 @@ public class TiktokServiceImpl implements TiktokService {
.execute().body();
JSONObject entries = new JSONObject(result);
JSONObject data = entries.getJSONObject("data");
if (data.getStr("error_code").equals(ErrorCodeEnum.ACCESS_TOKEN_INVALID.getCode()) | data.getStr("error_code").equals(ErrorCodeEnum.ACCESS_TOKEN_EXPIRE.getCode())) {
clientToken();
onlineGet(productIds, accountId);
}
// if (data.getStr("error_code").equals(ErrorCodeEnum.ACCESS_TOKEN_INVALID.getCode()) | data.getStr("error_code").equals(ErrorCodeEnum.ACCESS_TOKEN_EXPIRE.getCode())) {
// clientToken();
// onlineGet(productIds, accountId);
// }
return data;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment