This commit is contained in:
heavyrain.lee
2019-05-22 20:38:35 +08:00
parent d36c3f4f77
commit 3ef973ffc5
8 changed files with 75 additions and 17 deletions
@@ -9,6 +9,7 @@
package com.xiaoleilu.loServer.action.admin;
import cn.wildfirechat.common.APIPath;
import cn.wildfirechat.pojos.*;
import cn.wildfirechat.proto.WFCMessage;
import com.google.gson.Gson;
import com.xiaoleilu.loServer.RestResult;
@@ -16,14 +17,13 @@ import com.xiaoleilu.loServer.annotation.HttpMethod;
import com.xiaoleilu.loServer.annotation.Route;
import com.xiaoleilu.loServer.handler.Request;
import com.xiaoleilu.loServer.handler.Response;
import cn.wildfirechat.pojos.OutputGetChatroomInfo;
import io.netty.handler.codec.http.FullHttpRequest;
import io.netty.handler.codec.http.HttpResponseStatus;
import io.netty.util.internal.StringUtil;
import cn.wildfirechat.common.ErrorCode;
@Route(APIPath.Chatroom_Info)
@HttpMethod("GET")
@HttpMethod("POST")
public class GetChatroomInfoAction extends AdminAction {
@Override
@@ -34,8 +34,8 @@ public class GetChatroomInfoAction extends AdminAction {
@Override
public boolean action(Request request, Response response) {
if (request.getNettyRequest() instanceof FullHttpRequest) {
String chatroomid = request.getParam("id");
InputGetChatroomInfo getChatroomInfo = getRequestBody(request.getNettyRequest(), InputGetChatroomInfo.class);
String chatroomid = getChatroomInfo.getChatroomId();
if (!StringUtil.isNullOrEmpty(chatroomid)) {
WFCMessage.ChatroomInfo info = messagesStore.getChatroomInfo(chatroomid);
@@ -25,7 +25,7 @@ import win.liyufan.im.IMTopic;
import java.util.Base64;
import java.util.concurrent.Executor;
@Route(APIPath.User_Token)
@Route(APIPath.Get_User_Token)
@HttpMethod("POST")
public class GetIMTokenAction extends AdminAction {
@@ -23,7 +23,7 @@ import io.netty.handler.codec.http.HttpResponseStatus;
import io.netty.util.internal.StringUtil;
import cn.wildfirechat.common.ErrorCode;
@Route(APIPath.User_Info)
@Route(APIPath.Get_User_Info)
@HttpMethod("POST")
public class GetUserAction extends AdminAction {
@@ -0,0 +1,25 @@
/*
* 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;
public class InputGetChannelInfo {
private String channelId;
public InputGetChannelInfo(String channelId) {
this.channelId = channelId;
}
public String getChannelId() {
return channelId;
}
public void setChannelId(String channelId) {
this.channelId = channelId;
}
}
@@ -0,0 +1,25 @@
/*
* 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;
public class InputGetChatroomInfo {
private String chatroomId;
public InputGetChatroomInfo(String chatroomId) {
this.chatroomId = chatroomId;
}
public String getChatroomId() {
return chatroomId;
}
public void setChatroomId(String chatroomId) {
this.chatroomId = chatroomId;
}
}
@@ -14,9 +14,9 @@ public interface APIPath {
String Sensitive_Del = "/admin/sensitive/del";
String Sensitive_Query = "/admin/sensitive/query";
String User_Token = "/admin/user/token";
String Get_User_Token = "/admin/user/token";
String User_Status = "/admin/user/status";
String User_Info = "/admin/user/info";
String Get_User_Info = "/admin/user/info";
String User_Status_List = "/admin/user/statuslist";
String User_Check_Status = "/admin/user/checkstatus";
String User_Online_Status = "/admin/user/onlinestatus";
@@ -0,0 +1,11 @@
package cn.wildfirechat.sdk;
import cn.wildfirechat.common.APIPath;
import cn.wildfirechat.pojos.*;
import cn.wildfirechat.sdk.model.*;
public class ChatConfig {
public static void init(String url, String secret) {
HttpUtils.init(url, secret);
}
}
@@ -1,26 +1,23 @@
package cn.wildfirechat.sdk;
import cn.wildfirechat.common.APIPath;
import cn.wildfirechat.pojos.*;
import cn.wildfirechat.sdk.model.*;
public class ChatAdmin {
public static void init(String url, String secret) {
HttpUtils.init(url, secret);
}
import cn.wildfirechat.sdk.model.IMResult;
public class UserAdmin {
public static IMResult<InputOutputUserInfo> getUserByName(String mobile) throws Exception {
String path = "/admin/user/info";
String path = APIPath.Get_User_Info;
InputGetUserInfo getUserInfo = new InputGetUserInfo(null, mobile);
return HttpUtils.httpJsonPost(path, getUserInfo, InputOutputUserInfo.class);
}
public static IMResult<OutputCreateUser> createUser(InputOutputUserInfo user) throws Exception {
String path = "/admin/user/create";
String path = APIPath.Create_User;
return HttpUtils.httpJsonPost(path, user, OutputCreateUser.class);
}
public static IMResult<OutputGetIMTokenData> getUserToken(String userId, String clientId) throws Exception {
String path = "/admin/user/token";
String path = APIPath.Get_User_Token;
InputGetToken getToken = new InputGetToken(userId, clientId);
return HttpUtils.httpJsonPost(path, getToken, OutputGetIMTokenData.class);
}