fix pc add #13

This commit is contained in:
ljw
2024-10-16 10:10:20 +08:00
parent 28f047ec79
commit 72c196c6f9

View File

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