图片安全内容检测接口java调用出现47001?
发布于 7 年前 作者 mengwei 4638 次浏览 来自 官方Issues
	// 腾讯API检测涉黄

	CloseableHttpClient httpclient = HttpClients.createDefault();

	CloseableHttpResponse response = null;

	String appId = ResourceUtil.getConfigByName("wx.appId");

	String appSecret = ResourceUtil.getConfigByName("wx.secret");

	String accessToken = WX\_TokenUtil.getWXToken(appId, appSecret).getAccessToken();

	HttpPost request = new HttpPost("<a href='https://api.weixin.qq.com/wxa/msg_sec_check?access_token="' rel="noopener noreferrer" target="_blank">https://api.weixin.qq.com/wxa/msg\_sec\_check?access\_token="</a> + accessToken);

	request.addHeader("Content-Type", "application/octet-stream");

	try {

		byte\[\] buffer = file.getBytes();

		request.setEntity(new ByteArrayEntity(buffer, ContentType.create("image/jpg")));

		response = httpclient.execute(request);

		HttpEntity entity = response.getEntity();

		String result = EntityUtils.toString(entity, "UTF-8");// 转成string

		JSONObject obj1 = JSONObject.parseObject(result);

		int errorcode = (int) obj1.get("errcode");

		if (errorcode != 0) {

			return "error1";

 

	} catch (Exception e) {

		System.out.println("错误");

	代码一直提示47001问题,有没有好点的解决方案
回到顶部