1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677 |
- package forms
- import (
- "errors"
- "strings"
- )
- type GetDrainageServerReq struct {
- }
- func (req *GetDrainageServerReq) Check() error {
- return nil
- }
- type EditDrainageServerReq struct {
- ServerIds []int32 `json:"server_ids" form:"server_ids"`
- }
- func (req *EditDrainageServerReq) Check() error {
- if len(req.ServerIds) == 0 {
- return errors.New("请选择有效的服务器")
- }
- return nil
- }
- type GetDisplayServerReq struct {
- }
- func (req *GetDisplayServerReq) Check() error {
- return nil
- }
- type GetDisplayServerRes struct {
- ServerIds []int32 `json:"server_ids"`
- MaxOpendServerId int32 `json:"maxOpendServerId"`
- MaxDeployServerId int32 `json:"maxDeployServerId" form:"maxDeployServerId"`
- }
- type EditDisplayServerReq struct {
- ServerIds []int32 `json:"server_ids" form:"server_ids"`
- MaxOpendServerId int32 `json:"maxOpendServerId" form:"maxOpendServerId"`
- MaxDeployServerId int32 `json:"maxDeployServerId" form:"maxDeployServerId"`
- }
- func (req *EditDisplayServerReq) Check() error {
- //if len(req.ServerIds) == 0 {
- // return errors.New("请选择有效的服务器")
- //}
- if req.MaxOpendServerId <= 0 {
- return errors.New("最大开放服务器ID必须大于0")
- }
- return nil
- }
- type GetWhiteListServerReq struct {
- }
- func (req *GetWhiteListServerReq) Check() error {
- return nil
- }
- type EditWhiteListServerReq struct {
- ServerIds []int `json:"server_ids" form:"server_ids"`
- PlayerIds string `json:"player_ids" form:"player_ids"`
- }
- func (req *EditWhiteListServerReq) Check() error {
- if len(req.ServerIds) == 0 {
- return errors.New("请选择有效的服务器")
- }
- if strings.ReplaceAll(req.PlayerIds, " ", "") == "" {
- req.PlayerIds = ""
- }
- return nil
- }
|