finduserhandler.go 624 B

1234567891011121314151617181920212223242526
  1. package handler
  2. import (
  3. "net/http"
  4. "slow_wild_api/apps/internal/logic"
  5. "slow_wild_api/apps/internal/response"
  6. "slow_wild_api/apps/internal/svc"
  7. "slow_wild_api/apps/internal/types"
  8. "github.com/zeromicro/go-zero/rest/httpx"
  9. )
  10. // 查询用户
  11. func findUserHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
  12. return func(w http.ResponseWriter, r *http.Request) {
  13. var req types.FindUserReq
  14. if err := httpx.Parse(r, &req); err != nil {
  15. httpx.ErrorCtx(r.Context(), w, err)
  16. return
  17. }
  18. l := logic.NewFindUserLogic(r.Context(), svcCtx)
  19. resp, err := l.FindUser(&req)
  20. response.Response(w, resp, err)
  21. }
  22. }