32 lines
749 B
Go
32 lines
749 B
Go
package user
|
|
|
|
import (
|
|
"nixcn-cms/internal/exception"
|
|
"nixcn-cms/service"
|
|
"nixcn-cms/utils"
|
|
|
|
"github.com/gin-gonic/gin"
|
|
)
|
|
|
|
func (self *UserHandler) List(c *gin.Context) {
|
|
limit, limitStatus := c.GetQuery("limit")
|
|
offset, offsetStatus := c.GetQuery("offset")
|
|
|
|
userListPayload := &service.UserListPayload{
|
|
Context: c,
|
|
Limit: &limit,
|
|
LimitStatus: &limitStatus,
|
|
Offset: &offset,
|
|
OffsetStatus: &offsetStatus,
|
|
}
|
|
|
|
result := self.svc.ListUsers(userListPayload)
|
|
|
|
if result.Common.Exception.Original != exception.CommonSuccess {
|
|
utils.HttpResponse(c, result.Common.HttpCode, result.Common.Exception.String())
|
|
return
|
|
}
|
|
|
|
utils.HttpResponse(c, result.Common.HttpCode, result.Common.Exception.String(), result.Data)
|
|
}
|