Browse Source

fix pc add #13

ljw 1 year ago
parent
commit
24f570b64f
1 changed files with 8 additions and 0 deletions
  1. 8 0
      service/addressBook.go

+ 8 - 0
service/addressBook.go

@@ -70,6 +70,14 @@ func (s *AddressBookService) UpdateAddressBook(abs []*model.AddressBook, userId
70 70
 		ab.UserId = userId
71 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 81
 			tx.Create(ab)
74 82
 		} else {
75 83
 			//更新