@@ -50,7 +50,7 @@ public class WxCpConsts { | |||||
public static final String MEDIA_IMAGE = "image"; | public static final String MEDIA_IMAGE = "image"; | ||||
public static final String MEDIA_VOICE = "voice"; | public static final String MEDIA_VOICE = "voice"; | ||||
public static final String MEDIA_VIDEO = "video"; | public static final String MEDIA_VIDEO = "video"; | ||||
public static final String MEDIA_THUMB = "thumb"; | |||||
public static final String MEDIA_FILE = "file"; | |||||
/////////////////////// | /////////////////////// | ||||
// 文件类型 | // 文件类型 | ||||
@@ -137,12 +137,12 @@ public class WxCpServiceImpl implements WxCpService { | |||||
} | } | ||||
public WxMediaUploadResult mediaUpload(String mediaType, File file) throws WxErrorException { | public WxMediaUploadResult mediaUpload(String mediaType, File file) throws WxErrorException { | ||||
String url = "http://file.api.weixin.qq.com/cgi-bin/media/upload?type=" + mediaType; | |||||
String url = "https://qyapi.weixin.qq.com/cgi-bin/media/upload?type=" + mediaType; | |||||
return execute(new MediaUploadRequestExecutor(), url, file); | return execute(new MediaUploadRequestExecutor(), url, file); | ||||
} | } | ||||
public File mediaDownload(String media_id) throws WxErrorException { | public File mediaDownload(String media_id) throws WxErrorException { | ||||
String url = "http://file.api.weixin.qq.com/cgi-bin/media/get"; | |||||
String url = "https://qyapi.weixin.qq.com/cgi-bin/media/get"; | |||||
return execute(new MediaDownloadRequestExecutor(), url, "media_id=" + media_id); | return execute(new MediaDownloadRequestExecutor(), url, "media_id=" + media_id); | ||||
} | } | ||||
@@ -20,9 +20,10 @@ import com.google.inject.Inject; | |||||
* @author Daniel Qian | * @author Daniel Qian | ||||
* | * | ||||
*/ | */ | ||||
@Test(groups="mediaAPI", dependsOnGroups="baseAPI") | |||||
//@Test(groups="mediaAPI", dependsOnGroups="baseAPI") | |||||
@Test | |||||
@Guice(modules = ApiTestModule.class) | @Guice(modules = ApiTestModule.class) | ||||
public class WxMediaAPITest { | |||||
public class WxCpMediaAPITest { | |||||
@Inject | @Inject | ||||
protected WxCpServiceImpl wxService; | protected WxCpServiceImpl wxService; | ||||
@@ -51,7 +52,7 @@ public class WxMediaAPITest { | |||||
new Object[] { WxCpConsts.MEDIA_IMAGE, WxCpConsts.FILE_JPG, "mm.jpeg" }, | new Object[] { WxCpConsts.MEDIA_IMAGE, WxCpConsts.FILE_JPG, "mm.jpeg" }, | ||||
new Object[] { WxCpConsts.MEDIA_VOICE, WxCpConsts.FILE_MP3, "mm.mp3" }, | new Object[] { WxCpConsts.MEDIA_VOICE, WxCpConsts.FILE_MP3, "mm.mp3" }, | ||||
new Object[] { WxCpConsts.MEDIA_VIDEO, WxCpConsts.FILE_MP4, "mm.mp4" }, | new Object[] { WxCpConsts.MEDIA_VIDEO, WxCpConsts.FILE_MP4, "mm.mp4" }, | ||||
new Object[] { WxCpConsts.MEDIA_THUMB, WxCpConsts.FILE_JPG, "mm.jpeg" } | |||||
new Object[] { WxCpConsts.MEDIA_FILE, WxCpConsts.FILE_JPG, "mm.jpeg" } | |||||
}; | }; | ||||
} | } | ||||
@@ -7,7 +7,7 @@ | |||||
<class name="me.chanjar.weixin.enterprise.api.WxCpMessageAPITest" /> | <class name="me.chanjar.weixin.enterprise.api.WxCpMessageAPITest" /> | ||||
<class name="me.chanjar.weixin.enterprise.api.WxCpMenuAPITest" /> | <class name="me.chanjar.weixin.enterprise.api.WxCpMenuAPITest" /> | ||||
<class name="me.chanjar.weixin.enterprise.api.WxGroupAPITest" /> | <class name="me.chanjar.weixin.enterprise.api.WxGroupAPITest" /> | ||||
<class name="me.chanjar.weixin.enterprise.api.WxMediaAPITest" /> | |||||
<class name="me.chanjar.weixin.enterprise.api.WxCpMediaAPITest" /> | |||||
<class name="me.chanjar.weixin.enterprise.api.WxCpMessageRouterTest" /> | <class name="me.chanjar.weixin.enterprise.api.WxCpMessageRouterTest" /> | ||||
</classes> | </classes> | ||||
</test> | </test> | ||||