Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

使用这个插件生成出来的代码handler和logic两边参数不匹配,handler传递的是结构体指针,logic接受的是结构体 #12

Open
you-eye opened this issue May 19, 2023 · 0 comments

Comments

@you-eye
Copy link

you-eye commented May 19, 2023

`func LoginHandler(ctx *svc.ServiceContext) http.HandlerFunc {

return func(w http.ResponseWriter, r *http.Request) {
	var req types.LoginReq
	if err := httpx.Parse(r, &req); err != nil {
		httpx.Error(w, err)
		return
	}
	l := user.NewLoginLogic(r.Context(), ctx)
	resp, err := l.Login(&req)
	if err != nil {
		httpx.Error(w, err)
	} else {
		httpx.OkJson(w, resp)
	}
}

}`

`func NewLoginLogic(ctx context.Context, svcCtx *svc.ServiceContext) LoginLogic {

return LoginLogic{
	Logger: logx.WithContext(ctx),
	ctx:    ctx,
	svcCtx: svcCtx,
}

}

func (l *LoginLogic) Login(req types.LoginReq) (resp *types.LoginReply, err error) {
// todo: add your logic here and delete this line

return

}
`

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant