Commit d5d03481 by 王祖波

文案

parent 232e0f1d
...@@ -541,6 +541,9 @@ public class MaterialApiServiceImpl implements MaterialApiService { ...@@ -541,6 +541,9 @@ public class MaterialApiServiceImpl implements MaterialApiService {
return jr; return jr;
}); });
json = future.get(); json = future.get();
if (json == null) {
return com.gic.api.base.commons.ServiceResponse.failure("9999", "获取图片失败,请稍后再试");
}
if (json.getErrorCode() == 0) { if (json.getErrorCode() == 0) {
String mediaId= json.getResult().toString() ; String mediaId= json.getResult().toString() ;
RedisUtil.setCache(key, mediaId, 1L, TimeUnit.DAYS); RedisUtil.setCache(key, mediaId, 1L, TimeUnit.DAYS);
...@@ -550,7 +553,7 @@ public class MaterialApiServiceImpl implements MaterialApiService { ...@@ -550,7 +553,7 @@ public class MaterialApiServiceImpl implements MaterialApiService {
} }
} catch (Exception e) { } catch (Exception e) {
logger.info("获取素材id失败", e); logger.info("获取素材id失败", e);
return com.gic.api.base.commons.ServiceResponse.failure("9999", "获取图片,请稍后再试"); return com.gic.api.base.commons.ServiceResponse.failure("9999", "获取图片失败,请稍后再试");
} }
} }
} }
...@@ -61,6 +61,7 @@ public class QWmediaTest { ...@@ -61,6 +61,7 @@ public class QWmediaTest {
jo.put("showStyle", "0"); jo.put("showStyle", "0");
jo.put("lineOne", "门店CCA"); jo.put("lineOne", "门店CCA");
jo.put("lineTwo", "宇智222为您推荐"); jo.put("lineTwo", "宇智222为您推荐");
jo.put("mediaType", 1);
ExecutorService executorService = Executors.newFixedThreadPool(50); // 创建线程池 ExecutorService executorService = Executors.newFixedThreadPool(50); // 创建线程池
Semaphore semaphore = new Semaphore(50); // 限制并发请求数为50 Semaphore semaphore = new Semaphore(50); // 限制并发请求数为50
...@@ -71,7 +72,7 @@ public class QWmediaTest { ...@@ -71,7 +72,7 @@ public class QWmediaTest {
AtomicLong minTime = new AtomicLong(Long.MAX_VALUE); AtomicLong minTime = new AtomicLong(Long.MAX_VALUE);
for (int i = 0; i < TOTAL_REQUESTS; i++) { for (int i = 0; i < TOTAL_REQUESTS; i++) {
final int requestId = i + 200; final int requestId = i;
executorService.submit(() -> { executorService.submit(() -> {
long startTime = System.currentTimeMillis(); long startTime = System.currentTimeMillis();
try { try {
......
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