🎨今儿不想写了
This commit is contained in:
parent
ffb3b69114
commit
7716a15dbb
@ -32,3 +32,16 @@ func (clients) List(c *gin.Context) {
|
|||||||
|
|
||||||
utils.GinResponse(c).OkWithPage(data, total, p.Current, p.Size)
|
utils.GinResponse(c).OkWithPage(data, total, p.Current, p.Size)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Save
|
||||||
|
// @description: 新增/更新客户端
|
||||||
|
// @receiver clients
|
||||||
|
// @param c
|
||||||
|
func (clients) Save(c *gin.Context) {
|
||||||
|
var p param.SaveClient
|
||||||
|
if err := c.ShouldBind(&p); err != nil {
|
||||||
|
utils.GinResponse(c).FailedWithErr("参数错误", err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
@ -1,7 +1,27 @@
|
|||||||
package param
|
package param
|
||||||
|
|
||||||
|
import "wireguard-dashboard/model/template_data"
|
||||||
|
|
||||||
// ClientList
|
// ClientList
|
||||||
// @description: 客户端列表
|
// @description: 客户端列表
|
||||||
type ClientList struct {
|
type ClientList struct {
|
||||||
page
|
page
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// SaveClient
|
||||||
|
// @description: 新增/编辑客户端
|
||||||
|
type SaveClient struct {
|
||||||
|
Id string `json:"id" form:"id" binding:"omitempty"`
|
||||||
|
ServerId string `json:"serverId" form:"serverId" binding:"required"`
|
||||||
|
Name string `json:"name" form:"name" binding:"required"`
|
||||||
|
Email string `json:"email" form:"email" binding:"omitempty"`
|
||||||
|
SubnetRange string `json:"subnetRange" form:"subnetRange" binding:"omitempty"`
|
||||||
|
IpAllocation string `json:"ipAllocation" form:"ipAllocation" binding:"required"`
|
||||||
|
AllowedIPS string `json:"allowedIPS" form:"allowedIPS" binding:"required"`
|
||||||
|
ExtraAllowedIPS string `json:"extraAllowedIPS" form:"extraAllowedIPS" binding:"omitempty"`
|
||||||
|
Endpoint string `json:"endpoint" form:"endpoint" binding:"omitempty"`
|
||||||
|
UseServerDNS int `json:"useServerDNS" form:"useServerDNS" binding:"required,oneof=1 0"`
|
||||||
|
EnabledAfterCreation int `json:"enabledAfterCreation" form:"enabledAfterCreation" binding:"required,oneof=1 0"`
|
||||||
|
Keys *template_data.Keys `json:"keys" form:"keys" binding:"omitempty"`
|
||||||
|
Enabled int `json:"enabled" form:"enabled" binding:"required,oneof=1 0"`
|
||||||
|
}
|
||||||
|
@ -44,3 +44,12 @@ func (r clientRepo) List(p param.ClientList) (data []vo.Client, total int64, err
|
|||||||
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Save
|
||||||
|
// @description: 新增/编辑客户端
|
||||||
|
// @receiver r
|
||||||
|
// @param p
|
||||||
|
// @return err
|
||||||
|
func (r clientRepo) Save(p param.SaveClient) (err error) {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user