From 052fce1894202e1c10ca9753376d7ffebf371de3 Mon Sep 17 00:00:00 2001 From: kira <164851225@qq.com> Date: Wed, 11 Jul 2018 15:05:21 +0800 Subject: [PATCH] tmp --- .../beans/{AddUser.java => OpenimUser.java} | 4 +- .../manage/openim/beans/PushMsgBean.java | 48 +++++++++++++++++++ .../manage/openim/core/OpenimClient.java | 15 +++--- 3 files changed, 58 insertions(+), 9 deletions(-) rename src/main/java/au/com/royalpay/payment/manage/openim/beans/{AddUser.java => OpenimUser.java} (98%) create mode 100644 src/main/java/au/com/royalpay/payment/manage/openim/beans/PushMsgBean.java diff --git a/src/main/java/au/com/royalpay/payment/manage/openim/beans/AddUser.java b/src/main/java/au/com/royalpay/payment/manage/openim/beans/OpenimUser.java similarity index 98% rename from src/main/java/au/com/royalpay/payment/manage/openim/beans/AddUser.java rename to src/main/java/au/com/royalpay/payment/manage/openim/beans/OpenimUser.java index 3c5204c9f..52162d649 100644 --- a/src/main/java/au/com/royalpay/payment/manage/openim/beans/AddUser.java +++ b/src/main/java/au/com/royalpay/payment/manage/openim/beans/OpenimUser.java @@ -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; diff --git a/src/main/java/au/com/royalpay/payment/manage/openim/beans/PushMsgBean.java b/src/main/java/au/com/royalpay/payment/manage/openim/beans/PushMsgBean.java new file mode 100644 index 000000000..314dd3ebd --- /dev/null +++ b/src/main/java/au/com/royalpay/payment/manage/openim/beans/PushMsgBean.java @@ -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 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 getTo_users() { + return to_users; + } + + public void setTo_users(List 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; + } +} diff --git a/src/main/java/au/com/royalpay/payment/manage/openim/core/OpenimClient.java b/src/main/java/au/com/royalpay/payment/manage/openim/core/OpenimClient.java index 89d46636e..92d3cfd6a 100644 --- a/src/main/java/au/com/royalpay/payment/manage/openim/core/OpenimClient.java +++ b/src/main/java/au/com/royalpay/payment/manage/openim/core/OpenimClient.java @@ -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 list2 = new ArrayList<>(); @@ -67,7 +70,7 @@ public class OpenimClient { System.out.println(rsp.getBody()); } - public void updateUser() { + public void updateUser(List users) { TaobaoClient client = new DefaultTaobaoClient(url, appkey, secret); OpenimUsersUpdateRequest req = new OpenimUsersUpdateRequest(); List list2 = new ArrayList(); @@ -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"); } }