🎨新增客户端状态字段
This commit is contained in:
34
http/api/client.go
Normal file
34
http/api/client.go
Normal file
@@ -0,0 +1,34 @@
|
||||
package api
|
||||
|
||||
import (
|
||||
"github.com/gin-gonic/gin"
|
||||
"wireguard-dashboard/http/param"
|
||||
"wireguard-dashboard/repository"
|
||||
"wireguard-dashboard/utils"
|
||||
)
|
||||
|
||||
type clients struct{}
|
||||
|
||||
func Client() clients {
|
||||
return clients{}
|
||||
}
|
||||
|
||||
// List
|
||||
// @description: 客户端列表
|
||||
// @receiver clients
|
||||
// @param c
|
||||
func (clients) List(c *gin.Context) {
|
||||
var p param.ClientList
|
||||
if err := c.ShouldBind(&p); err != nil {
|
||||
utils.GinResponse(c).FailedWithErr("参数错误", err)
|
||||
return
|
||||
}
|
||||
|
||||
data, total, err := repository.Client().List(p)
|
||||
if err != nil {
|
||||
utils.GinResponse(c).FailedWithMsg("获取失败")
|
||||
return
|
||||
}
|
||||
|
||||
utils.GinResponse(c).OkWithPage(data, total, p.Current, p.Size)
|
||||
}
|
Reference in New Issue
Block a user