kira 6 years ago
parent 2416999408
commit 052fce1894

@ -4,7 +4,7 @@ package au.com.royalpay.payment.manage.openim.beans;
* @author kira
* @date 2018/7/11
*/
public class AddUser {
public class OpenimUser {
private String nick;
private String icon_url;
private String email;
@ -18,7 +18,7 @@ public class AddUser {
private String vip;
private String address;
private String name;
private int age;
private Integer age;
private String gender;
private String wechat;
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;
import au.com.royalpay.payment.manage.openim.beans.OpenimUser;
import com.taobao.api.ApiException;
import com.taobao.api.DefaultTaobaoClient;
import com.taobao.api.TaobaoClient;
@ -32,10 +34,11 @@ public class OpenimClient {
private final String secret = "7639427973bd671be15c9d0c1e9c90b4";
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);
OpenimUsersGetRequest req = new OpenimUsersGetRequest();
req.setUserids("imuser123456");
// 批量为userid逗号分隔字符串
req.setUserids(userId);
OpenimUsersGetResponse rsp = null;
try {
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);
OpenimUsersAddRequest req = new OpenimUsersAddRequest();
List<Userinfos> list2 = new ArrayList<>();
@ -67,7 +70,7 @@ public class OpenimClient {
System.out.println(rsp.getBody());
}
public void updateUser() {
public void updateUser(List<Userinfos> users) {
TaobaoClient client = new DefaultTaobaoClient(url, appkey, secret);
OpenimUsersUpdateRequest req = new OpenimUsersUpdateRequest();
List<Userinfos> list2 = new ArrayList<Userinfos>();
@ -125,10 +128,8 @@ public class OpenimClient {
System.out.println(rsp.getBody());
}
public static void main(String[] args) {
OpenimClient asd = new OpenimClient();
asd.addUser();
asd.getUser();
asd.getUser("imuser123456");
}
}

Loading…
Cancel
Save