|
@@ -0,0 +1,63 @@
|
|
|
+package handler
|
|
|
+
|
|
|
+import (
|
|
|
+ "youngee_b_api/consts"
|
|
|
+ "youngee_b_api/model/http_model"
|
|
|
+ "youngee_b_api/service"
|
|
|
+ "youngee_b_api/util"
|
|
|
+
|
|
|
+ "github.com/gin-gonic/gin"
|
|
|
+ "github.com/sirupsen/logrus"
|
|
|
+ log "github.com/sirupsen/logrus"
|
|
|
+)
|
|
|
+
|
|
|
+func WrapGetUserInfoHandler(ctx *gin.Context) {
|
|
|
+ handler := newGetUserInfoHandler(ctx)
|
|
|
+ baseRun(handler)
|
|
|
+}
|
|
|
+
|
|
|
+func newGetUserInfoHandler(ctx *gin.Context) *GetUserInfoHandler {
|
|
|
+ return &GetUserInfoHandler{
|
|
|
+ req: http_model.NewGetUserInfoRequest(),
|
|
|
+ resp: http_model.NewGetUserInfoResponse(),
|
|
|
+ ctx: ctx,
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+type GetUserInfoHandler struct {
|
|
|
+ req *http_model.GetUserInfoRequest
|
|
|
+ resp *http_model.CommonResponse
|
|
|
+ ctx *gin.Context
|
|
|
+}
|
|
|
+
|
|
|
+func (h *GetUserInfoHandler) getRequest() interface{} {
|
|
|
+ return h.req
|
|
|
+}
|
|
|
+
|
|
|
+func (h *GetUserInfoHandler) getContext() *gin.Context {
|
|
|
+ return h.ctx
|
|
|
+}
|
|
|
+
|
|
|
+func (h *GetUserInfoHandler) getResponse() interface{} {
|
|
|
+ return h.resp
|
|
|
+}
|
|
|
+
|
|
|
+func (h *GetUserInfoHandler) run() {
|
|
|
+ userData, err := service.BUserInfo.FindBUserInfoByToken(h.ctx, h.req.Token)
|
|
|
+ if err != nil {
|
|
|
+ logrus.Errorf("[CodeLoginHandler] call AuthCode err:%+v\n", err)
|
|
|
+ util.HandlerPackErrorResp(h.resp, consts.ErrorInternal, err.Error())
|
|
|
+ log.Info("login fail,req:%+v", h.req)
|
|
|
+ return
|
|
|
+ }
|
|
|
+ var data *http_model.GetUserInfoData
|
|
|
+ data = userData
|
|
|
+ h.resp.Message = "成功查询用户信息"
|
|
|
+ h.resp.Data = data
|
|
|
+ h.resp.Status = 20000
|
|
|
+ return
|
|
|
+}
|
|
|
+
|
|
|
+func (h *GetUserInfoHandler) checkParam() error {
|
|
|
+ return nil
|
|
|
+}
|