response

package
v0.0.0-...-22bb83e Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 14, 2021 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ERROR   = 7
	SUCCESS = 0
)

Variables

View Source
var (
	// Admin
	ErrorUserNoExist        = errors.New(`用户不存在! err: record not found`)
	ErrorAdminDelete        = errors.New(`用户名为admin, 不允许删除`)
	ErrorWrongPassword      = errors.New(`密码错误`)
	ErrorEncryptedPassword  = errors.New(`密码加密失败`)
	ErrorUsernameRegistered = errors.New(`用户名已注册`)

	// Jwt
	ErrorJwt2Redis     = errors.New(`设置登录状态失败`)
	ErrorCreateToken   = errors.New(`创建token失败`)
	ErrorInvalidateJwt = errors.New(`jwt作废失败`)

	// Authority
	ErrorUseAuthority    = errors.New(`此角色有用户正在使用禁止删除`)
	ErrorHasSonAuthority = errors.New(`此角色存在子角色不允许删除`)
	ErrorSameAuthorityId = errors.New("已存在相同的角色id")

	// Dictionary
	ErrorSameType = errors.New("已存在数据,不允许创建")

	// Api
	ErrorSameApi = errors.New("已存在记录")

	// JsonWebToken
	TokenExpired     = errors.New(`无法处理这个令牌! `)
	TokenInvalid     = errors.New(`令牌已过期! `)
	TokenMalformed   = errors.New(`这不是一个有效的令牌! `)
	TokenNotValidYet = errors.New(`令牌尚未激活! `)

	// Menu
	ErrorUpdateMenu       = errors.New(`更新失败`)
	ErrorUpdateMenuName   = errors.New(`存在相同name, 修改失败`)
	ErrorHasChildrenMenu  = errors.New(`此菜单存在子菜单不可删除`)
	ErrorCreateParameters = errors.New(`创建menu的Parameters失败`)

	// Casbin
	ErrorAddPolicies = errors.New(`存在相同api, 添加失败, 请联系管理员`)
)
View Source
var Message = map[Code]string{

	ServerBusy: "服务器忙ing...",

	SuccessStart: "成功码开始!",

	SuccessAdd:          "添加成功!",
	SuccessFirst:        "获取一条数据成功!",
	SuccessCreated:      "创建成功!",
	SuccessUpdated:      "更新成功!",
	SuccessDeleted:      "删除成功!",
	SuccessGetList:      "获取列表数据成功!",
	SuccessOperation:    "操作成功!",
	SuccessBatchDeleted: "批量删除成功!",

	SuccessAdminLogin:     "登录成功!",
	SuccessSetAuthority:   "设置角色成功!",
	SuccessSetAdminInfo:   "更新用户信息成功!",
	SuccessAdminRegister:  "注册成功!",
	SuccessChangePassword: "修改密码成功!",

	SuccessCaptcha: "验证码获取成功!",

	SuccessCopyAuthority:    "复制角色成功!",
	SuccessCreateAuthority:  "创建角色成功!",
	SuccessSetDataAuthority: "创建角色成功!",

	SuccessJwtBlackList: "jwt作废成功!",

	SuccessEnd: "成功码结束!",

	ErrorStart: "失败码开始!",

	ErrorAdd:          "添加失败!",
	ErrorFirst:        "获取一条数据失败!",
	ErrorCreated:      "创建失败!",
	ErrorUpdated:      "更新失败!",
	ErrorDeleted:      "删除失败!",
	ErrorGetList:      "获取列表数据失败!",
	ErrorOperation:    "操作失败!",
	ErrorBatchDeleted: "批量删除失败!",

	ErrorAdminLogin:     "登录失败!",
	ErrorSetAuthority:   "设置角色失败!",
	ErrorSetAdminInfo:   "更新用户信息失败!",
	ErrorAdminRegister:  "注册失败!",
	ErrorChangePassword: "修改密码失败!",

	ErrorCaptcha: "验证码获取失败!",

	ErrorCopyAuthority:    "复制角色失败!",
	ErrorCreateAuthority:  "创建角色失败!",
	ErrorSetDataAuthority: "设置失败失败!",

	ErrorJwtBlackList: "jwt作废失败!",

	ErrorEnd: "失败码结束!",

	AdminNotFind: "管理员用户不存在!",
}

Functions

This section is empty.

Types

type Captcha

type Captcha struct {
	Id   string `json:"captchaId"`
	Path string `json:"picPath"`
}

type Code

type Code int
const (
	// 基础码
	ServerBusy Code = iota

	// 成功
	SuccessStart

	SuccessAdd
	SuccessFirst
	SuccessCreated
	SuccessDeleted
	SuccessUpdated
	SuccessGetList
	SuccessOperation
	SuccessBatchDeleted

	// admin
	SuccessAdminLogin
	SuccessSetAuthority
	SuccessSetAdminInfo
	SuccessAdminRegister
	SuccessChangePassword

	// captcha
	SuccessCaptcha

	// Authority
	SuccessCopyAuthority
	SuccessCreateAuthority
	SuccessSetDataAuthority

	// JwtBlackList
	SuccessJwtBlackList

	// BreakpointContinue
	SuccessFind
	SuccessFinish
	SuccessCreateChunk
	SuccessRemoveChunk

	// Uploader
	SuccessCheckFileMd5
	SuccessMergeFileMd5

	SuccessEnd

	//失败
	ErrorStart

	ErrorAdd
	ErrorFirst
	ErrorCreated
	ErrorUpdated
	ErrorDeleted
	ErrorGetList
	ErrorOperation
	ErrorBatchDeleted

	// admin
	ErrorAdminLogin
	ErrorSetAuthority
	ErrorSetAdminInfo
	ErrorAdminRegister
	ErrorChangePassword

	// captcha
	ErrorCaptcha

	// Authority
	ErrorCopyAuthority
	ErrorCreateAuthority
	ErrorSetDataAuthority

	// JwtBlackList
	ErrorJwtBlackList

	// BreakpointContinue
	ErrorFind
	ErrorFinish
	ErrorFormFile
	ErrorCreateChunk
	ErrorRemoveChunk

	// Uploader
	ErrorCheckFileMd5
	ErrorMergeFileMd5

	ErrorEnd

	// 自定义码
	AdminNotFind
)

func (Code) Message

func (c Code) Message() string

@author: [SliverHorn](https://github.com/SliverHorn) @description: code 对应 massage

type Columns

type Columns struct {
	DataType      string `orm:"data_type" json:"dataType"`
	ColumnName    string `orm:"column_name" json:"columnName"`
	DataTypeLong  string `orm:"data_type_long" json:"dataTypeLong"`
	ColumnComment string `orm:"column_comment" json:"columnComment"`
}

type Cpu

type Cpu struct {
	Cpus  []float64 `json:"cpus"`
	Cores int       `json:"cores"`
}

type Dbs

type Dbs struct {
	Database string `json:"database"`
}

type Disk

type Disk struct {
	UsedMB      int `json:"usedMb"`
	UsedGB      int `json:"usedGb"`
	TotalMB     int `json:"totalMb"`
	TotalGB     int `json:"totalGb"`
	UsedPercent int `json:"usedPercent"`
}

type Handler

type Handler struct{}

func (*Handler) Handler

func (h *Handler) Handler() func(handler handler) func(r *ghttp.Request)

type Os

type Os struct {
	GOOS         string `json:"goos"`
	NumCPU       int    `json:"numCpu"`
	Compiler     string `json:"compiler"`
	GoVersion    string `json:"goVersion"`
	NumGoroutine int    `json:"numGoroutine"`
}

type PageResult

type PageResult struct {
	List     interface{} `json:"list"`
	Total    int         `json:"total"`
	Page     int         `json:"page"`
	PageSize int         `json:"pageSize"`
}

type PolicyPath

type PolicyPath struct {
	Paths []request.CasbinInfo `json:"paths"`
}

type Response

type Response struct {
	Code        int         `json:"code"`
	MessageCode Code        `json:"-"`
	Data        interface{} `json:"data"`
	Error       error       `json:"-"`
	Err         string      `json:"err,omitempty"`
	Message     string      `json:"msg"`
}

type Rrm

type Rrm struct {
	UsedMB      int `json:"usedMb"`
	TotalMB     int `json:"totalMb"`
	UsedPercent int `json:"usedPercent"`
}

type Server

type Server struct {
	Os   Os   `json:"os"`
	Cpu  Cpu  `json:"cpu"`
	Rrm  Rrm  `json:"ram"`
	Disk Disk `json:"disk"`
}

type Tables

type Tables struct {
	TableName string `json:"tableName"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL