sdk添加对设置会话置顶的功能
This commit is contained in:
@@ -28,7 +28,8 @@ public interface APIPath {
|
|||||||
String User_Get_Blocked_List = "/admin/user/get_blocked_list";
|
String User_Get_Blocked_List = "/admin/user/get_blocked_list";
|
||||||
String User_Check_Block_Status = "/admin/user/check_block_status";
|
String User_Check_Block_Status = "/admin/user/check_block_status";
|
||||||
String User_Get_Online_Status = "/admin/user/onlinestatus";
|
String User_Get_Online_Status = "/admin/user/onlinestatus";
|
||||||
|
String User_Put_Setting = "/admin/user/put_setting";
|
||||||
|
String User_Get_Setting = "/admin/user/get_setting";
|
||||||
|
|
||||||
String Friend_Update_Status = "/admin/friend/status";
|
String Friend_Update_Status = "/admin/friend/status";
|
||||||
String Friend_Get_List = "/admin/friend/list";
|
String Friend_Get_List = "/admin/friend/list";
|
||||||
|
|||||||
@@ -0,0 +1,61 @@
|
|||||||
|
/*
|
||||||
|
* This file is part of the Wildfire Chat package.
|
||||||
|
* (c) Heavyrain2012 <[email protected]>
|
||||||
|
*
|
||||||
|
* For the full copyright and license information, please view the LICENSE
|
||||||
|
* file that was distributed with this source code.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package cn.wildfirechat.pojos;
|
||||||
|
|
||||||
|
import cn.wildfirechat.proto.WFCMessage;
|
||||||
|
import io.netty.util.internal.StringUtil;
|
||||||
|
|
||||||
|
public class UserSettingPojo {
|
||||||
|
private String userId;
|
||||||
|
private int scope;
|
||||||
|
private String key;
|
||||||
|
private String value;
|
||||||
|
|
||||||
|
public String getUserId() {
|
||||||
|
return userId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUserId(String userId) {
|
||||||
|
this.userId = userId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getScope() {
|
||||||
|
return scope;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setScope(int scope) {
|
||||||
|
this.scope = scope;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getKey() {
|
||||||
|
return key;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setKey(String key) {
|
||||||
|
this.key = key;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getValue() {
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setValue(String value) {
|
||||||
|
this.value = value;
|
||||||
|
}
|
||||||
|
public WFCMessage.ModifyUserSettingReq toProtoRequest() {
|
||||||
|
WFCMessage.ModifyUserSettingReq.Builder builder = WFCMessage.ModifyUserSettingReq.newBuilder();
|
||||||
|
builder.setScope(scope);
|
||||||
|
if (!StringUtil.isNullOrEmpty(key))
|
||||||
|
builder.setKey(key);
|
||||||
|
if(!StringUtil.isNullOrEmpty(value))
|
||||||
|
builder.setValue(value);
|
||||||
|
|
||||||
|
return builder.build();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -27,4 +27,40 @@ public class GeneralAdmin {
|
|||||||
return AdminHttpUtils.httpJsonPost(path, inputCreateChannel, OutputCreateChannel.class);
|
return AdminHttpUtils.httpJsonPost(path, inputCreateChannel, OutputCreateChannel.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//以下仅专业版支持
|
||||||
|
public static IMResult<Void> setConversationTop(String userId, int conversationType, String target, int line, boolean isTop) throws Exception {
|
||||||
|
String key = conversationType + "-" + line + "-" + target;
|
||||||
|
String value = isTop?"1":"0";
|
||||||
|
return setUserSetting(userId, 3, key, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static IMResult<Boolean> getConversationTop(String userId, int conversationType, String target, int line) throws Exception {
|
||||||
|
String key = conversationType + "-" + line + "-" + target;
|
||||||
|
IMResult<UserSettingPojo> result = getUserSetting(userId, 3, key);
|
||||||
|
IMResult<Boolean> out = new IMResult<Boolean>();
|
||||||
|
out.code = result.code;
|
||||||
|
out.msg = result.msg;
|
||||||
|
out.result = result.result != null && "1".equals(result.result.getValue());
|
||||||
|
return out;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private static IMResult<UserSettingPojo> getUserSetting(String userId, int scope, String key) throws Exception {
|
||||||
|
String path = APIPath.User_Get_Setting;
|
||||||
|
UserSettingPojo pojo = new UserSettingPojo();
|
||||||
|
pojo.setUserId(userId);
|
||||||
|
pojo.setScope(scope);
|
||||||
|
pojo.setKey(key);
|
||||||
|
return AdminHttpUtils.httpJsonPost(path, pojo, UserSettingPojo.class);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static IMResult<Void> setUserSetting(String userId, int scope, String key, String value) throws Exception {
|
||||||
|
String path = APIPath.User_Put_Setting;
|
||||||
|
UserSettingPojo pojo = new UserSettingPojo();
|
||||||
|
pojo.setUserId(userId);
|
||||||
|
pojo.setScope(scope);
|
||||||
|
pojo.setKey(key);
|
||||||
|
pojo.setValue(value);
|
||||||
|
return AdminHttpUtils.httpJsonPost(path, pojo, Void.class);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user