53 lines
1.1 KiB
Go
53 lines
1.1 KiB
Go
package dto
|
|
|
|
type TokenRespDto struct {
|
|
Code int `json:"code"`
|
|
Token string `json:"token"`
|
|
Expire string `json:"expire"`
|
|
}
|
|
|
|
type ErrorDto struct {
|
|
Code int `json:"code"`
|
|
Message string `json:"message"`
|
|
}
|
|
|
|
type OrderItem struct {
|
|
Column string `form:"column" json:"column"`
|
|
Asc bool `form:"asc" json:"asc"`
|
|
}
|
|
|
|
type PageQueryDto struct {
|
|
// 页码
|
|
Page int `form:"page" json:"page" binding:"required" example:"1"`
|
|
// 页面行数
|
|
Size int `form:"size" json:"size" binding:"required" example:"10"`
|
|
// 排序项
|
|
Orders []OrderItem `form:"orders" json:"orders"`
|
|
}
|
|
|
|
type PageDto struct {
|
|
Total int `form:"total" json:"total"`
|
|
PageQueryDto
|
|
Records any `form:"records" json:"records"`
|
|
}
|
|
|
|
// 数据库分页偏移
|
|
func (p *PageQueryDto) Offset() int {
|
|
if p.Page > 0 {
|
|
return (p.Page - 1) * p.Size
|
|
}
|
|
return 0
|
|
}
|
|
|
|
func (p *PageQueryDto) Default() {
|
|
p.Page = 1
|
|
p.Size = 10
|
|
}
|
|
|
|
type LoginDto struct {
|
|
// 账号
|
|
Account string `form:"account" json:"account" binding:"required" example:"17791995809"`
|
|
// 加密密码
|
|
Password string `form:"password" json:"password" binding:"required" example:"95129dbaace576e46f41a629e6f35d5c"`
|
|
}
|