|
@ -0,0 +1,27 @@
|
|
|
package com.yihu.wlyy.util;
|
|
|
|
|
|
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.apache.http.NameValuePair;
|
|
|
import org.apache.http.message.BasicNameValuePair;
|
|
|
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.List;
|
|
|
|
|
|
public class SendP2PUtil {
|
|
|
public static String sendP2Pmsg(String from,String to,String contentType,String content){
|
|
|
String url = SystemConf.getInstance().getSystemProperties().getProperty("im_list_get")
|
|
|
+ "api/v1/chats/pm";
|
|
|
List<NameValuePair> params = new ArrayList<>();
|
|
|
params.add(new BasicNameValuePair("from", from));
|
|
|
params.add(new BasicNameValuePair("to", to));
|
|
|
params.add(new BasicNameValuePair("content", content));
|
|
|
params.add(new BasicNameValuePair("contentType",contentType));
|
|
|
String response = HttpClientUtil.post(url, params, "UTF-8");
|
|
|
if (StringUtils.isEmpty(response)) {
|
|
|
return "-1";
|
|
|
}else{
|
|
|
return "200";
|
|
|
}
|
|
|
}
|
|
|
}
|