1234567891011121314151617181920212223242526272829 |
- package user
- import (
- "net/http"
- "git.i2edu.net/i2/go-zero/rest/httpx"
- "git.i2edu.net/i2/i2-bill-api/internal/logic/user"
- "git.i2edu.net/i2/i2-bill-api/internal/svc"
- "git.i2edu.net/i2/i2-bill-api/internal/utils"
- )
- func GetUserHandler(ctx *svc.ServiceContext) http.HandlerFunc {
- return func(w http.ResponseWriter, r *http.Request) {
- uid, skey, err := ctx.GetClaims(r)
- if err != nil {
- httpx.OkJson(w, utils.ReturnHTTPFail(err))
- return
- }
- l := user.NewGetUserLogic(r.Context(), ctx)
- l.UserId = uid
- l.SessionKey = skey
- resp, err := l.GetUser()
- if err != nil {
- httpx.OkJson(w, utils.ReturnHTTPFail(err))
- } else {
- httpx.OkJson(w, utils.ReturnHTTPSuccess(resp))
- }
- }
- }
|