From 5f1166965d5eb357179af99ce894feef51a5d023 Mon Sep 17 00:00:00 2001 From: lejianwen <84855512@qq.com> Date: Wed, 25 Dec 2024 19:04:42 +0800 Subject: [PATCH] fix(api): Get ab list when personal is disabled (#86) --- http/controller/api/ab.go | 21 ++------------------- http/controller/api/webClient.go | 2 +- 2 files changed, 3 insertions(+), 20 deletions(-) diff --git a/http/controller/api/ab.go b/http/controller/api/ab.go index e3896d5..eee3604 100644 --- a/http/controller/api/ab.go +++ b/http/controller/api/ab.go @@ -32,8 +32,8 @@ type Ab struct { func (a *Ab) Ab(c *gin.Context) { user := service.AllService.UserService.CurUser(c) - al := service.AllService.AddressBookService.ListByUserId(user.Id, 1, 1000) - tags := service.AllService.TagService.ListByUserId(user.Id) + al := service.AllService.AddressBookService.ListByUserIdAndCollectionId(user.Id, 0, 1, 1000) + tags := service.AllService.TagService.ListByUserIdAndCollectionId(user.Id, 0) tagColors := map[string]uint{} //将tags中的name转成一个以逗号分割的字符串 @@ -98,23 +98,6 @@ func (a *Ab) UpAb(c *gin.Context) { c.JSON(http.StatusOK, nil) } -// Tags -// @Tags 地址 -// @Summary 标签 -// @Description 标签 -// @Accept json -// @Produce json -// @Success 200 {object} []model.Tag -// @Failure 500 {object} response.ErrorResponse -// @Router /tags [post] -// @Security BearerAuth -func (a *Ab) Tags(c *gin.Context) { - user := service.AllService.UserService.CurUser(c) - - tags := service.AllService.TagService.ListByUserId(user.Id) - c.JSON(http.StatusOK, tags.Tags) -} - // PTags // @Tags 地址[Personal] // @Summary 标签 diff --git a/http/controller/api/webClient.go b/http/controller/api/webClient.go index b88ce07..1949b38 100644 --- a/http/controller/api/webClient.go +++ b/http/controller/api/webClient.go @@ -26,7 +26,7 @@ func (i *WebClient) ServerConfig(c *gin.Context) { u := service.AllService.UserService.CurUser(c) peers := map[string]*api.WebClientPeerPayload{} - abs := service.AllService.AddressBookService.ListByUserId(u.Id, 1, 100) + abs := service.AllService.AddressBookService.ListByUserIdAndCollectionId(u.Id, 0, 1, 100) for _, ab := range abs.AddressBooks { pp := &api.WebClientPeerPayload{} pp.FromAddressBook(ab)