From 72c196c6f9bbd19cf698c125b80835dbad7c8935 Mon Sep 17 00:00:00 2001 From: ljw <84855512@qq.com> Date: Wed, 16 Oct 2024 10:10:20 +0800 Subject: [PATCH] fix pc add #13 --- service/addressBook.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/service/addressBook.go b/service/addressBook.go index ae5f484..a23e97b 100644 --- a/service/addressBook.go +++ b/service/addressBook.go @@ -70,6 +70,14 @@ func (s *AddressBookService) UpdateAddressBook(abs []*model.AddressBook, userId ab.UserId = userId 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) } else { //更新