| | |
| | | "wms/constvar" |
| | | "wms/extend/code" |
| | | "wms/extend/util" |
| | | "wms/middleware" |
| | | "wms/models" |
| | | "wms/pkg/logx" |
| | | "wms/pkg/mysqlx" |
| | |
| | | } |
| | | util.ResponseFormat(c, code.Success, "操作成功") |
| | | } |
| | | |
| | | // GetUserInfo |
| | | // |
| | | // @Tags 产品 |
| | | // @Summary 获取登录用户信息 |
| | | // @Produce application/json |
| | | // @Success 200 {object} util.ResponseList{data=map[string]interface{}} "成功" |
| | | // @Router /api-wms/v1/product/getUserInfo [get] |
| | | func (slf ProductController) GetUserInfo(c *gin.Context) { |
| | | userInfo := middleware.GetUserInfo(c) |
| | | m := make(map[string]interface{}) |
| | | m["userName"] = userInfo.Username |
| | | util.ResponseFormat(c, code.Success, m) |
| | | } |
| | |
| | | |
| | | import ( |
| | | "errors" |
| | | "github.com/gin-gonic/gin" |
| | | "github.com/golang-jwt/jwt/v4" |
| | | "wms/request" |
| | | ) |
| | |
| | | return nil, TokenInvalid |
| | | } |
| | | } |
| | | |
| | | func GetUserInfo(c *gin.Context) *request.CustomClaims { |
| | | if claims, exists := c.Get("claims"); exists { |
| | | waitUse := claims.(*request.CustomClaims) |
| | | return waitUse |
| | | } |
| | | return nil |
| | | } |
| | |
| | | productAPI.POST("updateDisuse", productController.UpdateDisuse) //修改报废信息 |
| | | productAPI.POST("listHistory", productController.ListHistory) //产品位置历史记录 |
| | | productAPI.PUT("cancelDisuse/:id", productController.CancelDisuse) //取消报废 |
| | | productAPI.GET("getUserInfo", productController.GetUserInfo) //获取登录用户信息 |
| | | |
| | | } |
| | | |