mirror of
				https://gitee.com/binary/weixin-java-tools.git
				synced 2025-10-31 18:46:10 +08:00 
			
		
		
		
	🆕 #1686 微信公众号增加对话能力(原导购助手)部分接口,如添加顾问、获取顾问信息等
This commit is contained in:
		| @ -4,6 +4,7 @@ import com.google.gson.JsonObject; | ||||
| import me.chanjar.weixin.common.bean.ToJson; | ||||
| import me.chanjar.weixin.common.bean.WxJsapiSignature; | ||||
| import me.chanjar.weixin.common.error.WxErrorException; | ||||
| import me.chanjar.weixin.common.service.WxService; | ||||
| import me.chanjar.weixin.common.session.WxSession; | ||||
| import me.chanjar.weixin.common.session.WxSessionManager; | ||||
| import me.chanjar.weixin.common.util.http.MediaUploadRequestExecutor; | ||||
| @ -18,7 +19,7 @@ import me.chanjar.weixin.cp.config.WxCpConfigStorage; | ||||
|  * | ||||
|  * @author chanjaster | ||||
|  */ | ||||
| public interface WxCpService { | ||||
| public interface WxCpService extends WxService { | ||||
|   /** | ||||
|    * <pre> | ||||
|    * 验证推送过来的消息的正确性 | ||||
| @ -161,46 +162,6 @@ public interface WxCpService { | ||||
|    */ | ||||
|   WxCpProviderToken getProviderToken(String corpId, String providerSecret) throws WxErrorException; | ||||
|  | ||||
|   /** | ||||
|    * 当本Service没有实现某个API的时候,可以用这个,针对所有微信API中的GET请求 | ||||
|    * | ||||
|    * @param url        接口地址 | ||||
|    * @param queryParam 请求参数 | ||||
|    * @return the string | ||||
|    * @throws WxErrorException the wx error exception | ||||
|    */ | ||||
|   String get(String url, String queryParam) throws WxErrorException; | ||||
|  | ||||
|   /** | ||||
|    * 当本Service没有实现某个API的时候,可以用这个,针对所有微信API中的POST请求 | ||||
|    * | ||||
|    * @param url      接口地址 | ||||
|    * @param postData 请求body字符串 | ||||
|    * @return the string | ||||
|    * @throws WxErrorException the wx error exception | ||||
|    */ | ||||
|   String post(String url, String postData) throws WxErrorException; | ||||
|  | ||||
|   /** | ||||
|    * 内部使用. | ||||
|    * | ||||
|    * @param url        接口地址 | ||||
|    * @param jsonObject 请求body的json对象 | ||||
|    * @return the string | ||||
|    * @throws WxErrorException the wx error exception | ||||
|    */ | ||||
|   String post(String url, JsonObject jsonObject) throws WxErrorException; | ||||
|  | ||||
|   /** | ||||
|    * 内部使用. | ||||
|    * | ||||
|    * @param url 接口地址 | ||||
|    * @param obj 请求body的对象,实现了ToJson接口 | ||||
|    * @return the string | ||||
|    * @throws WxErrorException the wx error exception | ||||
|    */ | ||||
|   String post(String url, ToJson obj) throws WxErrorException; | ||||
|  | ||||
|   /** | ||||
|    * 当不需要自动带accessToken的时候,可以用这个发起post请求 | ||||
|    * | ||||
|  | ||||
| @ -222,6 +222,11 @@ public abstract class BaseWxCpServiceImpl<H, P> implements WxCpService, RequestH | ||||
|     return this.post(url, obj.toJson()); | ||||
|   } | ||||
|  | ||||
|   @Override | ||||
|   public String post(String url, Object obj) throws WxErrorException { | ||||
|     return this.post(url, obj.toString()); | ||||
|   } | ||||
|  | ||||
|   @Override | ||||
|   public String postWithoutToken(String url, String postData) throws WxErrorException { | ||||
|     return this.executeNormal(SimplePostRequestExecutor.create(this), url, postData); | ||||
| @ -319,7 +324,7 @@ public abstract class BaseWxCpServiceImpl<H, P> implements WxCpService, RequestH | ||||
|       return null; | ||||
|     } catch (IOException e) { | ||||
|       log.error("\n【请求地址】: {}\n【请求参数】:{}\n【异常信息】:{}", uri, data, e.getMessage()); | ||||
|       throw new WxErrorException(WxError.builder().errorMsg(e.getMessage()).errorCode(-1).build(), e); | ||||
|       throw new WxErrorException(e); | ||||
|     } | ||||
|   } | ||||
|  | ||||
|  | ||||
| @ -58,8 +58,7 @@ public class WxCpOaCalendarServiceImplTest { | ||||
|  | ||||
|   @Test | ||||
|   public void testGet() throws WxErrorException { | ||||
|     final List<WxCpOaCalendar> calendars = this.wxService.getOaCalendarService() | ||||
|       .get(Arrays.asList(calId)); | ||||
|     final List<WxCpOaCalendar> calendars = this.wxService.getOaCalendarService().get(Arrays.asList(calId)); | ||||
|     assertThat(calendars).isNotEmpty(); | ||||
|   } | ||||
|  | ||||
|  | ||||
		Reference in New Issue
	
	Block a user
	 Binary Wang
					Binary Wang