Error code standardization

This commit is contained in:
skiffer-git
2023-02-21 16:48:10 +08:00
parent ae40c8c8c0
commit 5751062605
11 changed files with 68 additions and 21 deletions
+12 -2
View File
@@ -4,6 +4,7 @@ import (
"Open_IM/internal/common/check"
"Open_IM/internal/common/convert"
"Open_IM/internal/common/notification"
"Open_IM/pkg/common/config"
"Open_IM/pkg/common/constant"
"Open_IM/pkg/common/db/controller"
"Open_IM/pkg/common/db/relation"
@@ -36,12 +37,21 @@ func Start(client *openKeeper.ZkClient, server *grpc.Server) error {
if err := gormDB.AutoMigrate(&tablerelation.UserModel{}); err != nil {
return err
}
pbuser.RegisterUserServer(server, &userServer{
u := &userServer{
UserInterface: controller.NewUserController(controller.NewUserDatabase(relation.NewUserGorm(gormDB))),
notification: notification.NewCheck(client),
userCheck: check.NewUserCheck(client),
RegisterCenter: client,
})
}
pbuser.RegisterUserServer(server, u)
users := make([]*tablerelation.UserModel, 0)
if len(config.Config.Manager.AppManagerUid) != len(config.Config.Manager.Nickname) {
return constant.ErrConfig.Wrap("len(config.Config.Manager.AppManagerUid) != len(config.Config.Manager.Nickname)")
}
for k, v := range config.Config.Manager.AppManagerUid {
users = append(users, &tablerelation.UserModel{UserID: v, Nickname: config.Config.Manager.Nickname[k]})
}
u.UserInterface.InitOnce(context.Background(), users)
return nil
}