test-errcode
withchao 1 year ago
parent e8763f32d0
commit 26c3c30b82

@ -0,0 +1,39 @@
.PHONY: all build run gotool install clean help
NAME=open_im_office
BIN_DIR=../../../bin/
OS:= $(or $(os),linux)
ARCH:=$(or $(arch),amd64)
all: gotool build
ifeq ($(OS),windows)
BINARY_NAME=${NAME}.exe
else
BINARY_NAME=${NAME}
endif
build:
CGO_ENABLED=0 GOOS=${OS} GOARCH=${ARCH}; go build -ldflags="-w -s" -o ${BINARY_NAME}
run:
@go run ./
gotool:
go fmt ./
go vet ./
install:build
mv ${BINARY_NAME} ${BIN_DIR}
clean:
@if [ -f ${BINARY_NAME} ] ; then rm ${BINARY_NAME} ; fi

@ -0,0 +1,19 @@
package office
import (
"github.com/OpenIMSDK/Open-IM-Server/internal/rpc/office"
"github.com/OpenIMSDK/Open-IM-Server/pkg/common/cmd"
"github.com/OpenIMSDK/Open-IM-Server/pkg/common/config"
)
func main() {
rpcCmd := cmd.NewRpcCmd("office")
rpcCmd.AddPortFlag()
rpcCmd.AddPrometheusPortFlag()
if err := rpcCmd.Exec(); err != nil {
panic(err.Error())
}
if err := rpcCmd.StartSvr(config.Config.RpcRegisterName.OpenImOfficeName, office.Start); err != nil {
panic(err.Error())
}
}

@ -45,7 +45,7 @@ redis:
enableCluster: false #如果外部redis以集群方式启动需要打开此开关
kafka:
SASLUserName:
SASLUserName:
SASLPassword:
ws2mschat:
addr: [ 127.0.0.1:9092 ] #kafka配置默认即可
@ -141,7 +141,8 @@ rpcport: #rpc服务端口 默认即可
openImPushPort: [ 10170 ]
openImConversationPort: [ 10180 ]
openImRtcPort: [ 10190 ]
openImThirdPort : [ 10200 ]
openImThirdPort: [ 10200 ]
openImOfficePort: [ 10210 ]
rpcregistername: #rpc注册服务名默认即可
openImUserName: User
@ -154,6 +155,7 @@ rpcregistername: #rpc注册服务名默认即可
openImConversationName: Conversation
openImRtcName: Rtc
openImThirdName: Third
openImOfficeName: Office
log:
storageLocation: ../logs/
@ -187,12 +189,12 @@ push:
secretKey: 111
enable: false # true or false (bool)
jpns: #极光推送 在极光后台申请后,修改以下四项,必须修改
appKey:
masterSecret:
pushUrl:
pushIntent:
appKey:
masterSecret:
pushUrl:
pushIntent:
enable: false # true or false (bool)
getui: #个推推送
getui: #个推推送
pushUrl: "https://restapi.getui.com/v2/$appId"
masterSecret: ""
appKey: ""
@ -200,13 +202,13 @@ push:
enable: false # true or false (bool)
channelID: ""
channelName: ""
fcm: #firebase cloud message 消息推送
fcm: #firebase cloud message 消息推送
serviceAccount: "openim-5c6c0-firebase-adminsdk-ppwol-8765884a78.json" #帐号文件,此处需要改修配置,并且这个文件放在 config目录下
enable: false
manager:
#app管理员userID和对应的secret 建议修改。 用于管理后台登录也可以用户管理后台对应的api
appManagerUid: [ "openIM123456","openIM654321", "openIM333", "openIMAdmin"]
appManagerUid: [ "openIM123456","openIM654321", "openIM333", "openIMAdmin" ]
nickname: [ "系统通知","openIM654321", "openIM333", "openIMAdmin" ]
@ -240,7 +242,7 @@ iospush:
callback:
# callback url 需要自行更换callback url
callbackUrl : "http://127.0.0.1:8080/callback"
callbackUrl: "http://127.0.0.1:8080/callback"
# 开启关闭操作前后回调的配置
callbackBeforeSendSingleMsg:
enable: false # 回调是否启用

@ -0,0 +1,25 @@
package api
import (
"context"
"github.com/OpenIMSDK/Open-IM-Server/pkg/common/config"
"github.com/OpenIMSDK/Open-IM-Server/pkg/discoveryregistry"
"github.com/OpenIMSDK/Open-IM-Server/pkg/proto/office"
"google.golang.org/grpc"
)
func NewOffice(c discoveryregistry.SvcDiscoveryRegistry) *Office {
conn, err := c.GetConn(context.Background(), config.Config.RpcRegisterName.OpenImOfficeName)
if err != nil {
panic(err)
}
return &Office{conn: conn}
}
type Office struct {
conn *grpc.ClientConn
}
func (o *Office) client(ctx context.Context) (office.OfficeClient, error) {
return office.NewOfficeClient(o.conn), nil
}

@ -170,5 +170,11 @@ func NewGinRouter(discov discoveryregistry.SvcDiscoveryRegistry, rdb redis.Unive
conversationGroup.POST("/get_conversations_has_read_and_max_seq", c.GetConversationsHasReadAndMaxSeq)
conversationGroup.POST("/set_conversations", c.SetConversations)
}
office := r.Group("/office")
{
o := NewOffice(discov)
_, _ = office, o
}
return r
}

@ -0,0 +1,119 @@
package office
import (
"context"
"github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/controller"
"github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/unrelation"
"github.com/OpenIMSDK/Open-IM-Server/pkg/discoveryregistry"
"github.com/OpenIMSDK/Open-IM-Server/pkg/proto/office"
"github.com/OpenIMSDK/Open-IM-Server/pkg/rpcclient"
"google.golang.org/grpc"
)
func Start(client discoveryregistry.SvcDiscoveryRegistry, server *grpc.Server) error {
mongo, err := unrelation.NewMongo()
if err != nil {
return err
}
//rdb, err := cache.NewRedis()
//if err != nil {
// return err
//}
office.RegisterOfficeServiceServer(server, &officeServer{
officeDatabase: controller.NewOfficeDatabase(mongo),
msgRpcClient: rpcclient.NewMsgClient(client),
user: rpcclient.NewUserClient(client),
})
return nil
}
type officeServer struct {
officeDatabase controller.OfficeDatabase
user *rpcclient.UserClient
msgRpcClient *rpcclient.MsgClient
}
func (o *officeServer) GetUserTags(ctx context.Context, req *office.GetUserTagsReq) (*office.GetUserTagsResp, error) {
//TODO implement me
panic("implement me")
}
func (o *officeServer) CreateTag(ctx context.Context, req *office.CreateTagReq) (*office.CreateTagResp, error) {
//TODO implement me
panic("implement me")
}
func (o *officeServer) DeleteTag(ctx context.Context, req *office.DeleteTagReq) (*office.DeleteTagResp, error) {
//TODO implement me
panic("implement me")
}
func (o *officeServer) SetTag(ctx context.Context, req *office.SetTagReq) (*office.SetTagResp, error) {
//TODO implement me
panic("implement me")
}
func (o *officeServer) SendMsg2Tag(ctx context.Context, req *office.SendMsg2TagReq) (*office.SendMsg2TagResp, error) {
//TODO implement me
panic("implement me")
}
func (o *officeServer) GetTagSendLogs(ctx context.Context, req *office.GetTagSendLogsReq) (*office.GetTagSendLogsResp, error) {
//TODO implement me
panic("implement me")
}
func (o *officeServer) GetUserTagByID(ctx context.Context, req *office.GetUserTagByIDReq) (*office.GetUserTagByIDResp, error) {
//TODO implement me
panic("implement me")
}
func (o *officeServer) CreateOneWorkMoment(ctx context.Context, req *office.CreateOneWorkMomentReq) (*office.CreateOneWorkMomentResp, error) {
//TODO implement me
panic("implement me")
}
func (o *officeServer) DeleteOneWorkMoment(ctx context.Context, req *office.DeleteOneWorkMomentReq) (*office.DeleteOneWorkMomentResp, error) {
//TODO implement me
panic("implement me")
}
func (o *officeServer) LikeOneWorkMoment(ctx context.Context, req *office.LikeOneWorkMomentReq) (*office.LikeOneWorkMomentResp, error) {
//TODO implement me
panic("implement me")
}
func (o *officeServer) CommentOneWorkMoment(ctx context.Context, req *office.CommentOneWorkMomentReq) (*office.CommentOneWorkMomentResp, error) {
//TODO implement me
panic("implement me")
}
func (o *officeServer) DeleteComment(ctx context.Context, req *office.DeleteCommentReq) (*office.DeleteCommentResp, error) {
//TODO implement me
panic("implement me")
}
func (o *officeServer) GetWorkMomentByID(ctx context.Context, req *office.GetWorkMomentByIDReq) (*office.GetWorkMomentByIDResp, error) {
//TODO implement me
panic("implement me")
}
func (o *officeServer) ChangeWorkMomentPermission(ctx context.Context, req *office.ChangeWorkMomentPermissionReq) (*office.ChangeWorkMomentPermissionResp, error) {
//TODO implement me
panic("implement me")
}
func (o *officeServer) GetUserWorkMoments(ctx context.Context, req *office.GetUserWorkMomentsReq) (*office.GetUserWorkMomentsResp, error) {
//TODO implement me
panic("implement me")
}
func (o *officeServer) GetUserFriendWorkMoments(ctx context.Context, req *office.GetUserFriendWorkMomentsReq) (*office.GetUserFriendWorkMomentsResp, error) {
//TODO implement me
panic("implement me")
}
func (o *officeServer) SetUserWorkMomentsLevel(ctx context.Context, req *office.SetUserWorkMomentsLevelReq) (*office.SetUserWorkMomentsLevelResp, error) {
//TODO implement me
panic("implement me")
}

@ -12,8 +12,6 @@ import (
"github.com/OpenIMSDK/Open-IM-Server/pkg/discoveryregistry"
"github.com/OpenIMSDK/Open-IM-Server/pkg/utils"
_ "embed"
"gopkg.in/yaml.v3"
)
@ -163,6 +161,7 @@ type config struct {
OpenImCachePort []int `yaml:"openImCachePort"`
OpenImRtcPort []int `yaml:"openImRtcPort"`
OpenImThirdPort []int `yaml:"openImThirdPort"`
OpenImOfficePort []int `yaml:"openImOfficePort"`
}
RpcRegisterName struct {
OpenImUserName string `yaml:"openImUserName"`
@ -175,6 +174,7 @@ type config struct {
OpenImConversationName string `yaml:"openImConversationName"`
OpenImRtcName string `yaml:"openImRtcName"`
OpenImThirdName string `yaml:"openImThirdName"`
OpenImOfficeName string `yaml:"openImOfficeName"`
}
Zookeeper struct {
Schema string `yaml:"schema"`

@ -0,0 +1,18 @@
package controller
import (
"github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/unrelation"
)
func NewOfficeDatabase(mgo *unrelation.Mongo) OfficeDatabase {
return &officeDatabase{mgo: mgo}
}
type OfficeDatabase interface {
// table.unrelation.office.go
// unrelation.office.go
}
type officeDatabase struct {
mgo *unrelation.Mongo
}

@ -10,4 +10,5 @@ protoc --go_out=plugins=grpc:./rtc --go_opt=module=github.com/OpenIMSDK/Open-IM-
protoc --go_out=plugins=grpc:./sdkws --go_opt=module=github.com/OpenIMSDK/Open-IM-Server/pkg/proto/sdkws sdkws/sdkws.proto
protoc --go_out=plugins=grpc:./third --go_opt=module=github.com/OpenIMSDK/Open-IM-Server/pkg/proto/third third/third.proto
protoc --go_out=plugins=grpc:./user --go_opt=module=github.com/OpenIMSDK/Open-IM-Server/pkg/proto/user user/user.proto
protoc --go_out=plugins=grpc:./wrapperspb --go_opt=module=github.com/OpenIMSDK/Open-IM-Server/pkg/proto/wrapperspb wrapperspb/wrapperspb.proto
protoc --go_out=plugins=grpc:./wrapperspb --go_opt=module=github.com/OpenIMSDK/Open-IM-Server/pkg/proto/wrapperspb wrapperspb/wrapperspb.proto
protoc --go_out=plugins=grpc:./office --go_opt=module=github.com/OpenIMSDK/Open-IM-Server/pkg/proto/office office/office.proto

@ -9,4 +9,5 @@ protoc --go_out=plugins=grpc:./rtc --go_opt=module=github.com/OpenIMSDK/Open-IM-
protoc --go_out=plugins=grpc:./sdkws --go_opt=module=github.com/OpenIMSDK/Open-IM-Server/pkg/proto/sdkws sdkws/sdkws.proto
protoc --go_out=plugins=grpc:./third --go_opt=module=github.com/OpenIMSDK/Open-IM-Server/pkg/proto/third third/third.proto
protoc --go_out=plugins=grpc:./user --go_opt=module=github.com/OpenIMSDK/Open-IM-Server/pkg/proto/user user/user.proto
protoc --go_out=plugins=grpc:./wrapperspb --go_opt=module=github.com/OpenIMSDK/Open-IM-Server/pkg/proto/wrapperspb wrapperspb/wrapperspb.proto
protoc --go_out=plugins=grpc:./wrapperspb --go_opt=module=github.com/OpenIMSDK/Open-IM-Server/pkg/proto/wrapperspb wrapperspb/wrapperspb.proto
protoc --go_out=plugins=grpc:./office --go_opt=module=github.com/OpenIMSDK/Open-IM-Server/pkg/proto/office office/office.proto

File diff suppressed because it is too large Load Diff

@ -0,0 +1,278 @@
syntax = "proto3";
package OpenIMServer.office;
import "sdkws/sdkws.proto";
option go_package = "github.com/OpenIMSDK/Open-IM-Server/pkg/proto/office";
message TagUser {
string userID = 1;
string userName = 2;
}
message Tag {
string tagID = 1;
string tagName = 2;
repeated TagUser userList = 3;
}
message GetUserTagsReq{
string userID = 1;
string operationID = 2;
}
message GetUserTagsResp{
repeated Tag tags = 1;
}
message CreateTagReq {
string tagName = 1;
string userID = 2;
repeated string userIDList = 3;
string operationID = 4;
}
message CreateTagResp {
}
message DeleteTagReq {
string userID = 1;
string tagID = 2;
string operationID = 3;
}
message DeleteTagResp {
}
message SetTagReq {
string userID = 1;
string tagID = 2;
string newName = 3;
repeated string increaseUserIDList = 4;
repeated string reduceUserIDList = 5;
string operationID = 6;
}
message SetTagResp {
}
message SendMsg2TagReq {
repeated string tagList = 1;
repeated string UserList = 2;
repeated string GroupList = 3;
string sendID = 4;
int32 senderPlatformID = 5;
string content = 6;
string operationID = 7;
}
message SendMsg2TagResp {
}
message GetTagSendLogsReq {
sdkws.RequestPagination Pagination = 1;
string userID = 2;
string operationID = 3;
}
message TagSendLog {
repeated TagUser userList = 1;
string content = 2;
int64 sendTime = 3;
}
message GetTagSendLogsResp {
repeated TagSendLog tagSendLogs = 1;
}
message GetUserTagByIDReq {
string userID = 1;
string tagID = 2;
string operationID = 3;
}
message GetUserTagByIDResp {
Tag tag = 1;
}
/// WorkMoment
message LikeUser {
string userID = 1;
string userName = 2;
}
message NotificationUser {
string userID = 1;
string userName = 2;
}
message Comment {
string userID = 1;
string userName = 2;
string faceURL = 3;
string replyUserID = 4;
string replyUserName = 5;
string contentID = 6;
string content = 7;
int32 createTime = 8;
}
message PermissionGroup {
string groupName = 1;
string groupID = 2;
}
message WorkMomentUser {
string userID = 1;
string userName = 2;
}
message WorkMoment {
string workMomentID = 1;
string userID = 2;
string userName = 3;
string faceURL = 4;
string content = 5;
repeated WorkMomentUser likeUserList = 6;
repeated Comment comments = 7;
int32 permission = 8;
repeated WorkMomentUser permissionUserList = 9;
repeated PermissionGroup permissionGroupList = 10;
repeated WorkMomentUser atUserList = 11;
int32 createTime = 12;
}
message CreateOneWorkMomentReq {
WorkMoment workMoment = 1;
string operationID = 2;
}
message CreateOneWorkMomentResp {
}
message DeleteOneWorkMomentReq {
string workMomentID = 1;
string userID = 2;
string operationID = 3;
}
message DeleteOneWorkMomentResp {
}
message LikeOneWorkMomentReq {
string userID = 1;
string WorkMomentID = 2;
string operationID = 3;
}
message LikeOneWorkMomentResp {
}
message CommentOneWorkMomentReq {
string userID = 1;
string workMomentID = 2;
string replyUserID = 3;
string content = 4;
string operationID = 5;
}
message CommentOneWorkMomentResp {
}
message DeleteCommentReq {
string workMomentID = 1;
string contentID = 2;
string opUserID = 3;
string operationID = 4;
}
message DeleteCommentResp {
}
message GetWorkMomentByIDReq {
string workMomentID = 1;
string opUserID = 2;
string operationID = 3;
}
message GetWorkMomentByIDResp {
WorkMoment workMoment = 2;
}
message ChangeWorkMomentPermissionReq {
string workMomentID = 1;
string opUserID = 2;
int32 permission = 3;
repeated string permissionUserIDList = 4;
string operationID = 5;
}
message ChangeWorkMomentPermissionResp {
}
message GetUserWorkMomentsReq {
string userID = 1;
string opUserID = 2;
sdkws.RequestPagination Pagination = 3;
string operationID = 4;
}
message GetUserWorkMomentsResp {
repeated WorkMoment workMoments = 1;
}
message GetUserFriendWorkMomentsReq {
string userID = 1;
sdkws.RequestPagination Pagination = 2;
string operationID = 3;
}
message GetUserFriendWorkMomentsResp {
repeated WorkMoment workMoments = 1;
}
message WorkMomentNotificationMsg {
int32 notificationMsgType = 1;
string replyUserName = 2;
string replyUserID = 3;
string content = 4;
string contentID = 5;
string workMomentID = 6;
string userID = 7;
string userName = 8;
string faceURL = 9;
string workMomentContent = 10;
int32 createTime = 11;
}
message SetUserWorkMomentsLevelReq {
string userID = 1;
int32 level = 2;
string operationID = 3;
}
message SetUserWorkMomentsLevelResp {
}
service Office {
rpc GetUserTags(GetUserTagsReq) returns(GetUserTagsResp);
rpc CreateTag(CreateTagReq) returns(CreateTagResp);
rpc DeleteTag(DeleteTagReq) returns(DeleteTagResp);
rpc SetTag(SetTagReq) returns(SetTagResp);
rpc SendMsg2Tag(SendMsg2TagReq) returns(SendMsg2TagResp);
rpc GetTagSendLogs(GetTagSendLogsReq) returns(GetTagSendLogsResp);
rpc GetUserTagByID(GetUserTagByIDReq) returns(GetUserTagByIDResp);
rpc CreateOneWorkMoment(CreateOneWorkMomentReq) returns(CreateOneWorkMomentResp);
rpc DeleteOneWorkMoment(DeleteOneWorkMomentReq) returns(DeleteOneWorkMomentResp);
rpc LikeOneWorkMoment(LikeOneWorkMomentReq) returns(LikeOneWorkMomentResp);
rpc CommentOneWorkMoment(CommentOneWorkMomentReq) returns(CommentOneWorkMomentResp);
rpc DeleteComment(DeleteCommentReq) returns(DeleteCommentResp);
rpc GetWorkMomentByID(GetWorkMomentByIDReq) returns(GetWorkMomentByIDResp);
rpc ChangeWorkMomentPermission(ChangeWorkMomentPermissionReq) returns(ChangeWorkMomentPermissionResp);
/// user self
rpc GetUserWorkMoments(GetUserWorkMomentsReq) returns(GetUserWorkMomentsResp);
/// users friend
rpc GetUserFriendWorkMoments(GetUserFriendWorkMomentsReq) returns(GetUserFriendWorkMomentsResp);
rpc SetUserWorkMomentsLevel(SetUserWorkMomentsLevelReq) returns(SetUserWorkMomentsLevelResp);
}
Loading…
Cancel
Save