49 lines
1.4 KiB
Go
49 lines
1.4 KiB
Go
package radio
|
|
|
|
import (
|
|
"strconv"
|
|
"sundynix-go/global"
|
|
common "sundynix-go/model/commom/request"
|
|
"sundynix-go/model/commom/response"
|
|
|
|
"github.com/gin-gonic/gin"
|
|
"go.uber.org/zap"
|
|
)
|
|
|
|
type UserApi struct{}
|
|
|
|
// GetRadioUserList 获取电台用户列表
|
|
// @Tags 用户管理
|
|
// @Summary 获取电台用户列表(含订阅/收听统计)
|
|
// @Accept application/json
|
|
// @Produce application/json
|
|
// @Param current query int false "页码"
|
|
// @Param pageSize query int false "每页大小"
|
|
// @Param keyword query string false "搜索关键字"
|
|
// @Param isVip query int false "VIP筛选: 0全部 1VIP 2非VIP"
|
|
// @Success 200 {object} response.Response
|
|
// @Router /radio/user/list [get]
|
|
func (a *UserApi) GetRadioUserList(c *gin.Context) {
|
|
var info common.PageInfo
|
|
info.Keyword = c.Query("keyword")
|
|
current, _ := strconv.Atoi(c.DefaultQuery("current", "1"))
|
|
pageSize, _ := strconv.Atoi(c.DefaultQuery("pageSize", "10"))
|
|
info.Current = current
|
|
info.PageSize = pageSize
|
|
|
|
isVip, _ := strconv.Atoi(c.DefaultQuery("isVip", "0"))
|
|
|
|
list, total, err := userService.GetRadioUserList(info, isVip, info.Keyword)
|
|
if err != nil {
|
|
global.Logger.Error("获取用户列表失败!", zap.Error(err))
|
|
response.FailWithMsg(err.Error(), c)
|
|
return
|
|
}
|
|
response.OkWithData(response.PageResult{
|
|
List: list,
|
|
Total: total,
|
|
Page: info.Current,
|
|
PageSize: info.PageSize,
|
|
}, c)
|
|
}
|