🤬
  • fix(import): 集群导入默认 admin 为站内信接收用户

  • Loading...
  • ssongliu committed 2 years ago
    b9f695ed
    1 parent 83619ba9
Revision indexing in progress... (symbol navigation in revisions will be accurate after indexed)
  • ■ ■ ■ ■ ■ ■
    pkg/service/cluster_import.go
    skipped 206 lines
    207 207   c.handlerImportError(tx, cluster, err)
    208 208   }
    209 209   var user model.User
    210  - db.DB.Model(&model.User{}).Where("name = admin").First(&user)
    211  - 
    212  - subscribeUser := model.MsgSubscribeUser{
    213  - SubscribeID: subscribe.ID,
    214  - UserID: user.ID,
    215  - }
    216  - if err := tx.Create(&subscribeUser).Error; err != nil {
    217  - tx.Rollback()
     210 + _ = db.DB.Model(&model.User{}).Where("name = 'admin'").First(&user).Error
     211 + if user.ID != "" {
     212 + subscribeUser := model.MsgSubscribeUser{
     213 + SubscribeID: subscribe.ID,
     214 + UserID: user.ID,
     215 + }
     216 + if err := tx.Create(&subscribeUser).Error; err != nil {
     217 + c.handlerImportError(tx, cluster, err)
     218 + }
    218 219   }
    219 220   
    220 221   if err := c.projectResourceRepository.Create(model.ProjectResource{
    skipped 331 lines
Please wait...
Page is in error, reload to recover