#708 企业微信增加获取高清语音素材接口
This commit is contained in:
@@ -19,6 +19,7 @@ public interface WxCpMediaService {
|
||||
String MEDIA_GET_URL = "https://qyapi.weixin.qq.com/cgi-bin/media/get";
|
||||
String MEDIA_UPLOAD_URL = "https://qyapi.weixin.qq.com/cgi-bin/media/upload?type=";
|
||||
String IMG_UPLOAD_URL = "https://qyapi.weixin.qq.com/cgi-bin/media/uploadimg";
|
||||
String JSSDK_MEDIA_GET_URL = "https://qyapi.weixin.qq.com/cgi-bin/media/get/jssdk";
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
@@ -59,6 +60,21 @@ public interface WxCpMediaService {
|
||||
*/
|
||||
File download(String mediaId) throws WxErrorException;
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* 获取高清语音素材.
|
||||
* 可以使用本接口获取从JSSDK的uploadVoice接口上传的临时语音素材,格式为speex,16K采样率。该音频比上文的临时素材获取接口(格式为amr,8K采样率)更加清晰,适合用作语音识别等对音质要求较高的业务。
|
||||
* 请求方式:GET(HTTPS)
|
||||
* 请求地址:https://qyapi.weixin.qq.com/cgi-bin/media/get/jssdk?access_token=ACCESS_TOKEN&media_id=MEDIA_ID
|
||||
* 仅企业微信2.4及以上版本支持。
|
||||
* 文档地址:https://work.weixin.qq.com/api/doc#90000/90135/90255
|
||||
* </pre>
|
||||
*
|
||||
* @param mediaId 媒体id
|
||||
* @return 保存到本地的临时文件
|
||||
*/
|
||||
File getJssdkFile(String mediaId) throws WxErrorException;
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* 上传图片.
|
||||
@@ -69,7 +85,7 @@ public interface WxCpMediaService {
|
||||
* </pre>
|
||||
*
|
||||
* @param file 上传的文件对象
|
||||
* @return 返回图片url
|
||||
* @return 返回图片url
|
||||
*/
|
||||
String uploadImg(File file) throws WxErrorException;
|
||||
}
|
||||
|
||||
@@ -48,6 +48,14 @@ public class WxCpMediaServiceImpl implements WxCpMediaService {
|
||||
MEDIA_GET_URL, "media_id=" + mediaId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public File getJssdkFile(String mediaId) throws WxErrorException {
|
||||
return this.mainService.execute(
|
||||
BaseMediaDownloadRequestExecutor.create(this.mainService.getRequestHttp(),
|
||||
this.mainService.getWxCpConfigStorage().getTmpDirFile()),
|
||||
JSSDK_MEDIA_GET_URL, "media_id=" + mediaId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String uploadImg(File file) throws WxErrorException {
|
||||
final WxMediaUploadResult result = this.mainService
|
||||
|
||||
Reference in New Issue
Block a user