Skip to content

Commit e2c22c8

Browse files
committed
🎨 Init platform
1 parent fb2fe52 commit e2c22c8

2 files changed

Lines changed: 9 additions & 2 deletions

File tree

‎controller/statusctl.go‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ func getStatusAction(c *gin.Context) {
7676
data.AvatarURL = user.AvatarURL
7777
data.Role = model.UserRoleBlogAdmin
7878

79-
if model.UserRoleNoLogin != session.URole {
79+
if model.UserRoleNoLogin != session.URole && platformStatus.Inited {
8080
ownBlog := service.User.GetOwnBlog(user.ID)
8181
data.BlogTitle = ownBlog.Title
8282
data.BlogURL = ownBlog.URL

‎service/initsrv.go‎

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,13 @@ func (srv *initService) Status() (platformStatus *PlatformStatus, err error) {
8181
return
8282
}
8383

84+
func (srv *initService) InitBlog(blogAdmin *model.User) error {
85+
srv.mutex.Lock()
86+
defer srv.mutex.Unlock()
87+
88+
return nil
89+
}
90+
8491
func (srv *initService) InitPlatform(platformAdmin *model.User) error {
8592
if srv.inited {
8693
return nil
@@ -179,7 +186,7 @@ func initPlatformAdmin(tx *gorm.DB, admin *model.User, blogID uint) error {
179186
ID1: blogID,
180187
ID2: admin.ID,
181188
Type: model.CorrelationBlogUser,
182-
Int1: model.UserRolePlatformAdmin,
189+
Int1: model.UserRoleBlogAdmin,
183190
Int2: 1, // article "Hello, World!"
184191
BlogID: blogID,
185192
}

0 commit comments

Comments
 (0)