jz_qr_code_handler.go 705 B

1234567891011121314151617181920212223242526272829
  1. package user
  2. import (
  3. "net/http"
  4. "git.i2edu.net/i2/go-zero/rest/httpx"
  5. "git.i2edu.net/i2/i2-bill-api/internal/logic/user"
  6. "git.i2edu.net/i2/i2-bill-api/internal/svc"
  7. "git.i2edu.net/i2/i2-bill-api/internal/utils"
  8. )
  9. func JzQrCodeHandler(ctx *svc.ServiceContext) http.HandlerFunc {
  10. return func(w http.ResponseWriter, r *http.Request) {
  11. uid, skey, err := ctx.GetClaims(r)
  12. if err != nil {
  13. httpx.OkJson(w, utils.ReturnHTTPFail(err))
  14. return
  15. }
  16. l := user.NewJzQrCodeLogic(r.Context(), ctx)
  17. l.UserId = uid
  18. l.SessionKey = skey
  19. resp, err := l.JzQrCode()
  20. if err != nil {
  21. httpx.OkJson(w, utils.ReturnHTTPFail(err))
  22. } else {
  23. httpx.OkJson(w, utils.ReturnHTTPSuccess(resp))
  24. }
  25. }
  26. }