ljw 1 год назад
Родитель
Сommit
72c196c6f9
1 измененных файлов с 8 добавлено и 0 удалено
  1. 8 0
      service/addressBook.go

+ 8 - 0
service/addressBook.go

@@ -70,6 +70,14 @@ func (s *AddressBookService) UpdateAddressBook(abs []*model.AddressBook, userId
70
 		ab.UserId = userId
70
 		ab.UserId = userId
71
 		if !ok {
71
 		if !ok {
72
 			//添加
72
 			//添加
73
+			if ab.Platform == "" || ab.Username == "" || ab.Hostname == "" {
74
+				peer := AllService.PeerService.FindById(ab.Id)
75
+				if peer.RowId != 0 {
76
+					ab.Platform = AllService.AddressBookService.PlatformFromOs(peer.Os)
77
+					ab.Username = peer.Username
78
+					ab.Hostname = peer.Hostname
79
+				}
80
+			}
73
 			tx.Create(ab)
81
 			tx.Create(ab)
74
 		} else {
82
 		} else {
75
 			//更新
83
 			//更新