Merge remote-tracking branch 'origin/tuoyun' into tuoyun

pull/141/head
wenxu12345 3 years ago
commit 5e65e394a6

@ -0,0 +1,25 @@
.PHONY: all build run gotool install clean help
BINARY_NAME=open_im_cms_api
BIN_DIR=../../bin/
all: gotool build
build:
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags="-w -s"
run:
@go run ./
gotool:
go fmt ./
go vet ./
install:
make build
mv ${BINARY_NAME} ${BIN_DIR}
clean:
@if [ -f ${BINARY_NAME} ] ; then rm ${BINARY_NAME} ; fi

@ -0,0 +1,23 @@
.PHONY: all build run gotool install clean help
BINARY_NAME=open_im_admin_cms
BIN_DIR=../../../bin/
all: gotool build
build:
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags="-w -s"
run:
@go run ./
gotool:
go fmt ./
go vet ./
install:
make build
mv ${BINARY_NAME} ${BIN_DIR}
clean:
@if [ -f ${BINARY_NAME} ] ; then rm ${BINARY_NAME} ; fi

@ -0,0 +1,23 @@
.PHONY: all build run gotool install clean help
BINARY_NAME=open_im_message_cms
BIN_DIR=../../../bin/
all: gotool build
build:
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags="-w -s"
run:
@go run ./
gotool:
go fmt ./
go vet ./
install:
make build
mv ${BINARY_NAME} ${BIN_DIR}
clean:
@if [ -f ${BINARY_NAME} ] ; then rm ${BINARY_NAME} ; fi

@ -6,7 +6,7 @@ import (
)
func main() {
rpcPort := flag.Int("port", 10301, "rpc listening port")
rpcPort := flag.Int("port", 10300, "rpc listening port")
flag.Parse()
rpcServer := rpcChat.NewRpcChatServer(*rpcPort)
rpcServer.Run()

@ -0,0 +1,23 @@
.PHONY: all build run gotool install clean help
BINARY_NAME=open_im_statistics
BIN_DIR=../../../bin/
all: gotool build
build:
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags="-w -s"
run:
@go run ./
gotool:
go fmt ./
go vet ./
install:
make build
mv ${BINARY_NAME} ${BIN_DIR}
clean:
@if [ -f ${BINARY_NAME} ] ; then rm ${BINARY_NAME} ; fi

@ -6,7 +6,7 @@ import (
)
func main() {
rpcPort := flag.Int("port", 10101, "rpc listening port")
rpcPort := flag.Int("port", 10100, "rpc listening port")
flag.Parse()
rpcServer := user.NewUserServer(*rpcPort)
rpcServer.Run()

@ -60,6 +60,7 @@ serverip: 0.0.0.0
# endpoints 内部组件间访问的端点host名称访问时可以内部直接访问 host:port 来访问
endpoints:
api: openim_api
cmsapi: openim_cms_api
push: openim_push
msg_gateway: openim_msg_gateway
rpc_auth: openim_rpc_auth
@ -67,11 +68,14 @@ endpoints:
rpc_group: openim_rpc_group
rpc_msg: openim_rpc_msg
rpc_user: openim_rpc_user
rpc_statistic: openim_rpc_statistic
rpc_admin_cms: openim_rpc_admin_cms
rpc_message_cms: openim_rpc_admin_cms
api:
openImApiPort: [ 10000 ]
cmsapi:
openImCMSPort: [ 8000 ]
openImCmsApiPort: [ 8000 ]
sdk:
openImSdkWsPort: [ 30000 ]
@ -92,9 +96,9 @@ rpcport:
openImGroupPort: [ 10500 ]
openImAuthPort: [ 10600 ]
openImPushPort: [ 10700 ]
openImOpenImStatisticPort: [ 10800 ]
OpenImMessageCMSPort: [ 10900 ]
openImAdminCMSPort: [11000]
openImStatisticsPort: [ 10800 ]
openImMessageCmsPort: [ 10900 ]
openImAdminCmsPort: [ 11000 ]
c2c:
callbackBeforeSendMsg:
switch: false
@ -153,7 +157,7 @@ push:
pushIntent: "intent:#Intent;component=io.openim.app.enterprisechat/io.openim.app.enterprisechat.MainActivity;end"
manager:
appManagerUid: [ "openIM123456","openIM654321", "openIM333", "openIMAdmin"]
secrets: [ "openIM1","openIM2", "openIM333" ]
secrets: [ "openIM1","openIM2", "openIM333", "openIMAdmin"]
secret: tuoyun

@ -696,7 +696,6 @@ func (s *groupServer) GetGroup(_ context.Context, req *pbGroup.GetGroupReq) (*pb
groupMember, err := imdb.GetGroupMaster(v.GroupID)
if err != nil {
log.NewError(req.OperationID, utils.GetSelfFuncName(), "GetGroupMaster error", err.Error())
continue
}
resp.CMSGroups = append(resp.CMSGroups, &pbGroup.CMSGroup{
GroupInfo: &open_im_sdk.GroupInfo{
@ -738,7 +737,6 @@ func (s *groupServer) GetGroups(_ context.Context, req *pbGroup.GetGroupsReq) (*
groupMember, err := imdb.GetGroupMaster(v.GroupID)
if err != nil {
log.NewError(req.OperationID, utils.GetSelfFuncName(), err.Error())
continue
}
resp.CMSGroups = append(resp.CMSGroups, &pbGroup.CMSGroup{
GroupInfo: &open_im_sdk.GroupInfo{

@ -6,6 +6,7 @@ import (
"Open_IM/pkg/utils"
"errors"
"fmt"
"github.com/jinzhu/gorm"
"time"
)
@ -124,17 +125,56 @@ func OperateGroupRole(userId, groupId string, roleLevel int32) error {
groupMember := db.GroupMember{
UserID: userId,
GroupID: groupId,
RoleLevel: roleLevel,
}
updateInfo := db.GroupMember{
RoleLevel: roleLevel,
}
result := dbConn.Table("group_members").Find(&groupMember).Update(updateInfo)
if result.Error != nil {
return result.Error
}
if result.RowsAffected == 0 {
return errors.New(fmt.Sprintf("user %s not exist in group %s or already operate", userId, groupId))
groupMaster := db.GroupMember{
}
switch roleLevel {
case constant.GroupOwner:
return dbConn.Transaction(func(tx *gorm.DB) error {
result := dbConn.Table("group_members").Where("group_id = ? and role_level = ?", groupId, constant.GroupOwner).First(&groupMaster).Update(&db.GroupMember{
RoleLevel: constant.GroupOrdinaryUsers,
})
if result.Error != nil {
return result.Error
}
if result.RowsAffected == 0 {
return errors.New(fmt.Sprintf("user %s not exist in group %s or already operate", userId, groupId))
}
result = dbConn.Table("group_members").First(&groupMember).Update(updateInfo)
if result.Error != nil {
return result.Error
}
if result.RowsAffected == 0 {
return errors.New(fmt.Sprintf("user %s not exist in group %s or already operate", userId, groupId))
}
return nil
})
case constant.GroupOrdinaryUsers:
return dbConn.Transaction(func(tx *gorm.DB) error {
result := dbConn.Table("group_members").Where("group_id = ? and role_level = ?", groupId, constant.GroupOwner).First(&groupMaster)
if result.Error != nil {
return result.Error
}
if result.RowsAffected == 0 {
return errors.New(fmt.Sprintf("user %s not exist in group %s or already operate", userId, groupId))
}
if groupMaster.UserID == userId {
return errors.New(fmt.Sprintf("user %s is master of %s, cant set to ordinary user", userId, groupId))
} else {
result = dbConn.Table("group_members").Find(&groupMember).Update(updateInfo)
if result.Error != nil {
return result.Error
}
if result.RowsAffected == 0 {
return errors.New(fmt.Sprintf("user %s not exist in group %s or already operate", userId, groupId))
}
}
return nil
})
}
return nil
}

@ -4,6 +4,7 @@ source ./style_info.cfg
source ./path_info.cfg
source ./function.sh
service_port_name=(
openImCmsApiPort
openImApiPort
openImUserPort
openImFriendPort
@ -15,6 +16,9 @@ service_port_name=(
openImWsPort
openImSdkWsPort
openImDemoPort
openImAdminCmsPort
openImMessageCmsPort
openImStatisticsPort
)
switch=$(cat $config_path | grep demoswitch |awk -F '[:]' '{print $NF}')
for i in ${service_port_name[*]}; do

@ -39,11 +39,15 @@ config_path="../config/config.yaml"
service_source_root=(
#api service file
../cmd/open_im_api/
../cmd/open_im_cms_api/
#rpc service file
../cmd/rpc/open_im_user/
../cmd/rpc/open_im_friend/
../cmd/rpc/open_im_group/
../cmd/rpc/open_im_auth/
../cmd/rpc/open_im_admin_cms/
../cmd/rpc/open_im_message_cms/
../cmd/rpc/open_im_statistics/
${msg_gateway_source_root}
${msg_transfer_source_root}
${msg_source_root}
@ -56,11 +60,15 @@ service_source_root=(
service_names=(
#api service filename
open_im_api
open_im_cms_api
#rpc service filename
open_im_user
open_im_friend
open_im_group
open_im_auth
open_im_admin_cms
open_im_message_cms
open_im_statistics
${msg_gateway_name}
${msg_transfer_name}
${msg_name}

@ -8,11 +8,15 @@ source ./function.sh
service_filename=(
#api
open_im_api
open_im_cms_api
#rpc
open_im_user
open_im_friend
open_im_group
open_im_auth
open_im_admin_cms
open_im_message_cms
open_im_statistics
${msg_name}
)
@ -20,11 +24,15 @@ service_filename=(
service_port_name=(
#api port name
openImApiPort
openImCmsApiPort
#rpc port name
openImUserPort
openImFriendPort
openImGroupPort
openImAuthPort
openImAdminCmsPort
openImMessageCmsPort
openImStatisticsPort
openImOfflineMessagePort
)

Loading…
Cancel
Save