生成 user 的接口代码

This commit is contained in:
2025-06-05 10:22:31 +08:00
parent 27c6445fe6
commit 8b63f72f99
5 changed files with 42 additions and 13 deletions

View File

@ -11,6 +11,5 @@ import (
) )
type IUserV1 interface { type IUserV1 interface {
Info(ctx context.Context, req *v1.InfoReq) (res *v1.InfoRes, err error)
List(ctx context.Context, req *v1.ListReq) (res *v1.ListRes, err error) List(ctx context.Context, req *v1.ListReq) (res *v1.ListRes, err error)
} }

View File

@ -1,17 +1,13 @@
package user package v1
import "github.com/gogf/gf/v2/frame/g" import "github.com/gogf/gf/v2/frame/g"
type InfoReq struct {
g.Meta `path:"/user/info" method:"get" tags:"User" summary:"获取用户信息"`
}
type InfoRes struct {
}
type ListReq struct { type ListReq struct {
g.Meta `path:"/user" method:"get" tags:"User" summary:"获取用户列表"` g.Meta `path:"/user/list" method:"get" tags:"User" summary:"获取用户列表"`
Page int `json:"page" v:"required" dc:"页数"` Page int `json:"page" dc:"页数"`
Size int `json:"size" v:"required" dc:"页数"` Size int `json:"size" dc:"页数"`
Nickname string `json:"nickname" dc:"昵称"` }
type ListRes struct {
List interface{} `json:"list"`
Total int `json:"total"`
} }

View File

@ -0,0 +1,5 @@
// =================================================================================
// This is auto-generated by GoFrame CLI tool only once. Fill this file as you wish.
// =================================================================================
package user

View File

@ -0,0 +1,15 @@
// =================================================================================
// This is auto-generated by GoFrame CLI tool only once. Fill this file as you wish.
// =================================================================================
package user
import (
"server/api/user"
)
type ControllerV1 struct{}
func NewV1() user.IUserV1 {
return &ControllerV1{}
}

View File

@ -0,0 +1,14 @@
package user
import (
"context"
"github.com/gogf/gf/v2/errors/gcode"
"github.com/gogf/gf/v2/errors/gerror"
"server/api/user/v1"
)
func (c *ControllerV1) List(ctx context.Context, req *v1.ListReq) (res *v1.ListRes, err error) {
return nil, gerror.NewCode(gcode.CodeNotImplemented)
}