You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

34 lines
741 B
Go

package manage
import (
"fmt"
"github.com/gin-gonic/gin"
"gold-shop/errors"
request "gold-shop/request/manage"
"gold-shop/service"
"gold-shop/utils/excel"
"gold-shop/utils/result"
)
func GetUsers(c *gin.Context) (result.Data, error) {
var req request.UserQueryRequest
err := c.ShouldBindQuery(&req)
fmt.Println("ssp", req)
if err != nil {
return nil, errors.NewBusinessError("参数错误")
}
users, total := service.UserService.GetUsers(req)
data := result.Data{
"records": users,
"total": total,
}
return data, nil
}
func DownloadUsers(c *gin.Context) {
var req request.UserQueryRequest
_ = c.ShouldBindQuery(&req)
f := service.UserService.GenerateUsersExcel(req)
excel.Download(f, "用户列表.xlsx", c)
}