forked from jkxqj/KingIM
-
Notifications
You must be signed in to change notification settings - Fork 0
/
LLClient.java
58 lines (44 loc) · 2.06 KB
/
LLClient.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
package com.nercel.cyberhouse.client.controller;
import org.springframework.web.client.RestTemplate;
import com.nercel.cyberhouse.util.ServerConfig;
import net.sf.json.JSONObject;
public class LLClient {
private String CYBERHOUSE_PATH = "localhost:8080/cyberhouse";
private RestTemplate template = new RestTemplate();
// 更改用户在线状态
public String updUserOnline(int userId, int status) {
return template.getForObject(CYBERHOUSE_PATH + "/userOnline/updUserOnline?userId={userId}" + "&status={status}",String.class, userId, status);
}
// 获取群组成员用户名列表
public String getGroupUser(int groupId) {
return template.getForObject(CYBERHOUSE_PATH + "/qun/getSimpleMemberByGroupId?groupId={groupId}", String.class,groupId);
}
// 保存好友消息到mongo
public String saveFriendMessage(JSONObject message) {
return template.postForObject(CYBERHOUSE_PATH + "/friend/saveMessageToMongo", message,String.class);
}
// 保存群组消息mongo
public String saveGroupMessage(JSONObject message) {
return template.postForObject(CYBERHOUSE_PATH + "/qun/saveMessageToMongo", message,String.class);
}
//获取某人未读好友消息
public String getUnreadMessage(int userId){
return template.getForObject(CYBERHOUSE_PATH+"/friend/getUnreadMessage?userId={userId}",String.class,userId);
}
//获取某人未读群消息
public String getUnreadQunMsg(int userId){
return template.getForObject(CYBERHOUSE_PATH+"/qun/getUnreadQunMsg?userId={userId}",String.class,userId);
}
//更新某人未读群消息状态
public String updateQunMsgStatus(String id){
return template.getForObject(CYBERHOUSE_PATH+"/qun/updateQunMsgStatus?id={id}",String.class,id);
}
//更新某人未读私聊消息状态
public String updateMessageStatus(String id){
return template.getForObject(CYBERHOUSE_PATH+"/friend/updateMessageStatus?id={id}",String.class,id);
}
//保存某人未读群消息
public String saveOfflineMsgToMongo(JSONObject message){
return template.postForObject(CYBERHOUSE_PATH+"/qun/saveOfflineMsgToMongo",message,String.class);
}
}