feat:完善项目
This commit is contained in:
@ -6,32 +6,43 @@ import (
|
||||
"strings"
|
||||
)
|
||||
|
||||
type idForm struct {
|
||||
type IDForm struct {
|
||||
ID uint64 `json:"id" form:"id" binding:"required"`
|
||||
}
|
||||
|
||||
type uidForm struct {
|
||||
type IDStringForm struct {
|
||||
ID string `json:"id" form:"id"`
|
||||
}
|
||||
|
||||
func (this *IDStringForm) Convert() uint64 {
|
||||
if this.ID == "" {
|
||||
return 0
|
||||
}
|
||||
return uint64(utils.HASHIDDecode(this.ID))
|
||||
}
|
||||
|
||||
type UIDForm struct {
|
||||
UID string `json:"uid" form:"uid" binding:"required"`
|
||||
}
|
||||
|
||||
func (this *uidForm) Convert() uint64 {
|
||||
func (this *UIDForm) Convert() uint64 {
|
||||
return utils.StringToUnit64(this.UID)
|
||||
}
|
||||
|
||||
type imageForm struct {
|
||||
type ImageForm struct {
|
||||
Image string `json:"image" form:"image"`
|
||||
}
|
||||
|
||||
func (this *imageForm) FilterImageURL() string {
|
||||
func (this *ImageForm) FilterImageURL() string {
|
||||
return strings.Replace(this.Image, config.SettingInfo.Domain, "", -1)
|
||||
}
|
||||
|
||||
type positionForm struct {
|
||||
type PositionForm struct {
|
||||
Longitude float64 `json:"longitude" form:"longitude" binding:"required"`
|
||||
Latitude float64 `json:"latitude" form:"latitude" binding:"required"`
|
||||
}
|
||||
|
||||
type pageForm struct {
|
||||
type PageForm struct {
|
||||
Page int `json:"current" form:"current" binding:"required"`
|
||||
PageSize int `json:"pageSize" form:"pageSize" binding:"required"`
|
||||
PageSize int `json:"page_size" form:"page_size" binding:"required"`
|
||||
}
|
||||
|
Reference in New Issue
Block a user