生成 user 的接口代码
This commit is contained in:
@ -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)
|
||||||
}
|
}
|
||||||
|
|||||||
@ -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"`
|
||||||
}
|
}
|
||||||
|
|||||||
5
internal/controller/user/user.go
Normal file
5
internal/controller/user/user.go
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
// =================================================================================
|
||||||
|
// This is auto-generated by GoFrame CLI tool only once. Fill this file as you wish.
|
||||||
|
// =================================================================================
|
||||||
|
|
||||||
|
package user
|
||||||
15
internal/controller/user/user_new.go
Normal file
15
internal/controller/user/user_new.go
Normal 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{}
|
||||||
|
}
|
||||||
14
internal/controller/user/user_v1_list.go
Normal file
14
internal/controller/user/user_v1_list.go
Normal 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)
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user