Skip to content

Commit

Permalink
fix(api): Get ab list when personal is disabled (#86)
Browse files Browse the repository at this point in the history
  • Loading branch information
lejianwen committed Dec 25, 2024
1 parent 0dbab18 commit 5f11669
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 20 deletions.
21 changes: 2 additions & 19 deletions http/controller/api/ab.go
Original file line number Diff line number Diff line change
Expand Up @@ -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转成一个以逗号分割的字符串
Expand Down Expand Up @@ -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 标签
Expand Down
2 changes: 1 addition & 1 deletion http/controller/api/webClient.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 5f11669

Please sign in to comment.