mirror of
https://gitee.com/binary/weixin-java-tools.git
synced 2025-09-24 04:53:50 +08:00
issue #2 设置用户备注名接口
This commit is contained in:
@@ -42,6 +42,7 @@ import chanjarster.weixin.util.json.GsonHelper;
|
||||
import chanjarster.weixin.util.json.WxGsonBuilder;
|
||||
|
||||
import com.google.gson.JsonElement;
|
||||
import com.google.gson.JsonObject;
|
||||
import com.google.gson.internal.Streams;
|
||||
import com.google.gson.reflect.TypeToken;
|
||||
import com.google.gson.stream.JsonReader;
|
||||
@@ -196,10 +197,15 @@ public class WxServiceImpl implements WxService {
|
||||
|
||||
public WxGroup groupCreate(String name) throws WxErrorException {
|
||||
String url = "https://api.weixin.qq.com/cgi-bin/groups/create";
|
||||
JsonObject json = new JsonObject();
|
||||
JsonObject groupJson = new JsonObject();
|
||||
json.add("group", groupJson);
|
||||
groupJson.addProperty("name", name);
|
||||
|
||||
String responseContent = execute(
|
||||
new SimplePostRequestExecutor(),
|
||||
url,
|
||||
MessageFormat.format("'{'\"group\":'{'\"name\":\"{0}\"}}", name));
|
||||
json.toString());
|
||||
return WxGroup.fromJson(responseContent);
|
||||
}
|
||||
|
||||
@@ -226,9 +232,20 @@ public class WxServiceImpl implements WxService {
|
||||
execute(new SimplePostRequestExecutor(), url, group.toJson());
|
||||
}
|
||||
|
||||
public void groupMoveUser(String openid, long to_groupid) throws WxErrorException {
|
||||
public void userUpdateGroup(String openid, long to_groupid) throws WxErrorException {
|
||||
String url = "https://api.weixin.qq.com/cgi-bin/groups/members/update";
|
||||
execute(new SimplePostRequestExecutor(), url, MessageFormat.format("'{'\"openid\":\"{0}\", \"to_groupid\":{1,number,#}}", openid, to_groupid));
|
||||
JsonObject json = new JsonObject();
|
||||
json.addProperty("openid", openid);
|
||||
json.addProperty("to_groupid", to_groupid);
|
||||
execute(new SimplePostRequestExecutor(), url, json.toString());
|
||||
}
|
||||
|
||||
public void userUpdateRemark(String openid, String remark) throws WxErrorException {
|
||||
String url = "https://api.weixin.qq.com/cgi-bin/user/info/updateremark";
|
||||
JsonObject json = new JsonObject();
|
||||
json.addProperty("openid", openid);
|
||||
json.addProperty("remark", remark);
|
||||
execute(new SimplePostRequestExecutor(), url, json.toString());
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user