private static final Logger log = LoggerFactory.getLogger(WebSettingTest.class);
/**
* 上传频道所有装修图片素材
* @throws IOException
*/
@Test
public void testUploadImage() throws IOException, NoSuchAlgorithmException {
//公共参数,填写自己的实际参数
String appId=super.appId;
String appSecret=super.appSecret;
String userId = super.userId;
String timestamp=String.valueOf(System.currentTimeMillis());
//业务参数
String url = "http://api.polyv.net/live/v3/common/upload-image";
String type = "logoImage";
List<File> fileList = new ArrayList<>();
String path1 = getClass().getResource("/file/").getPath() + "dog.jpeg";
String path2 = getClass().getResource("/file/").getPath() + "222.jpeg";
File file = new File(path1);
File file2 = new File(path2);
fileList.add(file);
fileList.add(file2);
//http 调用逻辑
Map<String,String> requestMap = new HashMap<>();
requestMap.put("appId", appId);
requestMap.put("timestamp",timestamp);
Map<String, List<File>> fileListMap = new HashMap<>();
fileListMap.put("file",fileList);
requestMap.put("type",type);
requestMap.put("sign",LiveSignUtil.getSign(requestMap, appSecret));
String response = HttpUtil.postMultipleFile(url,requestMap,fileListMap,"utf-8");
log.info("测试上传频道所有装修图片素材:{}",response);
//do somethings
}