From bc38dd03d9b276c2098ed8c98d5647c8a7448fff Mon Sep 17 00:00:00 2001 From: Hossin Asaadi Date: Sun, 13 Nov 2022 08:17:46 -0500 Subject: [PATCH] fix add bug --- web/service/inbound.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/web/service/inbound.go b/web/service/inbound.go index 57d3933c..7dbeb272 100644 --- a/web/service/inbound.go +++ b/web/service/inbound.go @@ -58,9 +58,12 @@ func (s *InboundService) AddInbound(inbound *model.Inbound) (*model.Inbound,erro return inbound, common.NewError("端口已存在:", inbound.Port) } db := database.GetDB() - s.UpdateClientStat(inbound.Id,inbound.Settings) - return inbound, db.Save(inbound).Error + err = db.Save(inbound).Error + if err == nil { + s.UpdateClientStat(inbound.Id,inbound.Settings) + } + return inbound, err } func (s *InboundService) AddInbounds(inbounds []*model.Inbound) error {