:tada:初步完成用户

This commit is contained in:
coward
2024-10-18 17:19:19 +08:00
commit f375118c88
45 changed files with 3302 additions and 0 deletions

25
utils/paginate.go Normal file
View File

@@ -0,0 +1,25 @@
package utils
type paginate struct{}
func Paginate() paginate {
return paginate{}
}
// Generate
// @description: 生成页码
// @receiver paginate
// @param count
// @param size
// @return int
func (paginate) Generate(count int64, size int) int {
totalPage := 0
if count > 0 {
upPage := 0
if int(count)%size > 0 {
upPage = 1
}
totalPage = (int(count) / size) + upPage
}
return totalPage
}