|
|
@@ -45,7 +45,7 @@ func (g *Group) Users(c *gin.Context) {
|
|
45
|
45
|
userList = service.AllService.UserService.ListByGroupId(u.GroupId, q.Page, q.PageSize)
|
|
46
|
46
|
}
|
|
47
|
47
|
|
|
48
|
|
- var data []*apiResp.UserPayload
|
|
|
48
|
+ data := make([]*apiResp.UserPayload, 0, len(userList.Users))
|
|
49
|
49
|
for _, user := range userList.Users {
|
|
50
|
50
|
up := &apiResp.UserPayload{}
|
|
51
|
51
|
up.FromUser(user)
|
|
|
@@ -88,14 +88,14 @@ func (g *Group) Peers(c *gin.Context) {
|
|
88
|
88
|
users = service.AllService.UserService.ListIdAndNameByGroupId(u.GroupId)
|
|
89
|
89
|
}
|
|
90
|
90
|
|
|
91
|
|
- namesById := make(map[uint]string)
|
|
92
|
|
- userIds := make([]uint, 0)
|
|
|
91
|
+ namesById := make(map[uint]string, len(users))
|
|
|
92
|
+ userIds := make([]uint, 0, len(users))
|
|
93
|
93
|
for _, user := range users {
|
|
94
|
94
|
namesById[user.Id] = user.Username
|
|
95
|
95
|
userIds = append(userIds, user.Id)
|
|
96
|
96
|
}
|
|
97
|
97
|
peerList := service.AllService.PeerService.ListByUserIds(userIds, q.Page, q.PageSize)
|
|
98
|
|
- var data []*apiResp.GroupPeerPayload
|
|
|
98
|
+ data := make([]*apiResp.GroupPeerPayload, 0, len(peerList.Peers))
|
|
99
|
99
|
for _, peer := range peerList.Peers {
|
|
100
|
100
|
uname, ok := namesById[peer.UserId]
|
|
101
|
101
|
if !ok {
|
|
|
@@ -103,6 +103,7 @@ func (g *Group) Peers(c *gin.Context) {
|
|
103
|
103
|
}
|
|
104
|
104
|
pp := &apiResp.GroupPeerPayload{}
|
|
105
|
105
|
pp.FromPeer(peer, uname)
|
|
|
106
|
+ //pp.DeviceGroupName = uname
|
|
106
|
107
|
data = append(data, pp)
|
|
107
|
108
|
|
|
108
|
109
|
}
|
|
|
@@ -111,3 +112,24 @@ func (g *Group) Peers(c *gin.Context) {
|
|
111
|
112
|
Data: data,
|
|
112
|
113
|
})
|
|
113
|
114
|
}
|
|
|
115
|
+
|
|
|
116
|
+// Device
|
|
|
117
|
+// @Tags 群组
|
|
|
118
|
+// @Summary 设备
|
|
|
119
|
+// @Description 机器
|
|
|
120
|
+// @Accept json
|
|
|
121
|
+// @Produce json
|
|
|
122
|
+// @Param page query int false "页码"
|
|
|
123
|
+// @Param pageSize query int false "每页数量"
|
|
|
124
|
+// @Param status query int false "状态"
|
|
|
125
|
+// @Param accessible query string false "accessible"
|
|
|
126
|
+// @Success 200 {object} response.DataResponse
|
|
|
127
|
+// @Failure 500 {object} response.Response
|
|
|
128
|
+// @Router /device-group/accessible [get]
|
|
|
129
|
+// @Security BearerAuth
|
|
|
130
|
+func (g *Group) Device(c *gin.Context) {
|
|
|
131
|
+ c.JSON(http.StatusOK, response.DataResponse{
|
|
|
132
|
+ Total: 0,
|
|
|
133
|
+ Data: nil,
|
|
|
134
|
+ })
|
|
|
135
|
+}
|