23 lines
494 B
Go
23 lines
494 B
Go
package user
|
|
|
|
import (
|
|
"net/http"
|
|
|
|
"github.com/zeromicro/go-zero/rest/httpx"
|
|
"bj_power_mes/internal/logic/user"
|
|
"bj_power_mes/internal/svc"
|
|
)
|
|
|
|
// 获取当前用户信息
|
|
func UserinfoHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
|
return func(w http.ResponseWriter, r *http.Request) {
|
|
l := user.NewUserinfoLogic(r.Context(), svcCtx)
|
|
resp, err := l.Userinfo()
|
|
if err != nil {
|
|
httpx.ErrorCtx(r.Context(), w, err)
|
|
} else {
|
|
httpx.OkJsonCtx(r.Context(), w, resp)
|
|
}
|
|
}
|
|
}
|