|
@ -7,8 +7,6 @@ import org.json.JSONObject;
|
|
|
* Created by 卓 on 2017/1/13.
|
|
|
*/
|
|
|
public class ImUtill {
|
|
|
// ===============================
|
|
|
private static String host = "http://192.168.131.107:3000";
|
|
|
/**
|
|
|
* 获取医生统计数据
|
|
|
* status reply 为空值是是该医生总咨询量
|
|
@ -19,8 +17,7 @@ public class ImUtill {
|
|
|
* @return
|
|
|
*/
|
|
|
public static String getConsultData(String user, Integer status, Integer reply) {
|
|
|
// String imAddr = SystemConf.getInstance().getImListGet() + "/api/v2/sessions/topics/count/reply";
|
|
|
String imAddr = host + "/api/v2/sessions/topics/count/reply";
|
|
|
String imAddr = SystemConf.getInstance().getImListGet() + "api/v2/sessions/topics/count/reply";
|
|
|
JSONObject params = new JSONObject();
|
|
|
params.put("user", user);
|
|
|
if (status!=null) {
|
|
@ -47,7 +44,7 @@ public class ImUtill {
|
|
|
* @return
|
|
|
*/
|
|
|
public static String getConsultByStatus(String user, Integer status, Integer reply, int page, int pagesize) {
|
|
|
String imAddr = host + "/api/v2/sessions/topics";
|
|
|
String imAddr = SystemConf.getInstance().getImListGet() + "api/v2/sessions/topics";
|
|
|
JSONObject params = new JSONObject();
|
|
|
params.put("user", user);
|
|
|
params.put("page", page);
|
|
@ -70,7 +67,7 @@ public class ImUtill {
|
|
|
* @param content 内容
|
|
|
*/
|
|
|
public static String sendImMsg(String from,String fromName, String sessionId, String contentType, String content,String businessType) {
|
|
|
String imAddr = SystemConf.getInstance().getImListGet() + "/api/v2/sessions/"+sessionId+"/messages";
|
|
|
String imAddr = SystemConf.getInstance().getImListGet() + "api/v2/sessions/"+sessionId+"/messages";
|
|
|
JSONObject params = new JSONObject();
|
|
|
params.put("sender_id", from);
|
|
|
params.put("sender_name", fromName);
|
|
@ -89,7 +86,7 @@ public class ImUtill {
|
|
|
* @param status 状态
|
|
|
*/
|
|
|
public static String updateSessionStatus(String sessionId,String status) {
|
|
|
String imAddr = SystemConf.getInstance().getImListGet() + "/api/v2/sessions/"+sessionId+"/status?status="+status+"&sessionId="+sessionId;
|
|
|
String imAddr = SystemConf.getInstance().getImListGet() + "api/v2/sessions/"+sessionId+"/status?status="+status+"&sessionId="+sessionId;
|
|
|
JSONObject params = new JSONObject();
|
|
|
String response = HttpClientUtil.postBody(imAddr, params);
|
|
|
return response;
|
|
@ -104,8 +101,7 @@ public class ImUtill {
|
|
|
* @param content 内容
|
|
|
*/
|
|
|
public static String sendTopicIM(String from,String fromName, String topicId, String contentType, String content) {
|
|
|
String url = SystemConf.getInstance().getSystemProperties().getProperty("im_list_get")
|
|
|
+ ("api/v2/sessions/topic/"+topicId+"/messages");
|
|
|
String url = SystemConf.getInstance().getImListGet() + "api/v2/sessions/topic/"+topicId+"/messages";
|
|
|
JSONObject params = new JSONObject();
|
|
|
params.put("sender_id", from);
|
|
|
params.put("sender_name", fromName);
|
|
@ -221,7 +217,7 @@ public class ImUtill {
|
|
|
}
|
|
|
|
|
|
public static JSONObject getTopicMessage(String topicId,String startMsgId,String endMsgId,int page,int pagesize,String uid){
|
|
|
String url = SystemConf.getInstance().getSystemProperties().getProperty("im_list_get")
|
|
|
String url = SystemConf.getInstance().getImListGet()
|
|
|
+ "api/v2/sessions/topic/"+topicId+"/messages?topic_id="+topicId+"&end="+startMsgId
|
|
|
+"&start="+(endMsgId==null?"":endMsgId)+"&page="+page+"&pagesize="+pagesize+"&user="+uid;
|
|
|
try{
|
|
@ -239,8 +235,7 @@ public class ImUtill {
|
|
|
}
|
|
|
|
|
|
public static JSONArray getSessionMessage(String sessionId,String startMsgId,String endMsgId,int page,int pagesize,String uid){
|
|
|
String url = SystemConf.getInstance().getSystemProperties().getProperty("im_list_get")
|
|
|
+ "api/v2/sessions/"+sessionId+"/messages?session_id="+sessionId+"&user="+uid+"&start_message_id="+startMsgId+"&end_message_id="+endMsgId+"&page="+page+"&pagesize="+pagesize;
|
|
|
String url = SystemConf.getInstance().getImListGet()+ "api/v2/sessions/"+sessionId+"/messages?session_id="+sessionId+"&user="+uid+"&start_message_id="+startMsgId+"&end_message_id="+endMsgId+"&page="+page+"&pagesize="+pagesize;
|
|
|
try{
|
|
|
String ret = HttpClientUtil.get(url, "UTF-8");
|
|
|
JSONArray obj = new JSONArray(ret);
|
|
@ -258,8 +253,7 @@ public class ImUtill {
|
|
|
* @return
|
|
|
*/
|
|
|
public static JSONObject deleteMucUser(String userId,String oldUserId,String sessionId) throws Exception{
|
|
|
String url = SystemConf.getInstance().getSystemProperties().getProperty("im_list_get")
|
|
|
+ "api/v2/sessions/"+sessionId+"/participant/update";
|
|
|
String url = SystemConf.getInstance().getImListGet()+ "api/v2/sessions/"+sessionId+"/participant/update";
|
|
|
try{
|
|
|
JSONObject params = new JSONObject();
|
|
|
params.put("user_id", userId);
|
|
@ -284,8 +278,7 @@ public class ImUtill {
|
|
|
* @return
|
|
|
*/
|
|
|
public static JSONObject getTopic(String topicId) throws Exception{
|
|
|
String url = SystemConf.getInstance().getSystemProperties().getProperty("im_list_get")
|
|
|
+ "api/v2/sessions/topics/"+topicId+"?topic_id="+topicId;
|
|
|
String url = SystemConf.getInstance().getImListGet() + "api/v2/sessions/topics/"+topicId+"?topic_id="+topicId;
|
|
|
try{
|
|
|
String ret = HttpClientUtil.get(url,"utf-8");
|
|
|
JSONObject obj = new JSONObject(ret);
|
|
@ -306,8 +299,7 @@ public class ImUtill {
|
|
|
* @throws Exception
|
|
|
*/
|
|
|
public static JSONArray getParticipants(String sessionId){
|
|
|
String url = SystemConf.getInstance().getSystemProperties().getProperty("im_list_get")
|
|
|
+ "api/v2/sessions/"+sessionId+"/participants?session_id="+sessionId;
|
|
|
String url = SystemConf.getInstance().getImListGet() + "api/v2/sessions/"+sessionId+"/participants?session_id="+sessionId;
|
|
|
try{
|
|
|
String ret = HttpClientUtil.get(url,"utf-8");
|
|
|
return new JSONArray(ret);
|
|
@ -323,8 +315,7 @@ public class ImUtill {
|
|
|
* @throws Exception
|
|
|
*/
|
|
|
public static JSONArray getSessions(String sessionId){
|
|
|
String url = SystemConf.getInstance().getSystemProperties().getProperty("im_list_get")
|
|
|
+ "api/v2/sessions/"+sessionId+"/participants?session_id="+sessionId;
|
|
|
String url = SystemConf.getInstance().getImListGet()+ "api/v2/sessions/"+sessionId+"/participants?session_id="+sessionId;
|
|
|
try{
|
|
|
String ret = HttpClientUtil.get(url,"utf-8");
|
|
|
return new JSONArray(ret);
|