master
kira 6 years ago
parent 59bb6d7160
commit 2416999408

@ -0,0 +1,170 @@
package au.com.royalpay.payment.manage.openim.beans;
/**
* @author kira
* @date 2018/7/11
*/
public class AddUser {
private String nick;
private String icon_url;
private String email;
private String mobile;
private String taobaoid;
private String userid;
private String passowrd;
private String remark;
private String extra;
private String career;
private String vip;
private String address;
private String name;
private int age;
private String gender;
private String wechat;
private String qq;
private String weibo;
public String getNick() {
return nick;
}
public void setNick(String nick) {
this.nick = nick;
}
public String getIcon_url() {
return icon_url;
}
public void setIcon_url(String icon_url) {
this.icon_url = icon_url;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public String getMobile() {
return mobile;
}
public void setMobile(String mobile) {
this.mobile = mobile;
}
public String getTaobaoid() {
return taobaoid;
}
public void setTaobaoid(String taobaoid) {
this.taobaoid = taobaoid;
}
public String getUserid() {
return userid;
}
public void setUserid(String userid) {
this.userid = userid;
}
public String getPassowrd() {
return passowrd;
}
public void setPassowrd(String passowrd) {
this.passowrd = passowrd;
}
public String getRemark() {
return remark;
}
public void setRemark(String remark) {
this.remark = remark;
}
public String getExtra() {
return extra;
}
public void setExtra(String extra) {
this.extra = extra;
}
public String getCareer() {
return career;
}
public void setCareer(String career) {
this.career = career;
}
public String getVip() {
return vip;
}
public void setVip(String vip) {
this.vip = vip;
}
public String getAddress() {
return address;
}
public void setAddress(String address) {
this.address = address;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public int getAge() {
return age;
}
public void setAge(int age) {
this.age = age;
}
public String getGender() {
return gender;
}
public void setGender(String gender) {
this.gender = gender;
}
public String getWechat() {
return wechat;
}
public void setWechat(String wechat) {
this.wechat = wechat;
}
public String getQq() {
return qq;
}
public void setQq(String qq) {
this.qq = qq;
}
public String getWeibo() {
return weibo;
}
public void setWeibo(String weibo) {
this.weibo = weibo;
}
}

@ -6,9 +6,11 @@ import com.taobao.api.TaobaoClient;
import com.taobao.api.domain.Userinfos;
import com.taobao.api.request.OpenimCustmsgPushRequest;
import com.taobao.api.request.OpenimUsersAddRequest;
import com.taobao.api.request.OpenimUsersGetRequest;
import com.taobao.api.request.OpenimUsersUpdateRequest;
import com.taobao.api.response.OpenimCustmsgPushResponse;
import com.taobao.api.response.OpenimUsersAddResponse;
import com.taobao.api.response.OpenimUsersGetResponse;
import com.taobao.api.response.OpenimUsersUpdateResponse;
import org.slf4j.Logger;
@ -30,30 +32,31 @@ public class OpenimClient {
private final String secret = "7639427973bd671be15c9d0c1e9c90b4";
private final String url = "https://eco.taobao.com/router/rest";
public void getUser(){
TaobaoClient client = new DefaultTaobaoClient(url, appkey, secret);
OpenimUsersGetRequest req = new OpenimUsersGetRequest();
req.setUserids("imuser123456");
OpenimUsersGetResponse rsp = null;
try {
rsp = client.execute(req);
} catch (ApiException e) {
logger.info("openim get user fail", e);
}
System.out.println(rsp.getBody());
}
public void addUser() {
TaobaoClient client = new DefaultTaobaoClient(url, appkey, secret);
OpenimUsersAddRequest req = new OpenimUsersAddRequest();
List<Userinfos> list2 = new ArrayList<>();
Userinfos obj3 = new Userinfos();
list2.add(obj3);
obj3.setNick("king");
obj3.setIconUrl("http://xxx.com/xxx");
obj3.setEmail("uid@taobao.com");
obj3.setMobile("18600000000");
obj3.setTaobaoid("tbnick123");
obj3.setUserid("imuser123");
obj3.setUserid("imuser123456");
obj3.setPassword("xxxxxx");
obj3.setRemark("demo");
obj3.setExtra("{}");
obj3.setCareer("demo");
obj3.setVip("{}");
obj3.setAddress("demo");
obj3.setName("demo");
obj3.setAge(123L);
obj3.setGender("M");
obj3.setWechat("demo");
obj3.setQq("demo");
obj3.setWeibo("demo");
req.setUserinfos(list2);
OpenimUsersAddResponse rsp = null;
try {
@ -75,7 +78,7 @@ public class OpenimClient {
obj3.setEmail("uid@taobao.com");
obj3.setMobile("18600000000");
obj3.setTaobaoid("tbnick123");
obj3.setUserid("imuser123");
obj3.setUserid("imuser12345");
obj3.setPassword("xxxxxx");
obj3.setRemark("demo");
obj3.setExtra("{}");
@ -122,4 +125,10 @@ public class OpenimClient {
System.out.println(rsp.getBody());
}
public static void main(String[] args) {
OpenimClient asd = new OpenimClient();
asd.addUser();
asd.getUser();
}
}

@ -6,5 +6,5 @@ import au.com.royalpay.payment.manage.openim.core.OpenimApi;
* @author kira
* @date 2018/7/11
*/
public class OpenimApiImpl implements OpenimApi{
public class OpenimApiImpl implements OpenimApi {
}

Loading…
Cancel
Save