refactor: interface{} -> any

feat: 新增外链菜单
This commit is contained in:
meilin.huang
2023-06-01 12:31:32 +08:00
parent 9900b236ef
commit 17d96acceb
106 changed files with 316 additions and 312 deletions

View File

@@ -13,14 +13,14 @@ import (
)
// 绑定并校验请求结构体参数
func BindJsonAndValid(g *gin.Context, data interface{}) {
func BindJsonAndValid(g *gin.Context, data any) {
if err := g.ShouldBindJSON(data); err != nil {
panic(biz.NewBizErr(err.Error()))
}
}
// 绑定查询字符串到
func BindQuery(g *gin.Context, data interface{}) {
func BindQuery(g *gin.Context, data any) {
if err := g.ShouldBindQuery(data); err != nil {
panic(biz.NewBizErr(err.Error()))
}
@@ -65,12 +65,12 @@ func Download(g *gin.Context, reader io.Reader, filename string) {
}
// 返回统一成功结果
func SuccessRes(g *gin.Context, data interface{}) {
func SuccessRes(g *gin.Context, data any) {
g.JSON(http.StatusOK, model.Success(data))
}
// 返回失败结果集
func ErrorRes(g *gin.Context, err interface{}) {
func ErrorRes(g *gin.Context, err any) {
switch t := err.(type) {
case biz.BizError:
g.JSON(http.StatusOK, model.Error(t))