Просмотр исходного кода

fix(api): Get ab list when personal is disabled (#86)

lejianwen 1 год назад
Родитель
Сommit
5f1166965d
2 измененных файлов с 3 добавлено и 20 удалено
  1. 2 19
      http/controller/api/ab.go
  2. 1 1
      http/controller/api/webClient.go

+ 2 - 19
http/controller/api/ab.go

@@ -32,8 +32,8 @@ type Ab struct {
32
 func (a *Ab) Ab(c *gin.Context) {
32
 func (a *Ab) Ab(c *gin.Context) {
33
 	user := service.AllService.UserService.CurUser(c)
33
 	user := service.AllService.UserService.CurUser(c)
34
 
34
 
35
-	al := service.AllService.AddressBookService.ListByUserId(user.Id, 1, 1000)
36
-	tags := service.AllService.TagService.ListByUserId(user.Id)
35
+	al := service.AllService.AddressBookService.ListByUserIdAndCollectionId(user.Id, 0, 1, 1000)
36
+	tags := service.AllService.TagService.ListByUserIdAndCollectionId(user.Id, 0)
37
 
37
 
38
 	tagColors := map[string]uint{}
38
 	tagColors := map[string]uint{}
39
 	//将tags中的name转成一个以逗号分割的字符串
39
 	//将tags中的name转成一个以逗号分割的字符串
@@ -98,23 +98,6 @@ func (a *Ab) UpAb(c *gin.Context) {
98
 	c.JSON(http.StatusOK, nil)
98
 	c.JSON(http.StatusOK, nil)
99
 }
99
 }
100
 
100
 
101
-// Tags
102
-// @Tags 地址
103
-// @Summary 标签
104
-// @Description 标签
105
-// @Accept  json
106
-// @Produce  json
107
-// @Success 200 {object} []model.Tag
108
-// @Failure 500 {object} response.ErrorResponse
109
-// @Router /tags [post]
110
-// @Security BearerAuth
111
-func (a *Ab) Tags(c *gin.Context) {
112
-	user := service.AllService.UserService.CurUser(c)
113
-
114
-	tags := service.AllService.TagService.ListByUserId(user.Id)
115
-	c.JSON(http.StatusOK, tags.Tags)
116
-}
117
-
118
 // PTags
101
 // PTags
119
 // @Tags 地址[Personal]
102
 // @Tags 地址[Personal]
120
 // @Summary 标签
103
 // @Summary 标签

+ 1 - 1
http/controller/api/webClient.go

@@ -26,7 +26,7 @@ func (i *WebClient) ServerConfig(c *gin.Context) {
26
 	u := service.AllService.UserService.CurUser(c)
26
 	u := service.AllService.UserService.CurUser(c)
27
 
27
 
28
 	peers := map[string]*api.WebClientPeerPayload{}
28
 	peers := map[string]*api.WebClientPeerPayload{}
29
-	abs := service.AllService.AddressBookService.ListByUserId(u.Id, 1, 100)
29
+	abs := service.AllService.AddressBookService.ListByUserIdAndCollectionId(u.Id, 0, 1, 100)
30
 	for _, ab := range abs.AddressBooks {
30
 	for _, ab := range abs.AddressBooks {
31
 		pp := &api.WebClientPeerPayload{}
31
 		pp := &api.WebClientPeerPayload{}
32
 		pp.FromAddressBook(ab)
32
 		pp.FromAddressBook(ab)