|
|
@@ -38,6 +38,7 @@ import chanjarster.weixin.util.http.MediaUploadRequestExecutor; |
|
|
|
import chanjarster.weixin.util.http.RequestExecutor; |
|
|
|
import chanjarster.weixin.util.http.SimpleGetRequestExecutor; |
|
|
|
import chanjarster.weixin.util.http.SimplePostRequestExecutor; |
|
|
|
import chanjarster.weixin.util.json.GsonHelper; |
|
|
|
import chanjarster.weixin.util.json.WxGsonBuilder; |
|
|
|
|
|
|
|
import com.google.gson.JsonElement; |
|
|
@@ -210,6 +211,13 @@ public class WxServiceImpl implements WxService { |
|
|
|
return WxGsonBuilder.INSTANCE.create().fromJson(tmpJsonElement.getAsJsonObject().get("groups"), new TypeToken<List<WxGroup>>(){}.getType()); |
|
|
|
} |
|
|
|
|
|
|
|
public long groupQueryUserGroup(String openid) throws WxErrorException { |
|
|
|
String url = "https://api.weixin.qq.com/cgi-bin/groups/getid"; |
|
|
|
String responseContent = execute(new SimplePostRequestExecutor(), url, MessageFormat.format("'{'\"openid\":\"{0}\"}", openid)); |
|
|
|
JsonElement tmpJsonElement = Streams.parse(new JsonReader(new StringReader(responseContent))); |
|
|
|
return GsonHelper.getAsLong(tmpJsonElement.getAsJsonObject().get("groupid")); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 向微信端发送请求,在这里执行的策略是当发生access_token过期时才去刷新,然后重新执行请求,而不是全局定时请求 |
|
|
|
* @param executor |
|
|
|