kira 6 years ago
parent 2416999408
commit 052fce1894

@ -4,7 +4,7 @@ package au.com.royalpay.payment.manage.openim.beans;
* @author kira * @author kira
* @date 2018/7/11 * @date 2018/7/11
*/ */
public class AddUser { public class OpenimUser {
private String nick; private String nick;
private String icon_url; private String icon_url;
private String email; private String email;
@ -18,7 +18,7 @@ public class AddUser {
private String vip; private String vip;
private String address; private String address;
private String name; private String name;
private int age; private Integer age;
private String gender; private String gender;
private String wechat; private String wechat;
private String qq; private String qq;

@ -0,0 +1,48 @@
package au.com.royalpay.payment.manage.openim.beans;
import java.util.List;
/**
* @author kira
* @date 2018/7/11
*/
public class PushMsgBean {
private String from_user;
private List<String> to_users;
private String summary;
private String data;
public String getFrom_user() {
return from_user;
}
public void setFrom_user(String from_user) {
this.from_user = from_user;
}
public List<String> getTo_users() {
return to_users;
}
public void setTo_users(List<String> to_users) {
this.to_users = to_users;
}
public String getSummary() {
return summary;
}
public void setSummary(String summary) {
this.summary = summary;
}
public String getData() {
return data;
}
public void setData(String data) {
this.data = data;
}
}

@ -1,5 +1,7 @@
package au.com.royalpay.payment.manage.openim.core; package au.com.royalpay.payment.manage.openim.core;
import au.com.royalpay.payment.manage.openim.beans.OpenimUser;
import com.taobao.api.ApiException; import com.taobao.api.ApiException;
import com.taobao.api.DefaultTaobaoClient; import com.taobao.api.DefaultTaobaoClient;
import com.taobao.api.TaobaoClient; import com.taobao.api.TaobaoClient;
@ -32,10 +34,11 @@ public class OpenimClient {
private final String secret = "7639427973bd671be15c9d0c1e9c90b4"; private final String secret = "7639427973bd671be15c9d0c1e9c90b4";
private final String url = "https://eco.taobao.com/router/rest"; private final String url = "https://eco.taobao.com/router/rest";
public void getUser(){ public void getUser(String userId){
TaobaoClient client = new DefaultTaobaoClient(url, appkey, secret); TaobaoClient client = new DefaultTaobaoClient(url, appkey, secret);
OpenimUsersGetRequest req = new OpenimUsersGetRequest(); OpenimUsersGetRequest req = new OpenimUsersGetRequest();
req.setUserids("imuser123456"); // 批量为userid逗号分隔字符串
req.setUserids(userId);
OpenimUsersGetResponse rsp = null; OpenimUsersGetResponse rsp = null;
try { try {
rsp = client.execute(req); rsp = client.execute(req);
@ -47,7 +50,7 @@ public class OpenimClient {
public void addUser() { public void addUser(OpenimUser user) {
TaobaoClient client = new DefaultTaobaoClient(url, appkey, secret); TaobaoClient client = new DefaultTaobaoClient(url, appkey, secret);
OpenimUsersAddRequest req = new OpenimUsersAddRequest(); OpenimUsersAddRequest req = new OpenimUsersAddRequest();
List<Userinfos> list2 = new ArrayList<>(); List<Userinfos> list2 = new ArrayList<>();
@ -67,7 +70,7 @@ public class OpenimClient {
System.out.println(rsp.getBody()); System.out.println(rsp.getBody());
} }
public void updateUser() { public void updateUser(List<Userinfos> users) {
TaobaoClient client = new DefaultTaobaoClient(url, appkey, secret); TaobaoClient client = new DefaultTaobaoClient(url, appkey, secret);
OpenimUsersUpdateRequest req = new OpenimUsersUpdateRequest(); OpenimUsersUpdateRequest req = new OpenimUsersUpdateRequest();
List<Userinfos> list2 = new ArrayList<Userinfos>(); List<Userinfos> list2 = new ArrayList<Userinfos>();
@ -125,10 +128,8 @@ public class OpenimClient {
System.out.println(rsp.getBody()); System.out.println(rsp.getBody());
} }
public static void main(String[] args) { public static void main(String[] args) {
OpenimClient asd = new OpenimClient(); OpenimClient asd = new OpenimClient();
asd.addUser(); asd.getUser("imuser123456");
asd.getUser();
} }
} }

Loading…
Cancel
Save