🎨新增客户端状态字段

This commit is contained in:
coward
2024-03-11 14:53:28 +08:00
parent 16799ee5d8
commit 71d6090f94
10 changed files with 1002 additions and 0 deletions

34
http/api/client.go Normal file
View 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)
}