parent
9b7e268788
commit
0c76b953a6
@ -0,0 +1,66 @@
|
||||
package au.com.royalpay.payment.manage.openim.core;
|
||||
|
||||
import com.taobao.api.ApiException;
|
||||
import com.taobao.api.DefaultTaobaoClient;
|
||||
import com.taobao.api.TaobaoClient;
|
||||
import com.taobao.api.domain.Userinfos;
|
||||
import com.taobao.api.request.OpenimUsersAddRequest;
|
||||
import com.taobao.api.response.OpenimUsersAddResponse;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author kira
|
||||
* @date 2018/7/11
|
||||
*/
|
||||
@Service
|
||||
public class OpenimClient {
|
||||
Logger logger = LoggerFactory.getLogger(getClass());
|
||||
private final String appkey = "24960261";
|
||||
private final String secret = "7639427973bd671be15c9d0c1e9c90b4";
|
||||
private final String add_user="https://eco.taobao.com/router/rest";
|
||||
|
||||
public void addUser(){
|
||||
TaobaoClient client = new DefaultTaobaoClient(add_user, 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.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 {
|
||||
rsp = client.execute(req);
|
||||
} catch (ApiException e) {
|
||||
logger.info("openim add user fail",e);
|
||||
}
|
||||
System.out.println(rsp.getBody());
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
OpenimClient asd = new OpenimClient();
|
||||
asd.addUser();
|
||||
}
|
||||
}
|
@ -0,0 +1,5 @@
|
||||
/**
|
||||
* @author kira
|
||||
* @date 2018/7/11
|
||||
*/
|
||||
package au.com.royalpay.payment.manage.openim;
|
Loading…
Reference in new issue